YARP
Yet Another Robot Platform
Stamp.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2019 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_STAMP_H
11 #define YARP_OS_STAMP_H
12 
13 #include <yarp/os/NetFloat64.h>
14 #include <yarp/os/NetInt32.h>
15 #include <yarp/os/Portable.h>
16 
17 
18 namespace yarp {
19 namespace os {
20 
24 class YARP_OS_API Stamp : public Portable
25 {
26 private:
27  NetInt32 sequenceNumber;
28  NetFloat64 timeStamp;
29 
30 public:
34  explicit Stamp();
35 
43  Stamp(int count, double time);
44 
50  int getCount() const;
51 
57  double getTime() const;
58 
64  bool isValid() const;
65 
72  int getMaxCount() const;
73 
78  void update();
79 
84  void update(double time);
85 
86  // Documented in Portable
87  bool read(ConnectionReader& connection) override;
88 
89  // Documented in Portable
90  bool write(ConnectionWriter& connection) const override;
91 };
92 
93 
94 #ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
95 
100 {
101 public:
105  virtual ~Stamped();
106 
111  virtual Stamp getStamp() const = 0;
112 };
113 #endif // YARP_NO_DEPRECATED
114 
115 } // namespace os
116 } // namespace yarp
117 
118 #endif // YARP_OS_STAMP_H
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:553
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:516
void getTime(YARP_timeval &now)
This is a base class for objects that can be both read from and be written to the YARP network...
Definition: Portable.h:28
#define YARP_OS_API
Definition: api.h:19
The main, catch-all namespace for YARP.
Definition: numeric.h:47
An interface for writing to a network connection.
std::int32_t NetInt32
Definition of the NetInt32 type.
Definition: NetInt32.h:33
An interface for reading from a network connection.
A base class for objects with time stamps and/or sequence numbers.
Definition: Stamp.h:99
yarp::conf::float64_t NetFloat64
Definition of the NetFloat64 type.
Definition: NetFloat64.h:45
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:24
#define YARP_OS_DEPRECATED_API
Definition: api.h:22
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:309