Gazebo Transport

API Reference

13.4.1
Message.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 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 #ifndef GZ_TRANSPORT_LOG_MESSAGE_HH_
18 #define GZ_TRANSPORT_LOG_MESSAGE_HH_
19 
20 #include <chrono>
21 #include <memory>
22 #include <string>
23 
24 #include <gz/transport/config.hh>
25 #include <gz/transport/log/Export.hh>
26 
27 namespace gz::transport::log
28 {
29  // Inline bracket to help doxygen filtering.
30  inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
31  //
33  class MessagePrivate;
34 
36  class GZ_TRANSPORT_LOG_VISIBLE Message
37  {
39  public: Message();
40 
54  public: Message(
55  const std::chrono::nanoseconds &_timeRecv,
56  const void *_data, std::size_t _dataLen,
57  const char *_type, std::size_t _typeLen,
58  const char *_topic, std::size_t _topicLen);
59 
62  public: Message(Message && _other) = delete;
63 
66  public: Message(const Message & _other) = delete;
67 
69  public: ~Message();
70 
73  public: std::string Data() const;
74 
77  public: std::string Type() const;
78 
81  public: std::string Topic() const;
82 
85  public: const std::chrono::nanoseconds &TimeReceived() const;
86 
87 #ifdef _WIN32
88 // Disable warning C4251 which is triggered by
89 // std::*
90 #pragma warning(push)
91 #pragma warning(disable: 4251)
92 #endif
94  private: std::unique_ptr<MessagePrivate> dataPtr;
95 #ifdef _WIN32
96 #pragma warning(pop)
97 #endif
98  };
99  }
100 }
101 #endif