doil.h
Go to the documentation of this file.
1 // -*- C++ -*-
18 #ifndef DOIL_DOIL_H
19 #define DOIL_DOIL_H
20 
21 #include <string>
22 #include <vector>
23 
24 namespace doil
25 {
51 #define UNUSED_ARG(a) do {} while (&a == 0)
52 
54  {
55  OK,
60  };
61 
62  static const char* return_codes[] =
63  {
64  "OK",
65  "NOT_FOUND",
66  "ALREADY_EXISTS",
67  "INVALID_ARGS",
68  "UNKNOWN"
69  };
70 
72  {
73  NamedReturnCode(const char* n, ReturnCode_t r)
74  : key_(n), ret_(r)
75  {}
76  std::string key_;
78  };
79 
81  {
82  public:
84  {
85  }
87  {
88  push_back("", ret);
89  }
91  {
92  retcodes_.push_back(nr);
93  }
94  void push_back(const char* key, ReturnCode_t ret)
95  {
96  retcodes_.push_back(NamedReturnCode(key, ret));
97  }
98 
99  bool isOK()
100  {
101  if (retcodes_.size() == 1) return (retcodes_[0].ret_ == OK);
102  for (int i(0), len(retcodes_.size()); i < len; ++i)
103  {
104  ReturnCode_t ret(retcodes_[i].ret_);
105  if (ret != OK) return false;
106  }
107  return true;
108  }
109  std::vector<NamedReturnCode> retcodes_;
110  };
111 };
112 
113 #endif // DOIL_DOIL_H
void push_back(NamedReturnCode nr)
Definition: doil.h:90
ReturnCode_t
Definition: doil.h:53
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
std::string key_
Definition: doil.h:76
ReturnCodes(ReturnCode_t ret)
Definition: doil.h:86
void push_back(const char *key, ReturnCode_t ret)
Definition: doil.h:94
static const char * return_codes[]
Definition: doil.h:62
std::vector< NamedReturnCode > retcodes_
Definition: doil.h:109
ReturnCode_t ret_
Definition: doil.h:77
bool isOK()
Definition: doil.h:99
NamedReturnCode(const char *n, ReturnCode_t r)
Definition: doil.h:73
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
Definition: doil.h:55


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Feb 28 2022 23:00:42