YARP
Yet Another Robot Platform
Header.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef YARP_OS_HEADER_H
8 #define YARP_OS_HEADER_H
9 
10 #include <yarp/os/Portable.h>
11 #include <yarp/conf/numeric.h>
12 
13 #include <string>
14 
15 namespace yarp {
16 namespace os {
17 
24  public Portable
25 {
26 public:
27  using count_t = std::uint32_t;
28 
33  static constexpr count_t npos = static_cast<count_t>(-1);
34 
38  explicit Header();
39 
47  Header(count_t count, yarp::conf::float64_t time, std::string frameId = {});
48 
54  Header(const Header& rhs);
55 
61  Header(Header&& rhs) noexcept;
62 
66  ~Header() override;
67 
74  Header& operator=(const Header& rhs);
75 
82  Header& operator=(Header&& rhs) noexcept;
83 
89  count_t count() const;
90 
96  yarp::conf::float64_t timeStamp() const;
97 
103  std::string frameId() const;
104 
110  bool isValid() const;
111 
116  void update();
117 
122  void update(yarp::conf::float64_t time);
123 
129  void setFrameId(std::string frameId);
130 
131 
132  // Documented in Portable
133  bool read(ConnectionReader& connection) override;
134 
135  // Documented in Portable
136  bool write(ConnectionWriter& connection) const override;
137 
138 private:
139 #ifndef DOXYGEN_SHOULD_SKIP_THIS
140  class Private;
141  Private* mPriv;
142 #endif // DOXYGEN_SHOULD_SKIP_THIS
143 };
144 
145 
146 } // namespace os
147 } // namespace yarp
148 
149 #endif // YARP_OS_HEADER_H
An interface for reading from a network connection.
An interface for writing to a network connection.
An abstraction for a sequence number, time stamp and/or frame id.
Definition: Header.h:25
std::uint32_t count_t
Definition: Header.h:27
This is a base class for objects that can be both read from and be written to the YARP network.
Definition: Portable.h:26
yarp::rosmsg::std_msgs::Header Header
Definition: Header.h:21
double float64_t
Definition: numeric.h:77
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:314
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:923
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1099
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_API
Definition: api.h:18