OpenDDS  Snapshot(2023/04/28-20:55)
MessageParser.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef OPENDDS_DCPS_RTPS_MESSAGEPARSER_H
9 #define OPENDDS_DCPS_RTPS_MESSAGEPARSER_H
10 
11 #include "RtpsCoreTypeSupportImpl.h"
12 
13 
15 
16 namespace OpenDDS {
17 namespace RTPS {
18 
19 /// Utility for iterating through a contiguous buffer (either really contiguous
20 /// or virtually contiguous using message block chaining) of RTPS Submessages
21 /// optionally prefixed by the RTPS Header
23 public:
24  explicit MessageParser(const ACE_Message_Block& in);
25  explicit MessageParser(const DDS::OctetSeq& in);
26 
27  bool parseHeader();
28  bool parseSubmessageHeader();
29  bool hasNextSubmessage() const;
30  bool skipToNextSubmessage();
31  bool skipSubmessageContent();
32 
33  const Header& header() const { return header_; }
34  SubmessageHeader submessageHeader() const { return sub_; }
35  size_t remaining() const { return in_ ? in_->total_length() : fromSeq_.length(); }
36  const char* current() const { return ser_.pos_rd(); }
37 
38  DCPS::Serializer& serializer() { return ser_; }
39 
40  template <typename T>
41  bool operator>>(T& rhs) { return ser_ >> rhs; }
42 
43 private:
50 };
51 
52 } // namespace RTPS
53 } // namespace OpenDDS
54 
56 
57 #endif /* OPENDDS_DCPS_RTPS_MESSAGEPARSER_H */
SubmessageHeader submessageHeader() const
Definition: MessageParser.h:34
const Header & header() const
Definition: MessageParser.h:33
ACE_Message_Block fromSeq_
Definition: MessageParser.h:44
Class to serialize and deserialize data for DDS.
Definition: Serializer.h:369
#define OpenDDS_Rtps_Export
Definition: rtps_export.h:23
sequence< octet > OctetSeq
Definition: DdsDcpsCore.idl:64
DCPS::Message_Block_Ptr in_
Definition: MessageParser.h:45
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
const char * current() const
Definition: MessageParser.h:36
DCPS::Serializer & serializer()
Definition: MessageParser.h:38
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28