YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
NetFloat64.cpp
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
8
9#ifndef YARP_LITTLE_ENDIAN
10
11using namespace yarp;
12using namespace yarp::os;
13
14
15double NetFloat64::swap(double x) const
16{
17 UnionNetFloat64 in, out;
18 in.d = x;
19 for (int i = 0; i < 8; i++) {
20 out.c[i] = in.c[7 - i];
21 }
22 return out.d;
23}
24
25RawNetFloat64 NetFloat64::get() const
26{
27 return (double)swap((double)raw_value);
28}
29
30void NetFloat64::set(RawNetFloat64 v)
31{
32 raw_value = (double)swap((double)v);
33}
34
35NetFloat64::NetFloat64()
36{
37}
38
39NetFloat64::NetFloat64(RawNetFloat64 val)
40{
41 set(val);
42}
43
44NetFloat64::operator RawNetFloat64() const
45{
46 return get();
47}
48
49RawNetFloat64 NetFloat64::operator+(RawNetFloat64 v) const
50{
51 return get() + v;
52}
53
54RawNetFloat64 NetFloat64::operator-(RawNetFloat64 v) const
55{
56 return get() - v;
57}
58
59RawNetFloat64 NetFloat64::operator*(RawNetFloat64 v) const
60{
61 return get() * v;
62}
63
64RawNetFloat64 NetFloat64::operator/(RawNetFloat64 v) const
65{
66 return get() / v;
67}
68
69void NetFloat64::operator+=(RawNetFloat64 v)
70{
71 set(get() + v);
72}
73
74void NetFloat64::operator-=(RawNetFloat64 v)
75{
76 set(get() - v);
77}
78
79void NetFloat64::operator*=(RawNetFloat64 v)
80{
81 set(get() * v);
82}
83
84void NetFloat64::operator/=(RawNetFloat64 v)
85{
86 set(get() / v);
87}
88
89
90#endif // YARP_LITTLE_ENDIAN
A mini-server for performing network communication in the background.
An interface to the operating system, including Port based communication.
The main, catch-all namespace for YARP.
Definition dirs.h:16