RTI Recording Service  Version 6.0.1
 All Data Structures Namespaces Files Functions Typedefs Enumerations Enumerator Groups
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 
23 namespace rti { namespace recording { namespace storage {
24 
32 public:
33 
34  typedef void* SamplePtr;
35  typedef void* InfoPtr;
36 
41  {
42  }
43 
67  virtual void read(
68  std::vector<SamplePtr>& sample_seq,
69  std::vector<InfoPtr>& info_seq,
70  const SelectorState& selector) = 0;
85  virtual void return_loan(
86  std::vector<SamplePtr>& sample_seq,
87  std::vector<InfoPtr>& info_seq) = 0;
88 
97  virtual bool finished() = 0;
98 
104  virtual void reset() = 0;
105 };
106 
115 template <typename Data, typename Info>
117 public:
118 
122  typedef Data DataRep;
126  typedef Info InfoRep;
127 
130 
135  void read(
136  std::vector<SamplePtr>& sample_seq,
137  std::vector<InfoPtr>& info_seq,
138  const SelectorState& selector) RTI_FINAL
139  {
140  read(sample_seq_, info_seq_, selector);
141  RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(sample_seq, sample_seq_);
142  RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(info_seq, info_seq_);
143  }
144 
150  std::vector<SamplePtr>& sample_seq,
151  std::vector<InfoPtr>& info_seq) RTI_FINAL
152  {
153  RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(sample_seq_, sample_seq);
154  RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(info_seq_, info_seq);
155  return_loan(sample_seq_, info_seq_);
156  sample_seq_.clear();
157  info_seq_.clear();
158  }
159 
160  virtual void read(
161  std::vector<Data *>& sample_seq,
162  std::vector<Info *>& info_seq,
163  const SelectorState& selector) = 0;
164 
165  virtual void return_loan(
166  std::vector<Data *>& sample_seq,
167  std::vector<Info *>& info_seq) = 0;
168 
169  /*
170  * @brief Virtual destructor
171  */
172  virtual ~TStorageStreamReader() {}
173 
174 private:
175 
176  std::vector<Data*> sample_seq_;
177  std::vector<Info*> info_seq_;
178 };
179 
185 typedef TStorageStreamReader<
186  dds::core::xtypes::DynamicData,
187  dds::sub::SampleInfo> DynamicDataStorageStreamReader;
188 
189 } } } // namespace rti::recording::storage
190 
191 #endif /* HPP_RTI_RECORDING_STORAGE_STREAMREADER_HPP_ */

RTI Recording Service Version 6.0.1 Copyright © Sun Nov 17 2019 Real-Time Innovations, Inc