RTI Recording Service  Version 6.1.1
StorageStreamWriter.hpp
1 /*
2  * (c) Copyright, Real-Time Innovations, 2017-.
3  * All rights reserved.
4  * No duplications, whole or partial, manual or electronic, may be made
5  * without express written permission. Any such copies, or
6  * revisions thereof, must display this notice unaltered.
7  * This code contains trade secrets of Real-Time Innovations, Inc.
8  */
9 
10 #ifndef RTI_RECORDING_STORAGE_STORAGESTREAMWRITER_HPP_
11 #define RTI_RECORDING_STORAGE_STORAGESTREAMWRITER_HPP_
12 
13 #include <vector>
14 
15 #include "dds/dds.hpp"
16 
17 #include "rti/routing/detail/ForwarderUtils.hpp"
18 
19 namespace rti { namespace recording { namespace storage {
20 
29 public:
30 
31  typedef void* SamplePtr;
32  typedef void* InfoPtr;
33 
37  virtual ~StorageStreamWriter() {}
38 
50  virtual void store(
51  const std::vector<SamplePtr>& sample_seq,
52  const std::vector<InfoPtr>& info_seq) = 0;
53 };
54 
55 
64 template <typename Data, typename Info>
66 public:
67 
71  typedef Data DataRep;
75  typedef Info InfoRep;
76 
78 
83  void store(
84  const std::vector<SamplePtr>& sample_seq,
85  const std::vector<InfoPtr>& info_seq)
86  {
87  RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(sample_seq_, sample_seq);
88  RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(info_seq_, info_seq);
89 
90  store(sample_seq_, info_seq_);
91  }
92 
98  virtual void store(
99  const std::vector<Data *>& sample_seq,
100  const std::vector<Info *>& info_seq) = 0;
101 
106  {
107  }
108 
109 private:
110  std::vector<Data *> sample_seq_;
111  std::vector<Info *> info_seq_;
112 
113 };
114 
121 typedef TStorageStreamWriter<
122  dds::core::xtypes::DynamicData,
123  dds::sub::SampleInfo> DynamicDataStorageStreamWriter;
124 
125 
126 } } } // namespace rti::recording::storage
127 
128 #endif /* HPP_RTI_RECORDING_STORAGE_STORAGESTREAMWRITER_HPP_ */
TStorageStreamWriter< dds::core::xtypes::DynamicData, dds::sub::SampleInfo > DynamicDataStorageStreamWriter
Convenience definition of typed StorageStreamWriter that requires dds::core::xtypes::DynamicData for ...
Definition: StorageStreamWriter.hpp:123
Info InfoRep
The info type.
Definition: StorageStreamWriter.hpp:75
Data DataRep
The data type.
Definition: StorageStreamWriter.hpp:71
virtual ~TStorageStreamWriter()
Virtual destructor.
Definition: StorageStreamWriter.hpp:105
virtual void store(const std::vector< SamplePtr > &sample_seq, const std::vector< InfoPtr > &info_seq)=0
Implement this method to store data in the storage of your choice.
void store(const std::vector< SamplePtr > &sample_seq, const std::vector< InfoPtr > &info_seq)
Performs the conversion between the vector of data and info pointers to strongly-typed pointers...
Definition: StorageStreamWriter.hpp:83
Storage stream writer.
Definition: StorageStreamWriter.hpp:28
A templatized wrapping implementation of StorageStreamWriter, providing a strongly-typed interface re...
Definition: StorageStreamWriter.hpp:65
The RTI namespace.
Definition: RecordingServiceImpl.hpp:22
virtual ~StorageStreamWriter()
Virtual destructor.
Definition: StorageStreamWriter.hpp:37