RTI Routing Service Version 7.3.0
StreamWriter.hpp
1/*
2 * (c) Copyright, Real-Time Innovations, 2017.
3 * All rights reserved.
4 *
5 * No duplications, whole or partial, manual or electronic, may be made
6 * without express written permission. Any such copies, or
7 * revisions thereof, must display this notice unaltered.
8 * This code contains trade secrets of Real-Time Innovations, Inc.
9 */
10
11#ifndef RTI_ROUTING_ADAPTER_STREAM_WRITER_HPP_
12#define RTI_ROUTING_ADAPTER_STREAM_WRITER_HPP_
13
14#include <vector>
15
16#include <rti/routing/UpdatableEntity.hpp>
17#include <rti/routing/detail/ForwarderUtils.hpp>
18
19namespace rti { namespace routing { namespace adapter {
20
37
38public:
39
40 typedef void* SamplePtr;
41 typedef void* InfoPtr;
42
64 virtual int write(
65 const std::vector<SamplePtr>& sample_seq,
66 const std::vector<InfoPtr>& info_seq) = 0;
67
71 virtual ~StreamWriter()
72 {
73 }
74};
75
87template <typename Data, typename Info>
89
90public:
91
95 typedef Data DataRep;
96 typedef DataRep* DataRepPtr;
100 typedef Info InfoRep;
101 typedef InfoRep* InfoRepPtr;
102
107 int write(
108 const std::vector<SamplePtr>& sample_seq,
109 const std::vector<InfoPtr>& info_seq) RTI_FINAL
110 {
111 RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(sample_seq_, sample_seq);
112 RTI_ROUTING_SAMPLE_VECTOR_COPY_PTRS(info_seq_, info_seq);
113
114 return write(sample_seq_, info_seq_);
115 }
116
122 virtual int write(
123 const std::vector<Data*>& sample_seq,
124 const std::vector<Info*>& info_seq) = 0;
125
130 {
131 }
132
133private:
134 std::vector<Data*> sample_seq_;
135 std::vector<Info*> info_seq_;
136};
137
138
146typedef TStreamWriter<dds::core::xtypes::DynamicData, dds::sub::SampleInfo>
148
149}}}
150
151#endif // RTI_ROUTING_ADAPTER_STREAM_WRITER_HPP_
Defines a common interface for all the pluggable entities that can be updated at runtime.
Definition: UpdatableEntity.hpp:34
Provides a way to write samples of a specific type in a data domain.
Definition: StreamWriter.hpp:36
virtual int write(const std::vector< SamplePtr > &sample_seq, const std::vector< InfoPtr > &info_seq)=0
Writes a collection of data samples to the output stream associated with this StreamWriter.
virtual ~StreamWriter()
Virtual destructor.
Definition: StreamWriter.hpp:71
A wrapper implementation of a StreamWriter that provides a strongly-typed interface through template ...
Definition: StreamWriter.hpp:88
int write(const std::vector< SamplePtr > &sample_seq, const std::vector< InfoPtr > &info_seq) RTI_FINAL
Performs the conversion between the vector of data and info pointers to strongly-type pointers.
Definition: StreamWriter.hpp:107
Info InfoRep
The info type.
Definition: StreamWriter.hpp:100
Data DataRep
The data type.
Definition: StreamWriter.hpp:95
virtual ~TStreamWriter()
Virtual destructor.
Definition: StreamWriter.hpp:129
virtual int write(const std::vector< Data * > &sample_seq, const std::vector< Info * > &info_seq)=0
Interface redefinition.
TStreamWriter< dds::core::xtypes::DynamicData, dds::sub::SampleInfo > DynamicDataStreamWriter
Convenient definition of typed StreamWriter that requires dds::core::xtypes::DynamicData for data sam...
Definition: StreamWriter.hpp:147