RTI Recording Service Version 7.1.0
StorageStreamReader.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
11#ifndef HPP_RTI_RECORDING_STORAGE_STREAMREADER_HPP_
12#define HPP_RTI_RECORDING_STORAGE_STREAMREADER_HPP_
13
14#include <vector>
15
16#include "dds/dds.hpp"
17
18#include "rti/routing/detail/ForwarderUtils.hpp"
19
20#include "rti/recording/storage/SelectorState.hpp"
21
22
23namespace rti { namespace recording { namespace storage {
24
32public:
33
34 typedef void* SamplePtr;
35 typedef void* InfoPtr;
36
41 {
42 }
43
75 virtual void read(
76 std::vector<SamplePtr>& sample_seq,
77 std::vector<InfoPtr>& info_seq,
78 const SelectorState& selector) = 0;
93 virtual void return_loan(
94 std::vector<SamplePtr>& sample_seq,
95 std::vector<InfoPtr>& info_seq) = 0;
96
105 virtual bool finished() = 0;
106
112 virtual void reset() = 0;
113};
114
123template <typename Data, typename Info>
125public:
126
130 typedef Data DataRep;
134 typedef Info InfoRep;
135
138
143 void read(
144 std::vector<SamplePtr>& sample_seq,
145 std::vector<InfoPtr>& info_seq,
146 const SelectorState& selector) RTI_FINAL
147 {
148 read(sample_seq_, info_seq_, selector);
149 RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(sample_seq, sample_seq_);
150 RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(info_seq, info_seq_);
151 }
152
158 std::vector<SamplePtr>& sample_seq,
159 std::vector<InfoPtr>& info_seq) RTI_FINAL
160 {
161 RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(sample_seq_, sample_seq);
162 RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(info_seq_, info_seq);
163 return_loan(sample_seq_, info_seq_);
164 sample_seq_.clear();
165 info_seq_.clear();
166 }
167
168 virtual void read(
169 std::vector<Data *>& sample_seq,
170 std::vector<Info *>& info_seq,
171 const SelectorState& selector) = 0;
172
173 virtual void return_loan(
174 std::vector<Data *>& sample_seq,
175 std::vector<Info *>& info_seq) = 0;
176
177 /*
178 * @brief Virtual destructor
179 */
180 virtual ~TStorageStreamReader() {}
181
182private:
183
184 std::vector<Data*> sample_seq_;
185 std::vector<Info*> info_seq_;
186};
187
193typedef TStorageStreamReader<
194 dds::core::xtypes::DynamicData,
195 dds::sub::SampleInfo> DynamicDataStorageStreamReader;
196
197} } } // namespace rti::recording::storage
198
199#endif /* HPP_RTI_RECORDING_STORAGE_STREAMREADER_HPP_ */
This class is used by Replay Service or Converter when asking the storage plugin for data....
Definition: SelectorState.hpp:98
Storage stream reader.
Definition: StorageStreamReader.hpp:31
virtual void return_loan(std::vector< SamplePtr > &sample_seq, std::vector< InfoPtr > &info_seq)=0
Method for releasing resources related to the queried data samples.
virtual void read(std::vector< SamplePtr > &sample_seq, std::vector< InfoPtr > &info_seq, const SelectorState &selector)=0
Method called by Replay Service and Converter to retrieve samples from storage for a particular strea...
virtual bool finished()=0
Method for querying whether there are no more samples for this stream.
virtual ~StorageStreamReader()
Virtual destructor.
Definition: StorageStreamReader.hpp:40
virtual void reset()=0
Method used by Replay Service when looping, to start over. After this method is called,...
A templatized wrapping implementation of StorageStreamReader, providing a strongly-typed interface re...
Definition: StorageStreamReader.hpp:124
void return_loan(std::vector< SamplePtr > &sample_seq, std::vector< InfoPtr > &info_seq) RTI_FINAL
Performs the conversion between the vector of data and info pointers to strongly-typed pointers.
Definition: StorageStreamReader.hpp:157
void read(std::vector< SamplePtr > &sample_seq, std::vector< InfoPtr > &info_seq, const SelectorState &selector) RTI_FINAL
Performs the conversion between the vector of data and info pointers to strongly-typed pointers.
Definition: StorageStreamReader.hpp:143
Data DataRep
The data type.
Definition: StorageStreamReader.hpp:130
Info InfoRep
The info type.
Definition: StorageStreamReader.hpp:134
TStorageStreamReader< dds::core::xtypes::DynamicData, dds::sub::SampleInfo > DynamicDataStorageStreamReader
Convenience definition of typed StorageStreamReader that requires dds::core::xtypes::DynamicData for ...
Definition: StorageStreamReader.hpp:195
The RTI namespace.
Definition: RecordingServiceImpl.hpp:22