YARP
Yet Another Robot Platform
NetType.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_NETTYPE_H
8 #define YARP_OS_NETTYPE_H
9 
10 #include <yarp/conf/numeric.h>
11 
12 #include <yarp/os/Bytes.h>
13 #include <yarp/os/InputStream.h>
14 #include <yarp/os/NetFloat64.h>
15 #include <yarp/os/NetInt32.h>
16 
17 #include <string>
18 
19 namespace yarp {
20 namespace os {
21 
26 {
27 public:
28  static int netInt(const yarp::os::Bytes& code);
29  static bool netInt(int data, yarp::os::Bytes& code);
30 
31  static unsigned long int getCrc(char* buf, size_t len);
32 
33 #ifndef YARP_NO_DEPRECATED // Since YARP 3.5
34  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::to_hex_string instead")
35  static std::string toHexString(int x);
36 
37  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::to_hex_string instead")
38  static std::string toHexString(long x);
39 
40  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::to_hex_string instead")
41  static std::string toHexString(unsigned int x);
42 
43  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::to_string instead")
44  static std::string toString(int x);
45 
46  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::to_string instead")
47  static std::string toString(long x);
48 
49  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::to_string instead")
50  static std::string toString(unsigned int x);
51 
52  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::to_string instead")
53  static std::string toString(yarp::conf::float32_t x);
54 
55  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::to_string instead")
56  static std::string toString(yarp::conf::float64_t x);
57 
58  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::from_string instead")
59  static yarp::conf::float32_t toFloat32(const std::string& s);
60 
61  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::from_string instead")
62  static yarp::conf::float64_t toFloat64(const std::string& s);
63 
64  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::from_string instead")
65  static yarp::conf::float32_t toFloat32(std::string&& s);
66 
67  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::from_string instead")
68  static yarp::conf::float64_t toFloat64(std::string&& s);
69 
70  YARP_DEPRECATED_MSG("Use yarp::conf::numeric::from_string instead")
71  static int toInt(const std::string& x);
72 #endif // YARP_NO_DEPRECATED
73 };
74 
75 } // namespace os
76 } // namespace yarp
77 
78 #endif // YARP_OS_NETTYPE_H
A simple abstraction for a block of bytes.
Definition: Bytes.h:25
Various utilities related to types and formats.
Definition: NetType.h:26
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2885
std::string toString(const T &value)
convert an arbitrary type to string.
double float64_t
Definition: numeric.h:77
float float32_t
Definition: numeric.h:76
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_API
Definition: api.h:18