Skip to content

Commit

Permalink
add stream service
Browse files Browse the repository at this point in the history
  • Loading branch information
mpavezb committed Jul 3, 2018
1 parent bb025c6 commit 104a3c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions include/ltm/db/stream_collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ namespace ltm {
MetadataPtr ltm_create_metadata();
bool ltm_update(uint32_t uid, const StreamType &stream);

// Must be provided by the user
virtual MetadataPtr make_metadata(const StreamType &stream) = 0;

};

}
Expand Down
7 changes: 4 additions & 3 deletions include/ltm/plugin/impl/stream_ros_impl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ namespace ltm {

template<class StreamType, class StreamSrv>
bool StreamROS<StreamType, StreamSrv>::add_service(StreamSrvRequest &req, StreamSrvResponse &res) {

ROS_INFO_STREAM(this->_log_prefix << "Inserting stream (" << req.msg.uid << ") to collection '" << this->ltm_get_collection_name() << "'");
this->ltm_insert(req.msg, this->make_metadata(req.msg));
return true;
}

template<class StreamType, class StreamSrv>
bool StreamROS<StreamType, StreamSrv>::get_service(StreamSrvRequest &req, StreamSrvResponse &res) {
ROS_INFO_STREAM(this->_log_prefix << "Retrieving stream (" << req.uid << ") from collection '"
<< this->ltm_get_collection_name() << "'");
ROS_INFO_STREAM(this->_log_prefix << "Retrieving stream (" << req.uid << ") from collection '" << this->ltm_get_collection_name() << "'");
StreamWithMetadataPtr stream_ptr;
if (!this->ltm_get(req.uid, stream_ptr)) {
ROS_ERROR_STREAM(this->_log_prefix << "Stream with uid '" << req.uid << "' not found.");
Expand Down

0 comments on commit 104a3c2

Please sign in to comment.