00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00028 #ifndef _CONTROL_DATA_H
00029 #define _CONTROL_DATA_H
00030
00031 #include <coconut_config.h>
00032 #include <coconut_types.h>
00033 #include <info_contents.h>
00034
00035 namespace coco {
00036
00038
00044 class control_data : protected datamap
00045 {
00046 private:
00048 typedef datamap _Base;
00051 std::string _service;
00052
00053 public:
00055 control_data() : _Base(), _service() {}
00058 control_data(const std::string& __n, const basic_alltype& __v)
00059 : _Base(__n, __v), _service() {}
00062 control_data(const char* __n, const basic_alltype& __v)
00063 : _Base(__n, __v), _service() {}
00065 control_data(const control_data& __c) : _Base(__c), _service(__c._service) {}
00068 control_data(const std::string& serv, const info_contents& inf)
00069 : _Base(inf), _service(serv) {}
00071 virtual ~control_data() {}
00072
00074 control_data& operator=(const control_data& __c)
00075 {
00076 ((_Base*)this)->operator=(__c);
00077 _service = __c._service;
00078 return *this;
00079 }
00080
00083 control_data& operator=(const info_contents& __i)
00084 {
00085 ((_Base*)this)->operator=(*(_Base*)&__i);
00086 return *this;
00087 }
00088
00090 void service(const std::string& __s);
00092 void service(const char* __s);
00095 const std::string& service() const throw(api_exception);
00096
00098 bool check_service(const std::string& __n) const;
00100 bool check_service(const char* __n) const;
00101
00104 void set(const info_contents& __i) { operator=(__i); }
00105
00107
00112 void set(const std::string& __s, const basic_alltype& __h)
00113 { sinsert(__s, __h, false); }
00114 void set(const char* __cp, const basic_alltype& __h)
00115 { sinsert(__cp, __h, false); }
00117
00118
00123 void set(const std::string& __s, int i, const basic_alltype& __h)
00124 { sinsert(__s, i, __h, false); }
00125 void set(const char* __cp, int i, const basic_alltype& __h)
00126 { sinsert(__cp, i, __h, false); }
00128
00130
00132 const basic_alltype& get(const std::string& __s) const
00133 { return sfind(__s); }
00134 const basic_alltype& get(const char* __cp) const
00135 { return sfind(__cp); }
00137
00138
00140 const basic_alltype& get(const std::string& __s, int i) const
00141 { return sfind(__s, i); }
00142 const basic_alltype& get(const char* __cp, int i) const
00143 { return sfind(__cp, i); }
00145
00147
00150 void unset(const std::string& __s) { remove(__s); }
00151 void unset(const char* __cp) { remove(__cp); }
00153
00154
00156 void unset(const std::string& __s, int i) { remove(__s, i); }
00157 void unset(const char* __cp, int i) { remove(__cp, i); }
00159
00161
00164 void list(std::vector<std::string>& __v) const;
00165
00167
00170 bool is_set(const std::string& __s) const { return defd(__s); }
00171 bool is_set(const char* __cp) const { return defd(__cp); }
00173
00174
00176 bool is_set(const std::string& __s, int i) const { return defd(__s, i); }
00177 bool is_set(const char* __cp, int i) const { return defd(__cp, i); }
00179
00181
00183 bool which_set(const std::string& __s, std::vector<int>& __idx) const
00184 { return which(__s, __idx); }
00185 bool which_set(const char* __cp, std::vector<int>& __idx) const
00186 { return which(__cp, __idx); }
00188
00190
00197 template <class _TS>
00198 void assign(const std::string& __s, const std::vector<_TS>*& __b) const
00199 throw(api_exception);
00200
00201 template <class _TS>
00202 void assign(const std::string& __s, const linalg::matrix<_TS>*& __b) const
00203 throw(api_exception);
00204
00205 template <class _TS>
00206 void assign(const std::string& __s, _TS& __b) const throw(api_exception);
00207
00208 template <class _TS>
00209 void assign(const char* __s, const std::vector<_TS>*& __b) const
00210 throw(api_exception);
00211
00212 template <class _TS>
00213 void assign(const char* __s, const linalg::matrix<_TS>*& __b) const throw(api_exception);
00214
00215 template <class _TS>
00216 void assign(const char* __s, _TS& __b) const throw(api_exception);
00218
00220
00227 void assign(const std::string& __s, std::string& __b, const char* __def)
00228 const;
00229 void assign(const char* __s, std::string& __b, const char* __def) const;
00230
00231 template <class _TS>
00232 void assign(const std::string& __s, const std::vector<_TS>*& __b,
00233 const std::vector<_TS>* __def) const;
00234
00235 template <class _TS>
00236 void assign(const std::string& __s, const linalg::matrix<_TS>*& __b,
00237 const linalg::matrix<_TS>* __def) const;
00238
00239 template <class _TS>
00240 void assign(const std::string& __s, _TS& __b, _TS __def) const;
00241
00242 template <class _TS>
00243 void assign(const char* __s, const std::vector<_TS>*& __b,
00244 const std::vector<_TS>* __def) const;
00245
00246 template <class _TS>
00247 void assign(const char* __s, const linalg::matrix<_TS>*& __b,
00248 const linalg::matrix<_TS>* __def) const;
00249
00250 template <class _TS>
00251 void assign(const char* __s, _TS& __b, _TS __def) const;
00253
00255
00262 template <class _TS>
00263 void assign_i(const std::string& __s, int i,
00264 const std::vector<_TS>*& __b) const throw(api_exception);
00265
00266 template <class _TS>
00267 void assign_i(const std::string& __s, int i, const linalg::matrix<_TS>*& __b) const
00268 throw(api_exception);
00269
00270 template <class _TS>
00271 void assign_i(const std::string& __s, int i, _TS& __b) const
00272 throw(api_exception);
00273
00274 template <class _TS>
00275 void assign_i(const char* __s, int i, const std::vector<_TS>*& __b) const
00276 throw(api_exception);
00277
00278 template <class _TS>
00279 void assign_i(const char* __s, int i, const linalg::matrix<_TS>*& __b) const
00280 throw(api_exception);
00281
00282 template <class _TS>
00283 void assign_i(const char* __s, int i, _TS& __b) const throw(api_exception);
00285
00287
00294 void assign_i(const std::string& __s, int i, std::string& __b,
00295 const char* __def) const;
00296
00297 void assign_i(const char* __s, int i, std::string& __b,
00298 const char* __def) const;
00299
00300 template <class _TS>
00301 void assign_i(const std::string& __s, int i, const std::vector<_TS>*& __b,
00302 const std::vector<_TS>* __def) const;
00303
00304 template <class _TS>
00305 void assign_i(const std::string& __s, int i, const linalg::matrix<_TS>*& __b,
00306 const linalg::matrix<_TS>* __def) const;
00307
00308 template <class _TS>
00309 void assign_i(const std::string& __s, int i, _TS& __b, _TS __def) const;
00310
00311 template <class _TS>
00312 void assign_i(const char* __s, int i, const std::vector<_TS>*& __b,
00313 const std::vector<_TS>* __def) const;
00314
00315 template <class _TS>
00316 void assign_i(const char* __s, int i, const linalg::matrix<_TS>*& __b,
00317 const linalg::matrix<_TS>* __def) const;
00318
00319 template <class _TS>
00320 void assign_i(const char* __s, int i, _TS& __b, _TS __def) const;
00322 };
00323
00324 }
00325
00326 #include <control_data.hpp>
00327
00328 #endif