Gazebo Transport

API Reference

8.5.0
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
28 {
29  namespace transport
30  {
31  // Inline bracket to help doxygen filtering.
32  inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
33  //
34  class MessageInfoPrivate;
35 
37  class IGNITION_TRANSPORT_VISIBLE MessageInfo
38  {
40  public: MessageInfo();
41 
45  public: MessageInfo(const MessageInfo &_other);
46 
49  public: MessageInfo(MessageInfo &&_other); // NOLINT
50 
52  public: ~MessageInfo();
53 
56  public: const std::string &Topic() const;
57 
59  public: void SetTopic(const std::string &_topic);
60 
63  public: const std::string &Type() const;
64 
67  public: void SetType(const std::string &_type);
68 
71  public: const std::string &Partition() const;
72 
75  public: void SetPartition(const std::string &_partition);
76 
82  public: bool SetTopicAndPartition(const std::string &_fullyQualifiedName);
83 
86  public: bool IntraProcess() const;
87 
90  public: void SetIntraProcess(bool _value);
91 
92 #ifdef _WIN32
93 // Disable warning C4251 which is triggered by
94 // std::unique_ptr
95 #pragma warning(push)
96 #pragma warning(disable: 4251)
97 #endif
98  protected: std::unique_ptr<MessageInfoPrivate> dataPtr;
101 #ifdef _WIN32
102 #pragma warning(pop)
103 #endif
104  };
105  }
106  }
107 }
108 #endif
Definition: gz/transport/AdvertiseOptions.hh:28
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:37
std::unique_ptr< MessageInfoPrivate > dataPtr
Definition: gz/transport/MessageInfo.hh:100
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.
MessageInfo()
Default constructor.
bool IntraProcess() const
Whether the message is coming from a node within this process.