Gazebo Transport

API Reference

8.5.0
gz/transport/log/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 ignition
28 {
29  namespace transport
30  {
31  namespace log
32  {
33  // Inline bracket to help doxygen filtering.
34  inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
35  //
37  class MessagePrivate;
38 
40  class IGNITION_TRANSPORT_LOG_VISIBLE Message
41  {
43  public: Message();
44 
58  public: Message(
59  const std::chrono::nanoseconds &_timeRecv,
60  const void *_data, std::size_t _dataLen,
61  const char *_type, std::size_t _typeLen,
62  const char *_topic, std::size_t _topicLen);
63 
66  public: Message(Message && _other) = delete;
67 
70  public: Message(const Message & _other) = delete;
71 
73  public: ~Message();
74 
77  public: std::string Data() const;
78 
81  public: std::string Type() const;
82 
85  public: std::string Topic() const;
86 
89  public: const std::chrono::nanoseconds &TimeReceived() const;
90 
91 #ifdef _WIN32
92 // Disable warning C4251 which is triggered by
93 // std::*
94 #pragma warning(push)
95 #pragma warning(disable: 4251)
96 #endif
97  private: std::unique_ptr<MessagePrivate> dataPtr;
99 #ifdef _WIN32
100 #pragma warning(pop)
101 #endif
102  };
103  }
104  }
105  }
106 }
107 #endif
Definition: gz/transport/AdvertiseOptions.hh:28
STL class.
T log(T... args)
Represents a message in a bag file.
Definition: gz/transport/log/Message.hh:40