tests
task
test_flags.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2010,
3
* François Bleibel,
4
* Olivier Stasse,
5
*
6
* CNRS/AIST
7
*
8
*/
9
10
/* -------------------------------------------------------------------------- */
11
/* --- INCLUDES ------------------------------------------------------------- */
12
/* -------------------------------------------------------------------------- */
13
#include <iostream>
14
#include <
sot/core/flags.hh
>
15
#include <sstream>
16
17
using namespace
std;
18
using namespace
dynamicgraph::sot
;
19
20
int
main
(
void
) {
21
cout <<
"Entering test"
<< endl;
22
Flags
f1(128 * 112 + 84);
23
Flags
f2(198);
24
cout <<
"f1 "
25
<<
"\t"
<< f1 << endl;
26
cout <<
"f2 "
27
<<
"\t"
<< f2 << endl;
28
29
cout << endl;
30
cout <<
"1|2 "
31
<<
"\t"
<< (f1 | f2) << endl;
32
cout <<
"1&2 "
33
<<
"\t"
<< (f1 & f2) << endl;
34
cout <<
"TRUE "
35
<<
"\t"
<< (
Flags
(
true
)) << endl;
36
cout <<
"1&TRUE"
37
<<
"\t"
<< (f1 &
Flags
(
true
)) << endl;
38
cout <<
"1&!2 "
39
<<
"\t"
<< ((!f2) & f1) << endl;
40
cout <<
"1XOR2 "
41
<<
"\t"
<< (((!f2) & f1) | ((!f1) & f2)) << endl;
42
43
cout << endl;
44
cout <<
"f1 "
45
<<
"\t"
<< f1 << endl;
46
cout <<
"!2 "
47
<<
"\t"
<< !f2 << endl;
48
cout <<
"1|!2 "
49
<<
"\t"
<< (f1 | (!f2)) << endl;
50
51
cout << endl;
52
if
(f1 & f2)
53
cout <<
"TRUE"
;
54
else
55
cout <<
"FALSE"
;
56
cout << endl;
57
if
(f1 &
Flags
())
58
cout <<
"TRUE"
;
59
else
60
cout <<
"FALSE"
;
61
cout << endl;
62
63
cout << endl;
64
cout <<
"f1>>3 "
65
<<
"\t"
<<
Flags
(f1 >> 3) << endl;
66
cout <<
"f1>>5 "
67
<<
"\t"
<<
Flags
(f1 >> 5) << endl;
68
69
cout <<
"f1 byte per byte:"
;
70
for
(
int
i
= 0;
i
< 16; ++
i
) {
71
if
(!(
i
% 8)) cout <<
" "
;
72
cout << f1(
i
);
73
}
74
cout << endl;
75
76
cout << endl;
77
78
istringstream iss(
"00101"
);
79
Flags
flread;
80
iss >> flread;
81
cout << flread << endl << endl;
82
83
return
0;
84
}
main
int main(void)
Definition:
test_flags.cpp:20
i
int i
flags.hh
dynamicgraph::sot
dynamicgraph::sot::Flags
Definition:
flags.hh:33
sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:32