YARP
Yet Another Robot Platform
NetUint64.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 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_NETUINT64_H
11 #define YARP_OS_NETUINT64_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 64 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::uint64_t NetUint64;
34 
35 #else
36 
37 typedef std::uint64_t RawNetUint64;
38 union UnionNetUint64
39 {
40  std::uint64_t d;
41  unsigned char c[8];
42 };
44 {
45 private:
46  std::uint64_t raw_value;
47  std::uint64_t swap(std::uint64_t x) const;
48  RawNetUint64 get() const;
49  void set(RawNetUint64 v);
50 
51 public:
52  NetUint64();
53  NetUint64(RawNetUint64 val);
54  operator RawNetUint64() const;
55  RawNetUint64 operator+(RawNetUint64 v) const;
56  RawNetUint64 operator-(RawNetUint64 v) const;
57  RawNetUint64 operator*(RawNetUint64 v) const;
58  RawNetUint64 operator/(RawNetUint64 v) const;
59  void operator+=(RawNetUint64 v);
60  void operator-=(RawNetUint64 v);
61  void operator*=(RawNetUint64 v);
62  void operator/=(RawNetUint64 v);
63 };
64 
65 #endif // YARP_LITTLE_ENDIAN
66 
67 } // namespace os
68 } // namespace yarp
69 
70 #endif // YARP_OS_NETUINT64_H
yarp::os::NetUint64
std::uint64_t NetUint64
Definition of the NetInt64 type.
Definition: NetUint64.h:33
numeric.h
api.h
YARP_os_API
#define YARP_os_API
Definition: api.h:19
operator*=
Vector & operator*=(Vector &a, double k)
Vector-scalar product operator (defined in Math.h).
Definition: math.cpp:148
operator+=
Vector & operator+=(Vector &a, const double &s)
Addition operator between a scalar and a vector (defined in Math.h).
Definition: math.cpp:41
operator/
Vector operator/(const Vector &a, const Vector &b)
Vector-vector element-wise division operator (defined in Math.h).
Definition: math.cpp:250
operator+
Vector operator+(const Vector &a, const double &s)
Mathematical operations.
Definition: math.cpp:30
operator/=
Vector & operator/=(Vector &a, const Vector &b)
Vector-vector element-wise division operator (defined in Math.h).
Definition: math.cpp:256
operator*
Vector operator*(double k, const Vector &b)
Scalar-vector product operator (defined in Math.h).
Definition: math.cpp:137
operator-=
Vector & operator-=(Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h).
Definition: math.cpp:96
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
operator-
Vector operator-(const Vector &a, const double &s)
Subtraction operator between a vector and a scalar (defined in Math.h).
Definition: math.cpp:81