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 {
22 namespace os {
23 
28 #ifdef YARP_LITTLE_ENDIAN
29 
30 typedef std::int32_t NetInt32;
31 
32 #else // YARP_LITTLE_ENDIAN
33 
35 {
36 private:
37  std::uint32_t raw_value;
38  std::uint32_t swap(std::uint32_t x) const;
39  std::int32_t get() const;
40  void set(std::int32_t v);
41 
42 public:
43  NetInt32();
44  NetInt32(std::int32_t val);
45  operator std::int32_t() 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  std::int32_t operator/(std::int32_t v) const;
50  void operator+=(std::int32_t v);
51  void operator-=(std::int32_t v);
52  void operator*=(std::int32_t v);
53  void operator/=(std::int32_t v);
54  void operator++(int);
55  void operator--(int);
56 };
57 
58 #endif // YARP_LITTLE_ENDIAN
59 
60 } // namespace os
61 } // namespace yarp
62 
63 #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
std::int32_t NetInt32
Definition of the NetInt32 type.
Definition: NetInt32.h:30
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_API
Definition: api.h:18