YARP
Yet Another Robot Platform
NetUint32.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_NETUINT32_H
11 #define YARP_OS_NETUINT32_H
12 
13 #include <yarp/conf/numeric.h>
14 
15 #include <yarp/os/api.h>
16 
18 //
19 // The goal of this file is just to define a 32 bit unsigned little-endian
20 // integer type.
21 //
23 
24 namespace yarp {
25 namespace os {
26 
31 #ifdef YARP_LITTLE_ENDIAN
32 
33 typedef std::uint32_t NetUint32;
34 
35 #else // YARP_LITTLE_ENDIAN
36 
37 class YARP_OS_API NetUint32
38 {
39 private:
40  std::uint32_t raw_value;
41  std::uint32_t swap(std::uint32_t x) const;
42  std::uint32_t get() const;
43  void set(std::uint32_t v);
44 
45 public:
46  NetUint32();
47  NetUint32(std::uint32_t val);
48  operator std::uint32_t() const;
49  std::uint32_t operator+(std::uint32_t v) const;
50  std::uint32_t operator-(std::uint32_t v) const;
51  std::uint32_t operator*(std::uint32_t v) const;
52  std::uint32_t operator/(std::uint32_t v) const;
53  void operator+=(std::uint32_t v);
54  void operator-=(std::uint32_t v);
55  void operator*=(std::uint32_t v);
56  void operator/=(std::uint32_t v);
57  void operator++(int);
58  void operator--(int);
59 };
60 
61 #endif // YARP_LITTLE_ENDIAN
62 
63 } // namespace os
64 } // namespace yarp
65 
66 #endif // YARP_OS_NETUINT32_H
yarp::sig::Vector & operator+=(yarp::sig::Vector &a, const double &s)
Addition operator between a scalar and a vector (defined in Math.h).
Definition: math.cpp:38
#define YARP_OS_API
Definition: api.h:19
std::uint32_t NetUint32
Definition of the NetUint32 type.
Definition: NetUint32.h:33
The main, catch-all namespace for YARP.
Definition: numeric.h:47
yarp::sig::Vector operator+(const yarp::sig::Vector &a, const double &s)
Mathematical operations.
Definition: math.cpp:27
yarp::sig::Vector & operator/=(yarp::sig::Vector &a, const yarp::sig::Vector &b)
Vector-vector element-wise division operator (defined in Math.h).
Definition: math.cpp:253
yarp::sig::Vector operator-(const yarp::sig::Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h).
Definition: math.cpp:78
yarp::sig::Vector & operator-=(yarp::sig::Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h).
Definition: math.cpp:93
yarp::sig::Vector & operator*=(yarp::sig::Vector &b, double k)
Vector-scalar product operator (defined in Math.h).
Definition: math.cpp:145
yarp::sig::Vector operator*(double k, const yarp::sig::Vector &b)
Scalar-vector product operator (defined in Math.h).
Definition: math.cpp:134
yarp::sig::Vector operator/(const yarp::sig::Vector &a, const yarp::sig::Vector &b)
Vector-vector element-wise division operator (defined in Math.h).
Definition: math.cpp:247