|
Urbi SDK Remote for C++
2.7.5
|
00001 /* 00002 * Copyright (C) 2006-2010, Gostai S.A.S. 00003 * 00004 * This software is provided "as is" without warranty of any kind, 00005 * either expressed or implied, including but not limited to the 00006 * implied warranties of fitness for a particular purpose. 00007 * 00008 * See the LICENSE file for more information. 00009 */ 00010 00013 00014 #ifndef URBI_UTABLE_HH 00015 # define URBI_UTABLE_HH 00016 00017 # include <list> 00018 # include <string> 00019 00020 # include <libport/hash.hh> 00021 # include <libport/safe-container.hh> 00022 00023 # include <urbi/export.hh> 00024 # include <urbi/uvalue.hh> 00025 00026 namespace urbi 00027 { 00028 // FIXME: There are probably more opportunities for factoring here, 00029 // fusing these two (three?) classes. 00030 00031 /*---------. 00032 | UTable. | 00033 `---------*/ 00034 00035 // A few list and hashtable types 00036 struct URBI_SDK_API UTable 00037 : boost::unordered_map<std::string, 00038 libport::SafeContainer< std::list, UGenericCallback*> > 00039 { 00041 typedef std::string key_type; 00042 00044 typedef libport::SafeContainer<std::list, UGenericCallback*> callbacks_type; 00045 typedef callbacks_type mapped_type; 00046 00048 typedef boost::unordered_map<key_type, mapped_type> super_type; 00049 00051 typedef super_type::const_iterator const_iterator; 00052 typedef super_type::iterator iterator; 00053 00055 UTable(); 00056 00058 mapped_type* find0(const key_type& name); 00059 00062 void clean(const key_type& name); 00063 }; 00064 00065 /*------------. 00066 | UVarTable. | 00067 `------------*/ 00068 00069 struct URBI_SDK_API UVarTable 00070 : boost::unordered_map<std::string, std::list<UVar*> > 00071 { 00073 typedef std::string key_type; 00074 00076 typedef std::list<UVar*> callbacks_type; 00077 typedef callbacks_type mapped_type; 00078 00080 typedef boost::unordered_map<key_type, mapped_type> super_type; 00081 00083 typedef super_type::const_iterator const_iterator; 00084 typedef super_type::iterator iterator; 00085 00086 00088 mapped_type* find0(const key_type& name); 00089 00090 void clean(const UVar& uvar); 00091 }; 00092 00093 /*--------------. 00094 | Timer table. | 00095 `--------------*/ 00096 00097 typedef std::list<UTimerCallback*> UTimerTable; 00098 00099 } // end namespace urbi 00100 00101 00102 # ifdef _MSC_VER 00103 // Without this, msvc 2005 fails at link time with: 00104 // unresolved external symbol "public: __thiscall libport::SafeContainer<class std::list,class urbi::UGenericCallback *>::real_value_type::real_value_type(class urbi::UGenericCallback * const &,class libport::SafeContainer<class std::list,class urbi::UGenericCallback *> &)" 00105 00106 template libport::SafeContainer<std::list, urbi::UGenericCallback*>; 00107 # endif 00108 00109 #endif // ! URBI_UTABLE_HH