Gazebo Transport

API Reference

11.4.1
gz/transport/MessageInfo.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_TRANSPORT_MESSAGEINFO_HH_
19 #define GZ_TRANSPORT_MESSAGEINFO_HH_
20 
21 #include <memory>
22 #include <string>
23 
24 #include "gz/transport/config.hh"
25 #include "gz/transport/Export.hh"
26 
27 namespace ignition::transport
28 {
29  // Inline bracket to help doxygen filtering.
30  inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
31  //
32  class MessageInfoPrivate;
33 
35  class IGNITION_TRANSPORT_VISIBLE MessageInfo
36  {
38  public: MessageInfo();
39 
43  public: MessageInfo(const MessageInfo &_other);
44 
47  public: MessageInfo(MessageInfo &&_other); // NOLINT
48 
50  public: ~MessageInfo();
51 
54  public: const std::string &Topic() const;
55 
57  public: void SetTopic(const std::string &_topic);
58 
61  public: const std::string &Type() const;
62 
65  public: void SetType(const std::string &_type);
66 
69  public: const std::string &Partition() const;
70 
73  public: void SetPartition(const std::string &_partition);
74 
80  public: bool SetTopicAndPartition(const std::string &_fullyQualifiedName);
81 
84  public: bool IntraProcess() const;
85 
88  public: void SetIntraProcess(bool _value);
89 
90 #ifdef _WIN32
91 // Disable warning C4251 which is triggered by
92 // std::unique_ptr
93 #pragma warning(push)
94 #pragma warning(disable: 4251)
95 #endif
96  protected: std::unique_ptr<MessageInfoPrivate> dataPtr;
99 #ifdef _WIN32
100 #pragma warning(pop)
101 #endif
102  };
103  }
104 }
105 #endif
STL class.
void SetIntraProcess(bool _value)
Set whether this message is intra-process or not.
void SetPartition(const std::string &_partition)
Set the partition of the topic the message was on.
void SetTopic(const std::string &_topic)
Set the topic name associated to the message.
const std::string & Topic() const
Get the topic name associated to the message.
const std::string & Type() const
Get the name of the message type.
A class that provides information about the message received.
Definition: gz/transport/MessageInfo.hh:35
std::unique_ptr< MessageInfoPrivate > dataPtr
Definition: gz/transport/MessageInfo.hh:98
bool SetTopicAndPartition(const std::string &_fullyQualifiedName)
Set both the topic and the partition from a single string.
const std::string & Partition() const
Get the name of the partition.
void SetType(const std::string &_type)
Set the name of the message type.
Definition: gz/transport/AdvertiseOptions.hh:28
MessageInfo()
Default constructor.
bool IntraProcess() const
Whether the message is coming from a node within this process.