YARP
Yet Another Robot Platform
NetUint64.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_NETUINT64_H
8 #define YARP_OS_NETUINT64_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 64 bit unsigned little-endian
17 // integer type
18 //
20 
21 namespace yarp {
22 namespace os {
23 
28 #ifdef YARP_LITTLE_ENDIAN
29 
30 typedef std::uint64_t NetUint64;
31 
32 #else
33 
34 typedef std::uint64_t RawNetUint64;
35 union UnionNetUint64
36 {
37  std::uint64_t d;
38  unsigned char c[8];
39 };
41 {
42 private:
43  std::uint64_t raw_value;
44  std::uint64_t swap(std::uint64_t x) const;
45  RawNetUint64 get() const;
46  void set(RawNetUint64 v);
47 
48 public:
49  NetUint64();
50  NetUint64(RawNetUint64 val);
51  operator RawNetUint64() const;
52  RawNetUint64 operator+(RawNetUint64 v) const;
53  RawNetUint64 operator-(RawNetUint64 v) const;
54  RawNetUint64 operator*(RawNetUint64 v) const;
55  RawNetUint64 operator/(RawNetUint64 v) const;
56  void operator+=(RawNetUint64 v);
57  void operator-=(RawNetUint64 v);
58  void operator*=(RawNetUint64 v);
59  void operator/=(RawNetUint64 v);
60 };
61 
62 #endif // YARP_LITTLE_ENDIAN
63 
64 } // namespace os
65 } // namespace yarp
66 
67 #endif // YARP_OS_NETUINT64_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::uint64_t NetUint64
Definition of the NetInt64 type.
Definition: NetUint64.h:30
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_os_API
Definition: api.h:18