Skip to content

Commit f2467b8

Browse files
committed
Add some docstrings
1 parent bd1489b commit f2467b8

4 files changed

Lines changed: 55 additions & 2 deletions

File tree

include/web_video_server/image_transport_streamer.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
namespace web_video_server
4949
{
5050

51+
/**
52+
* @brief A common base class for all streaming plugins using image_transport to subscribe to image
53+
* topics.
54+
*/
5155
class ImageTransportStreamerBase : public StreamerInterface
5256
{
5357
public:

include/web_video_server/libav_streamer.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ extern "C"
5858
namespace web_video_server
5959
{
6060

61+
/**
62+
* @brief A common base class for all streaming plugins using image_transport to subscribe to image
63+
* topics and libav to encode and stream video.
64+
*/
6165
class LibavStreamerBase : public ImageTransportStreamerBase
6266
{
6367
public:

include/web_video_server/multipart_stream.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ struct PendingFooter
5050
std::weak_ptr<std::string> contents;
5151
};
5252

53+
/**
54+
* Helper class to manage sending multipart HTTP responses.
55+
*/
5356
class MultipartStream
5457
{
5558
public:

include/web_video_server/streamer.hpp

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,42 @@
4242
namespace web_video_server
4343
{
4444

45+
/**
46+
* @brief A common interface for all streaming plugins.
47+
*/
4548
class StreamerInterface
4649
{
4750
public:
4851
StreamerInterface(
4952
const async_web_server_cpp::HttpRequest & request,
5053
async_web_server_cpp::HttpConnectionPtr connection,
5154
rclcpp::Node::SharedPtr node);
55+
virtual ~StreamerInterface();
5256

57+
/**
58+
* @brief Starts the streaming process.
59+
*/
5360
virtual void start() = 0;
54-
virtual ~StreamerInterface();
5561

62+
/**
63+
* @brief Returns true if the streamer is inactive and should be deleted.
64+
*
65+
* This could be because the connection was closed or snapshot was successfully sent (in case
66+
* of snapshot streamers).
67+
*/
5668
bool isInactive()
5769
{
5870
return inactive_;
5971
}
6072

6173
/**
62-
* Restreams the last received image frame if older than max_age.
74+
* @brief Restreams the last received image frame if older than max_age.
6375
*/
6476
virtual void restreamFrame(std::chrono::duration<double> max_age) = 0;
6577

78+
/**
79+
* @brief Returns the topic being streamed.
80+
*/
6681
std::string getTopic()
6782
{
6883
return topic_;
@@ -76,21 +91,48 @@ class StreamerInterface
7691
std::string topic_;
7792
};
7893

94+
/**
95+
* @brief A factory interface for creating Streamer instances.
96+
*/
7997
class StreamerFactoryInterface
8098
{
8199
public:
100+
/**
101+
* @brief Returns the type of streamer created by this factory.
102+
*
103+
* This should match the "type" query parameter used to select the streamer.
104+
*/
82105
virtual std::string get_type() = 0;
83106

107+
/**
108+
* @brief Creates a new Streamer instance.
109+
* @param request The HTTP request that initiated the streamer.
110+
* @param connection The HTTP connection to use for streaming.
111+
* @param node The ROS2 node to use for subscribing to topics.
112+
* @return A shared pointer to the created Streamer instance.
113+
*/
84114
virtual std::shared_ptr<StreamerInterface> create_streamer(
85115
const async_web_server_cpp::HttpRequest & request,
86116
async_web_server_cpp::HttpConnectionPtr connection,
87117
rclcpp::Node::SharedPtr node) = 0;
88118

119+
/**
120+
* @brief Creates HTML code for embedding a viewer for this streamer.
121+
* @param request The HTTP request that initiated the viewer.
122+
*/
89123
virtual std::string create_viewer(const async_web_server_cpp::HttpRequest & request);
90124

125+
/**
126+
* @brief Returns a list of available topics that can be streamed by this streamer.
127+
* @param node The ROS2 node to use for discovering topics.
128+
* @return A vector of topic names.
129+
*/
91130
virtual std::vector<std::string> get_available_topics(rclcpp::Node::SharedPtr node);
92131
};
93132

133+
/**
134+
* @brief A factory interface for creating snapshot Streamer instances.
135+
*/
94136
class SnapshotStreamerFactoryInterface : public StreamerFactoryInterface {};
95137

96138
} // namespace web_video_server

0 commit comments

Comments
 (0)