YARP
Yet Another Robot Platform
NetType.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 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 std::string toHexString(int x);
35  static std::string toHexString(long x);
36  static std::string toHexString(unsigned int x);
37 
38  static std::string toString(int x);
39  static std::string toString(long x);
40  static std::string toString(unsigned int x);
41 
42  static std::string toString(yarp::conf::float32_t x);
43  static std::string toString(yarp::conf::float64_t x);
44 
45  static yarp::conf::float32_t toFloat32(const std::string& s);
46  static yarp::conf::float64_t toFloat64(const std::string& s);
47  static yarp::conf::float32_t toFloat32(std::string&& s);
48  static yarp::conf::float64_t toFloat64(std::string&& s);
49 
50  static int toInt(const std::string& x);
51  static unsigned long int getCrc(char* buf, size_t len);
52 };
53 
54 } // namespace os
55 } // namespace yarp
56 
57 #endif // YARP_OS_NETTYPE_H
NetInt32.h
numeric.h
yarp::os::NetType
Various utilities related to types and formats.
Definition: NetType.h:29
YARP_os_API
#define YARP_os_API
Definition: api.h:19
NetFloat64.h
yarp::os::Bytes
A simple abstraction for a block of bytes.
Definition: Bytes.h:28
yarp::conf::float32_t
float float32_t
Definition: numeric.h:50
toString
std::string toString(const T &value)
convert an arbitrary type to string.
Definition: fakeMotionControl.cpp:121
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
Bytes.h
yarp::conf::float64_t
double float64_t
Definition: numeric.h:51
InputStream.h