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