sot-core  4.10.1
Hierarchical task solver plug-in for dynamic-graph.
flags.hh
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 #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 
24 /* --------------------------------------------------------------------- */
25 /* --- CLASS ----------------------------------------------------------- */
26 /* --------------------------------------------------------------------- */
27 
28 namespace dynamicgraph {
29 namespace sot {
30 
32 protected:
33  std::vector<char> flags;
34  bool reverse;
35 
36  char operator[](const unsigned int &i) const;
37 
38 public:
39  Flags(const bool &b = false);
40  Flags(const char &c);
41  Flags(const int &c4);
42 
43  void add(const char &c);
44  void add(const int &c4);
45 
46  Flags operator!(void) const;
47  SOT_CORE_EXPORT friend Flags operator&(const Flags &f1, const Flags &f2);
48  SOT_CORE_EXPORT friend Flags operator|(const Flags &f1, const Flags &f2);
49  Flags &operator&=(const Flags &f2);
50  Flags &operator|=(const Flags &f2);
51 
52  SOT_CORE_EXPORT friend Flags operator&(const Flags &f1, const bool &b);
53  SOT_CORE_EXPORT friend Flags operator|(const Flags &f1, const bool &b);
54  Flags &operator&=(const bool &b);
55  Flags &operator|=(const bool &b);
56 
57  SOT_CORE_EXPORT friend std::ostream &operator<<(std::ostream &os,
58  const Flags &fl);
59  SOT_CORE_EXPORT friend char operator>>(const Flags &flags, const int &i);
60  SOT_CORE_EXPORT friend std::istream &operator>>(std::istream &is, Flags &fl);
61  bool operator()(const int &i) const;
62 
63  operator bool(void) const;
64 
65  void unset(const unsigned int &i);
66  void set(const unsigned int &i);
67 
68 public: /* Selec "matlab-style" : 1:15, 1:, :45 ... */
69  static void readIndexMatlab(std::istream &iss, unsigned int &indexStart,
70  unsigned int &indexEnd, bool &unspecifiedEnd);
71  static Flags readIndexMatlab(std::istream &iss);
72 };
73 
74 SOT_CORE_EXPORT extern const Flags FLAG_LINE_1;
75 SOT_CORE_EXPORT extern const Flags FLAG_LINE_2;
76 SOT_CORE_EXPORT extern const Flags FLAG_LINE_3;
77 SOT_CORE_EXPORT extern const Flags FLAG_LINE_4;
78 SOT_CORE_EXPORT extern const Flags FLAG_LINE_5;
79 SOT_CORE_EXPORT extern const Flags FLAG_LINE_6;
80 SOT_CORE_EXPORT extern const Flags FLAG_LINE_7;
81 SOT_CORE_EXPORT extern const Flags FLAG_LINE_8;
82 
83 } // namespace sot
84 } // namespace dynamicgraph
85 
86 #endif /* #ifndef __SOT_FLAGS_H */
SOT_CORE_EXPORT const Flags FLAG_LINE_2
SOT_CORE_EXPORT std::ostream & operator<<(std::ostream &os, const VectorMultiBound &v)
#define SOT_CORE_EXPORT
Definition: api.hh:20
SOT_CORE_EXPORT const Flags FLAG_LINE_5
SOT_CORE_EXPORT const Flags FLAG_LINE_4
SOT_CORE_EXPORT std::istream & operator>>(std::istream &os, VectorMultiBound &v)
std::vector< char > flags
Definition: flags.hh:33
SOT_CORE_EXPORT const Flags FLAG_LINE_8
SOT_CORE_EXPORT const Flags FLAG_LINE_1
SOT_CORE_EXPORT const Flags FLAG_LINE_3
Definition: flags.hh:31
bool reverse
Definition: flags.hh:34
SOT_CORE_EXPORT const Flags FLAG_LINE_7
SOT_CORE_EXPORT const Flags FLAG_LINE_6
Definition: abstract-sot-external-interface.hh:17