OpenDDS  Snapshot(2023/04/28-20:55)
DataSampleElement.h
Go to the documentation of this file.
1 /*
2  * Distributed under the OpenDDS License.
3  * See: http://www.opendds.org/license.html
4  */
5 #ifndef OPENDDS_DCPS_DATASAMPLEELEMENT_H
6 #define OPENDDS_DCPS_DATASAMPLEELEMENT_H
7 
8 #include "dds/DdsDcpsInfoUtilsC.h"
9 #include "Definitions.h"
12 #include "DataSampleHeader.h"
13 #include "RcObject.h"
14 #include "PoolAllocator.h"
15 #include "PoolAllocationBase.h"
16 #include "RcHandle_T.h"
17 #include "Message_Block_Ptr.h"
18 
19 class DDS_TEST;
20 
22 
23 namespace OpenDDS {
24 namespace DCPS {
25 
27 
31 
35 
36 /**
37 * Currently we contain entire messages in a single ACE_Message_Block
38 * chain.
39 */
41 
42 /**
43 * Wraps the marshaled message sample to be published, along with
44 * the publication Id and Instance handle for downstream processing.
45 *
46 * Internally there are next/previous pointers that used for lists
47 * InstanceDataSampleList, SendStateDataSampleList, and WriterDataSampleList.
48 * These pointers are kept in this single element rather than having multiple smaller
49 * lists in order to allow us to allocate once which will minimize locking.
50 * Note that because the list pointers are stored within the element,
51 * the element can simultaneously be in at most one InstanceDataSampleList list, one
52 * SendStateDataSampleList list, and one WriterDataSampleList list.
53 */
55 
56 
57 public:
58  DataSampleElement(GUID_t publication_id,
59  TransportSendListener* send_listener,
60  PublicationInstance_rch handle);
61 
63  DataSampleElement& operator=(const DataSampleElement& elem);
64 
66 
67  const DataSampleHeader& get_header() const;
68  DataSampleHeader& get_header();
69 
70  DataSample* get_sample() const;
71  DataSample* get_sample();
72 
73  void set_sample(Message_Block_Ptr sample);
74 
75  GUID_t get_pub_id() const;
76 
77  CORBA::ULong get_num_subs() const;
78 
79  void set_num_subs(CORBA::ULong num_subs);
80 
81  const OpenDDS::DCPS::GUID_t* get_sub_ids() const;
82  OpenDDS::DCPS::GUID_t get_sub_id(CORBA::ULong index) const;
83 
84  void set_sub_id(CORBA::ULong index, OpenDDS::DCPS::GUID_t id);
85 
86  TransportSendListener* get_send_listener() const;
87  TransportSendListener* get_send_listener();
88 
89  PublicationInstance_rch get_handle() const;
90 
91  typedef OPENDDS_MAP(DataLinkIdType, GUIDSeq_var) DataLinkIdTypeGUIDMap;
92  DataLinkIdTypeGUIDMap& get_filter_per_link();
93 
94  void set_filter_out(GUIDSeq *filter_out);
95 
96  void set_transaction_id(ACE_UINT64 transaction_id);
97 
98  ACE_UINT64 transaction_id() const;
99 
100 private:
101 
103 
104  /// The OpenDDS DCPS header for this sample
106 
107  /// Message being sent which includes the DataSampleHeader message block
108  /// and DataSample message block.
110 
111  /// Publication Id used downstream.
113 
115 
117 
118  /// Pointer to object that will be informed when the data has
119  /// been delivered. This needs to be set prior to using the
120  /// TransportClient to send().
122 
123  /// The pointer to the object that contains the instance information
124  /// and data sample list.
125  /// The client holds this as an InstanceHandle_t.
126  PublicationInstance_rch handle_;
127 
128  //{@
129  /// tracking for Content-Filtering data
130  GUIDSeq_var filter_out_;
131  DataLinkIdTypeGUIDMap filter_per_link_;
132  //@}
133 
134  DataSampleElement* get_next_send_sample() const;
135 
136  void set_next_send_sample(DataSampleElement* next_send_sample);
137 
138  /// *DataSampleList(s) is in charge of managing list placement therefore
139  /// needs access to pointers
141  friend class WriterDataSampleList;
143  friend class TransportClient;
144  friend class ::DDS_TEST;
145  /// Iterators needs access to prev/next pointers for iteration
148 
149 
150  /// Used to make removal from the
151  /// container _much_ more efficient.
152 
153  /// Thread of all data within a DataWriter.
156 
157  /// Thread of data within the instance.
160 
161  /// Thread of data being unsent/sending/sent/released.
164 };
165 
166 
167 } // namespace DCPS
168 } // namespace OpenDDS
169 
171 
172 #if defined(__ACE_INLINE__)
173 #include "DataSampleElement.inl"
174 #endif /* __ACE_INLINE__ */
175 
176 #endif /* OPENDDS_DCPS_DATASAMPLEELEMENT_H */
RcHandle< PublicationInstance > PublicationInstance_rch
const CORBA::ULong MAX_READERS_PER_ELEM
GUIDSeq_var filter_out_
tracking for Content-Filtering data
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
SendStateDataSampleList STL-style const iterator implementation.
TransportSendListener * send_listener_
DataSampleElement * previous_instance_sample_
DataSampleElement * next_instance_sample_
Thread of data within the instance.
ACE_UINT64 DataLinkIdType
Identifier type for DataLink objects.
DataSampleHeader header_
The OpenDDS DCPS header for this sample.
ACE_CDR::ULong ULong
PublicationInstance_rch handle_
GUID_t publication_id_
Publication Id used downstream.
DataSampleElement * next_send_sample_
Thread of data being unsent/sending/sent/released.
DataLinkIdTypeGUIDMap filter_per_link_
ACE_HANDLE get_handle(void)
Mix-in class for DDS entities which directly use the transport layer.
unsigned long long ACE_UINT64
sequence< GUID_t > GUIDSeq
Definition: DdsDcpsGuid.idl:62
DataSampleElement * next_writer_sample_
DataSampleElement * previous_send_sample_
SendStateDataSampleList STL-style iterator implementation.
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
Cached_Allocator_With_Overflow< DataSampleElement, ACE_Null_Mutex > DataSampleElementAllocator
DataSampleElement * previous_writer_sample_
Thread of all data within a DataWriter.
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
typedef OPENDDS_MAP(OPENDDS_STRING, OPENDDS_STRING) ValueMap
Helper types and functions for config file parsing.
ACE_Message_Block DataSample
Struct that has information about an instance and the instance sample list.