11#ifndef RTI_RECORDING_STORAGE_DETAIL_STORAGE_DISC_STREAM_READER_FORWARDER_HPP_
12#define RTI_RECORDING_STORAGE_DETAIL_STORAGE_DISC_STREAM_READER_FORWARDER_HPP_
17#include "rti/recording/storage/StorageStreamInfoReader.hpp"
18#include "log/log_common.h"
19#include "recordingservice/recordingservice_storagereader.h"
22#include "rti/routing/detail/ForwarderUtils.hpp"
24namespace rti {
namespace recording {
namespace storage {
namespace detail {
34 : storage_reader_parent_(storage_reader_parent)
36 RTI_CHECK_PRECONDITION(storage_reader_parent != NULL);
41 RTI_CHECK_PRECONDITION(stream_reader_instance != NULL);
44 stream_reader_instance);
51class StorageStreamInfoReaderForwarder :
52 public RTI_RecordingServiceStorageStreamInfoReader {
55 StorageStreamInfoReaderForwarder(
58 : storage_stream_reader_(
62 read = StorageStreamInfoReaderForwarder::read_fwd;
63 return_loan = StorageStreamInfoReaderForwarder::return_loan_fwd;
64 get_service_start_time =
65 StorageStreamInfoReaderForwarder::get_service_start_time_fwd;
66 get_service_stop_time =
67 StorageStreamInfoReaderForwarder::get_service_stop_time_fwd;
68 finished = StorageStreamInfoReaderForwarder::finished_fwd;
69 reset = StorageStreamInfoReaderForwarder::reset_fwd;
70 stream_reader_data =
this;
73 ~StorageStreamInfoReaderForwarder()
79 void *stream_reader_data,
80 RTI_RoutingServiceStreamInfo ***stream_info_array,
82 const struct RTI_RecordingServiceSelectorState *native_selector)
85 StorageStreamInfoReaderForwarder *forwarder =
86 static_cast<StorageStreamInfoReaderForwarder *
>(
88 forwarder->storage_stream_reader_->read(
89 forwarder->sample_seq_,
90 SelectorState(*native_selector));
92 *array_length =
static_cast<int>(forwarder->sample_seq_.size());
93 if (*array_length > 0) {
94 forwarder->native_sample_seq_.resize(*array_length);
95 for (
size_t i = 0; i < forwarder->sample_seq_.size(); i++) {
96 forwarder->native_sample_seq_[i] =
97 &(forwarder->sample_seq_[i]->native());
100 reinterpret_cast<RTI_RoutingServiceStreamInfo **
>(
101 forwarder->native_sample_seq_.data());
103 }
catch (
const std::exception& ex) {
104 RecorderPrint_exception(
108 RecorderPrint_exception(
110 "unknown exception");
114 static void return_loan_fwd(
115 void *stream_reader_data,
116 struct RTI_RoutingServiceStreamInfo **stream_info_array,
119 RTIOsapiUtility_unusedParameter(stream_info_array);
120 RTIOsapiUtility_unusedParameter(array_length);
123 StorageStreamInfoReaderForwarder *forwarder =
124 static_cast<StorageStreamInfoReaderForwarder *
>(
128 forwarder->storage_stream_reader_->return_loan(
129 forwarder->sample_seq_);
131 forwarder->sample_seq_.clear();
132 forwarder->native_sample_seq_.clear();
133 }
catch (
const std::exception& ex) {
134 RecorderPrint_exception(
138 RecorderPrint_exception(
140 "unknown exception");
144 static long long get_service_start_time_fwd(
void *stream_reader_data)
147 StorageStreamInfoReaderForwarder *forwarder =
148 static_cast<StorageStreamInfoReaderForwarder *
>(
151 forwarder->storage_stream_reader_->service_start_time();
152 }
catch (
const std::exception& ex) {
153 RecorderPrint_exception(
157 RecorderPrint_exception(
159 "unknown exception");
164 static long long get_service_stop_time_fwd(
void *stream_reader_data)
167 StorageStreamInfoReaderForwarder *forwarder =
168 static_cast<StorageStreamInfoReaderForwarder *
>(
171 forwarder->storage_stream_reader_->service_stop_time();
172 }
catch (
const std::exception& ex) {
173 RecorderPrint_exception(
177 RecorderPrint_exception(
179 "unknown exception");
184 static int finished_fwd(
void *stream_reader_data)
187 StorageStreamInfoReaderForwarder *forwarder =
188 static_cast<StorageStreamInfoReaderForwarder *
>(
190 return (forwarder->storage_stream_reader_->finished() ?
193 }
catch (
const std::exception& ex) {
194 RecorderPrint_exception(
198 RecorderPrint_exception(
200 "unknown exception");
205 static void reset_fwd(
void *stream_reader_data)
208 StorageStreamInfoReaderForwarder *forwarder =
209 static_cast<StorageStreamInfoReaderForwarder *
>(
211 forwarder->storage_stream_reader_->reset();
212 }
catch (
const std::exception& ex) {
213 RecorderPrint_exception(
217 RecorderPrint_exception(
219 "unknown exception");
223 StorageStreamInfoReader * stream_reader()
225 return storage_stream_reader_.get();
229 std::shared_ptr<StorageStreamInfoReader> storage_stream_reader_;
231 std::vector<rti::routing::StreamInfo *> sample_seq_;
232 std::vector<RTI_RoutingServiceStreamInfo *> native_sample_seq_;
233 std::vector<int32_t> domain_id_seq_;
Storage reader.
Definition: StorageReader.hpp:57
virtual void delete_stream_info_reader(StorageStreamInfoReader *stream_info_reader)=0
Replay Service calls this to delete a stream information reader.
Storage discovery stream reader.
Definition: StorageStreamInfoReader.hpp:31
Definition: StorageStreamInfoReaderForwarder.hpp:31
The RTI namespace.
Definition: RecordingServiceImpl.hpp:22