YARP
Yet Another Robot Platform
NetInt64.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_NETINT64_H
11 #define YARP_OS_NETINT64_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 signed little-endian
20 // integer type
21 //
23 
24 namespace yarp {
25 namespace os {
26 
31 #ifdef YARP_LITTLE_ENDIAN
32 
33 typedef std::int64_t NetInt64;
34 
35 #else // YARP_LITTLE_ENDIAN
36 
37 typedef std::int64_t RawNetInt64;
38 union UnionNetInt64
39 {
40  std::int64_t d;
41  unsigned char c[8];
42 };
44 {
45 private:
46  std::int64_t raw_value;
47  std::int64_t swap(std::int64_t x) const;
48  RawNetInt64 get() const;
49  void set(RawNetInt64 v);
50 
51 public:
52  NetInt64();
53  NetInt64(RawNetInt64 val);
54  operator RawNetInt64() const;
55  RawNetInt64 operator+(RawNetInt64 v) const;
56  RawNetInt64 operator-(RawNetInt64 v) const;
57  RawNetInt64 operator*(RawNetInt64 v) const;
58  RawNetInt64 operator/(RawNetInt64 v) const;
59  void operator+=(RawNetInt64 v);
60  void operator-=(RawNetInt64 v);
61  void operator*=(RawNetInt64 v);
62  void operator/=(RawNetInt64 v);
63 };
64 
65 #endif // YARP_LITTLE_ENDIAN
66 
67 } // namespace os
68 } // namespace yarp
69 
70 #endif // YARP_OS_NETINT64_H
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
yarp::os::NetInt64
std::int64_t NetInt64
Definition of the NetInt64 type.
Definition: NetInt64.h:33
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