YARP
Yet Another Robot Platform
NetInt32.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_NETINT32_H
8 #define YARP_OS_NETINT32_H
9 
10 #include <yarp/conf/numeric.h>
11 
12 #include <yarp/os/api.h>
13 
15 //
16 // The goal of this file is just to define a 32 bit signed little-endian
17 // integer type.
18 //
20 
21 namespace yarp::os {
22 
27 #ifdef YARP_LITTLE_ENDIAN
28 
29 typedef std::int32_t NetInt32;
30 
31 #else // YARP_LITTLE_ENDIAN
32 
34 {
35 private:
36  std::uint32_t raw_value;
37  std::uint32_t swap(std::uint32_t x) const;
38  std::int32_t get() const;
39  void set(std::int32_t v);
40 
41 public:
42  NetInt32();
43  NetInt32(std::int32_t val);
44  operator std::int32_t() const;
45  std::int32_t operator+(std::int32_t v) const;
46  std::int32_t operator-(std::int32_t v) const;
47  std::int32_t operator*(std::int32_t v) const;
48  std::int32_t operator/(std::int32_t v) const;
49  void operator+=(std::int32_t v);
50  void operator-=(std::int32_t v);
51  void operator*=(std::int32_t v);
52  void operator/=(std::int32_t v);
53  void operator++(int);
54  void operator--(int);
55 };
56 
57 #endif // YARP_LITTLE_ENDIAN
58 
59 } // namespace yarp::os
60 
61 #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:38
Vector operator+(const Vector &a, const double &s)
Mathematical operations.
Definition: math.cpp:27
Vector operator-(const Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h).
Definition: math.cpp:82
Vector operator*(double k, const Vector &b)
Scalar-vector product operator (defined in Math.h).
Definition: math.cpp:143
Vector & operator*=(Vector &a, double k)
Vector-scalar product operator (defined in Math.h).
Definition: math.cpp:154
Vector & operator/=(Vector &a, const Vector &b)
Vector-vector element-wise division operator (defined in Math.h).
Definition: math.cpp:266
Vector operator/(const Vector &a, const Vector &b)
Vector-vector element-wise division operator (defined in Math.h).
Definition: math.cpp:260
Vector & operator-=(Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h).
Definition: math.cpp:98
An interface to the operating system, including Port based communication.
std::int32_t NetInt32
Definition of the NetInt32 type.
Definition: NetInt32.h:29
#define YARP_os_API
Definition: api.h:18