10#ifndef HPP_RTI_RECORDING_STORAGE_STORAGEDEFS_HPP_
11#define HPP_RTI_RECORDING_STORAGE_STORAGEDEFS_HPP_
16#ifndef dds_c_builtin_h
17#include "dds_c/dds_c_builtin.h"
20#include <rti/core/Exception.hpp>
21#include "rti/recording/PropertySet.hpp"
23#include "recordingservice/recordingservice_storagereader.h"
24#include "recordingservice/recordingservice_storagewriter.h"
26namespace rti {
namespace recording {
30typedef std::shared_ptr<RTI_RecordingServiceStorageWriter>
31 StorageWriterSharedPtr;
32typedef std::shared_ptr<RTI_RecordingServiceStorageStreamWriter>
33 StorageStreamWriterSharedPtr;
34typedef std::shared_ptr<RTI_RecordingServiceStorageParticipantWriter>
35 StorageParticipantWriterSharedPtr;
36typedef std::shared_ptr<RTI_RecordingServiceStoragePublicationWriter>
37 StoragePublicationWriterSharedPtr;
38typedef std::shared_ptr<RTI_RecordingServiceStorageSubscriptionWriter>
39 StorageSubscriptionWriterSharedPtr;
42typedef std::shared_ptr<RTI_RecordingServiceStorageReader>
43 StorageReaderSharedPtr;
44typedef std::shared_ptr<RTI_RecordingServiceStorageStreamReader>
45 StorageStreamReaderSharedPtr;
46typedef std::shared_ptr<RTI_RecordingServiceStorageStreamInfoReader>
47 StorageStreamInfoReaderSharedPtr;
54class NativeStorageStreamWriterDeleter {
56 NativeStorageStreamWriterDeleter(
57 RTI_RecordingServiceStorageWriter *storage_writer_parent)
58 : storage_writer_parent_(storage_writer_parent)
60 RTI_CHECK_PRECONDITION(storage_writer_parent != NULL);
63 void operator ()(RTI_RecordingServiceStorageStreamWriter *instance)
65 if (instance != NULL) {
66 storage_writer_parent_->delete_stream_writer(
67 storage_writer_parent_,
72 void operator ()(RTI_RecordingServiceStorageParticipantWriter *instance)
77 && storage_writer_parent_->delete_participant_writer != NULL) {
78 storage_writer_parent_->delete_participant_writer(
79 storage_writer_parent_,
84 void operator ()(RTI_RecordingServiceStoragePublicationWriter *instance)
89 && storage_writer_parent_->delete_publication_writer != NULL) {
90 storage_writer_parent_->delete_publication_writer(
91 storage_writer_parent_,
96 void operator ()(RTI_RecordingServiceStorageSubscriptionWriter *instance)
101 && storage_writer_parent_->delete_subscription_writer != NULL) {
102 storage_writer_parent_->delete_subscription_writer(
103 storage_writer_parent_,
109 RTI_RecordingServiceStorageWriter *storage_writer_parent_;
112class NativeStorageStreamInfoReaderDeleter {
114 NativeStorageStreamInfoReaderDeleter(
115 RTI_RecordingServiceStorageReader *storage_reader_parent)
116 : storage_reader_parent_(storage_reader_parent)
118 RTI_CHECK_PRECONDITION(storage_reader_parent != NULL);
121 void operator ()(RTI_RecordingServiceStorageStreamInfoReader *instance)
123 if (instance != NULL) {
124 storage_reader_parent_->delete_stream_info_reader(
125 storage_reader_parent_,
131 RTI_RecordingServiceStorageReader *storage_reader_parent_;
134class NativeStorageStreamReaderDeleter {
136 NativeStorageStreamReaderDeleter(
137 RTI_RecordingServiceStorageReader *storage_reader_parent)
138 : storage_reader_parent_(storage_reader_parent)
140 RTI_CHECK_PRECONDITION(storage_reader_parent != NULL);
143 void operator ()(RTI_RecordingServiceStorageStreamReader *instance)
145 if (instance != NULL) {
146 storage_reader_parent_->delete_stream_reader(
147 storage_reader_parent_,
153 RTI_RecordingServiceStorageReader *storage_reader_parent_;
156inline bool is_discovery_stream(
const std::string& stream_name)
158 if (stream_name.compare(DDS_PARTICIPANT_TOPIC_NAME) == 0
159 || stream_name.compare(DDS_PUBLICATION_TOPIC_NAME) == 0
160 || stream_name.compare(DDS_SUBSCRIPTION_TOPIC_NAME) == 0) {
166inline std::string domain_id_property_name()
168 return RTI_RECORDING_SERVICE_DOMAIN_ID_PROPERTY_NAME;
171inline std::string start_timestamp_property_name()
173 return RTI_RECORDING_SERVICE_START_TIMESTAMP_PROPERTY_NAME;
176inline std::string end_timestamp_property_name()
178 return RTI_RECORDING_SERVICE_END_TIMESTAMP_PROPERTY_NAME;
181inline std::string jump_timestamp_property_name()
183 return RTI_RECORDING_SERVICE_JUMP_TIMESTAMP_PROPERTY_NAME;
186inline std::string sample_order_property_name()
188 return RTI_RECORDING_SERVICE_PLAYBACK_SAMPLE_ORDER_PROPERTY_NAME;
191inline std::string reverse_mode_property_name()
193 return RTI_RECORDING_SERVICE_PLAYBACK_REVERSE_MODE_PROPERTY_NAME;
197inline T get_from_properties(
198 const rti::recording::PropertySet& properties,
199 const std::string& property_name)
201 rti::recording::PropertySet::const_iterator found =
202 properties.find(property_name);
203 if (found == properties.end()) {
204 throw dds::core::Error(
205 "!found property with name=" + property_name);
208 std::stringstream str_stream(found->second);
210 if (str_stream.fail()) {
211 throw dds::core::Error(
212 "!parse value from property with name=" + property_name);
218inline void add_to_properties(
219 rti::recording::PropertySet& properties,
220 const std::string& property_name,
223 rti::recording::PropertySet::const_iterator found =
224 properties.find(property_name);
225 if (found != properties.end()) {
228 std::stringstream str_stream;
230 if (str_stream.fail()) {
231 throw dds::core::Error(
232 "!add value for property with name=" + property_name);
234 properties[property_name] = str_stream.str();
239#define RecorderPrint_exception(...) \
240 RTILogMessage_print( \
241 RTI_LOG_PRINT_FORMAT_MASK_ALL, \
242 RTI_LOG_BIT_EXCEPTION, \
The RTI namespace.
Definition: RecordingServiceImpl.hpp:22