RTI Routing Service  Version 6.0.0
 All Data Structures Files Functions Typedefs Enumerations Enumerator Groups Pages
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 
19 namespace rti { namespace routing { namespace adapter {
20 
36 class StreamWriter : public UpdatableEntity {
37 
38 public:
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 
87 template <typename Data, typename Info>
88 class TStreamWriter : public StreamWriter {
89 
90 public:
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 
129  virtual ~TStreamWriter()
130  {
131  }
132 
133 private:
134  std::vector<Data*> sample_seq_;
135  std::vector<Info*> info_seq_;
136 };
137 
138 
146 typedef TStreamWriter<dds::core::xtypes::DynamicData, dds::sub::SampleInfo>
148 
149 }}}
150 
151 #endif // RTI_ROUTING_ADAPTER_STREAM_WRITER_HPP_

RTI Routing Service Version 6.0.0 Copyright © Sun Mar 3 2019 Real-Time Innovations, Inc