YARP
Yet Another Robot Platform
NetUint64.cpp
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 #include <yarp/os/NetUint64.h>
11 
12 #ifndef YARP_LITTLE_ENDIAN
13 
14 using namespace yarp;
15 using namespace yarp::os;
16 
17 
18 std::uint64_t NetUint64::swap(std::uint64_t x) const
19 {
20  UnionNetUint64 in, out;
21  in.d = x;
22  for (int i = 0; i < 8; i++) {
23  out.c[i] = in.c[7 - i];
24  }
25  return out.d;
26 }
27 RawNetUint64 NetUint64::get() const
28 {
29  return (RawNetUint64)swap((RawNetUint64)raw_value);
30 }
31 void NetUint64::set(RawNetUint64 v)
32 {
33  raw_value = (RawNetUint64)swap((RawNetUint64)v);
34 }
36 {
37 }
38 NetUint64::NetUint64(RawNetUint64 val)
39 {
40  set(val);
41 }
42 NetUint64::operator RawNetUint64() const
43 {
44  return get();
45 }
46 RawNetUint64 NetUint64::operator+(RawNetUint64 v) const
47 {
48  return get() + v;
49 }
50 RawNetUint64 NetUint64::operator-(RawNetUint64 v) const
51 {
52  return get() - v;
53 }
54 RawNetUint64 NetUint64::operator*(RawNetUint64 v) const
55 {
56  return get() * v;
57 }
58 RawNetUint64 NetUint64::operator/(RawNetUint64 v) const
59 {
60  return get() / v;
61 }
62 void NetUint64::operator+=(RawNetUint64 v)
63 {
64  set(get() + v);
65 }
66 void NetUint64::operator-=(RawNetUint64 v)
67 {
68  set(get() - v);
69 }
70 void NetUint64::operator*=(RawNetUint64 v)
71 {
72  set(get() * v);
73 }
74 void NetUint64::operator/=(RawNetUint64 v)
75 {
76  set(get() / v);
77 }
78 #endif // YARP_LITTLE_ENDIAN
yarp::os::NetUint64
std::uint64_t NetUint64
Definition of the NetInt64 type.
Definition: NetUint64.h:33
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
NetUint64.h
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
yarp::os
An interface to the operating system, including Port based communication.
Definition: AbstractCarrier.h:17
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