1 |
|
|
/* |
2 |
|
|
* Copyright 2010, |
3 |
|
|
* François Bleibel, |
4 |
|
|
* Olivier Stasse, |
5 |
|
|
* |
6 |
|
|
* CNRS/AIST |
7 |
|
|
* |
8 |
|
|
*/ |
9 |
|
|
|
10 |
|
|
#ifndef __SOT_FLAGS_H |
11 |
|
|
#define __SOT_FLAGS_H |
12 |
|
|
|
13 |
|
|
/* --------------------------------------------------------------------- */ |
14 |
|
|
/* --- INCLUDE --------------------------------------------------------- */ |
15 |
|
|
/* --------------------------------------------------------------------- */ |
16 |
|
|
|
17 |
|
|
/* STD */ |
18 |
|
|
#include <ostream> |
19 |
|
|
#include <vector> |
20 |
|
|
|
21 |
|
|
/* SOT */ |
22 |
|
|
#include "sot/core/api.hh" |
23 |
|
|
#include <dynamic-graph/signal-caster.h> |
24 |
|
|
|
25 |
|
|
/* --------------------------------------------------------------------- */ |
26 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
27 |
|
|
/* --------------------------------------------------------------------- */ |
28 |
|
|
|
29 |
|
|
namespace dynamicgraph { |
30 |
|
|
namespace sot { |
31 |
|
|
|
32 |
|
103 |
class SOT_CORE_EXPORT Flags { |
33 |
|
|
protected: |
34 |
|
|
std::vector<bool> flags; |
35 |
|
|
bool outOfRangeFlag; |
36 |
|
|
|
37 |
|
|
public: |
38 |
|
|
Flags(const bool &b = false); |
39 |
|
|
Flags(const char *flags); |
40 |
|
|
Flags(const std::vector<bool> &flags); |
41 |
|
|
|
42 |
|
|
void add(const bool &b); |
43 |
|
|
|
44 |
|
|
Flags operator!(void) const; |
45 |
|
|
SOT_CORE_EXPORT friend Flags operator&(const Flags &f1, const Flags &f2); |
46 |
|
|
SOT_CORE_EXPORT friend Flags operator|(const Flags &f1, const Flags &f2); |
47 |
|
|
Flags &operator&=(const Flags &f2); |
48 |
|
|
Flags &operator|=(const Flags &f2); |
49 |
|
|
|
50 |
|
|
SOT_CORE_EXPORT friend std::ostream &operator<<(std::ostream &os, |
51 |
|
|
const Flags &fl); |
52 |
|
|
SOT_CORE_EXPORT friend std::istream &operator>>(std::istream &is, Flags &fl); |
53 |
|
|
bool operator()(const int &i) const; |
54 |
|
|
|
55 |
|
|
operator bool(void) const; |
56 |
|
|
|
57 |
|
|
void unset(const unsigned int &i); |
58 |
|
|
void set(const unsigned int &i); |
59 |
|
|
}; |
60 |
|
|
|
61 |
|
|
} // namespace sot |
62 |
|
|
|
63 |
|
|
template <> |
64 |
|
|
struct signal_io<sot::Flags> : signal_io_unimplemented<sot::Flags> {}; |
65 |
|
|
} // namespace dynamicgraph |
66 |
|
|
|
67 |
|
|
#endif /* #ifndef __SOT_FLAGS_H */ |