YARP
Yet Another Robot Platform
NetInt32.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_NETINT32_H
11 #define YARP_OS_NETINT32_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 signed little-endian
20 // integer type.
21 //
23 
24 namespace yarp {
25 namespace os {
26 
31 #ifdef YARP_LITTLE_ENDIAN
32 
33 typedef std::int32_t NetInt32;
34 
35 #else // YARP_LITTLE_ENDIAN
36 
38 {
39 private:
40  std::uint32_t raw_value;
41  std::uint32_t swap(std::uint32_t x) const;
42  std::int32_t get() const;
43  void set(std::int32_t v);
44 
45 public:
46  NetInt32();
47  NetInt32(std::int32_t val);
48  operator std::int32_t() const;
49  std::int32_t operator+(std::int32_t v) const;
50  std::int32_t operator-(std::int32_t v) const;
51  std::int32_t operator*(std::int32_t v) const;
52  std::int32_t operator/(std::int32_t v) const;
53  void operator+=(std::int32_t v);
54  void operator-=(std::int32_t v);
55  void operator*=(std::int32_t v);
56  void operator/=(std::int32_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_NETINT32_H
Vector & operator+=(Vector &a, const double &s)
Addition operator between a scalar and a vector (defined in Math.h).
Definition: math.cpp:41
Vector operator+(const Vector &a, const double &s)
Mathematical operations.
Definition: math.cpp:30
Vector operator-(const Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h).
Definition: math.cpp:81
Vector operator*(double k, const Vector &b)
Scalar-vector product operator (defined in Math.h).
Definition: math.cpp:137
Vector & operator*=(Vector &a, double k)
Vector-scalar product operator (defined in Math.h).
Definition: math.cpp:148
Vector & operator/=(Vector &a, const Vector &b)
Vector-vector element-wise division operator (defined in Math.h).
Definition: math.cpp:256
Vector operator/(const Vector &a, const Vector &b)
Vector-vector element-wise division operator (defined in Math.h).
Definition: math.cpp:250
Vector & operator-=(Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h).
Definition: math.cpp:96
std::int32_t NetInt32
Definition of the NetInt32 type.
Definition: NetInt32.h:33
The main, catch-all namespace for YARP.
Definition: environment.h:25
#define YARP_os_API
Definition: api.h:19