00001 // -*- C++ -*- 00020 #ifndef RTC_NUMBERINGPOLICY_H 00021 #define RTC_NUMBERINGPOLICY_H 00022 00023 #include <string> 00024 #include <vector> 00025 00054 class NumberingPolicy 00055 { 00056 public: 00065 struct ObjectNotFound {}; 00066 00078 virtual ~NumberingPolicy(void){}; 00079 00103 virtual std::string onCreate(void* obj) = 0; 00104 00124 virtual void onDelete(void* obj) = 0; 00125 }; 00126 00149 class DefaultNumberingPolicy 00150 : public NumberingPolicy 00151 { 00152 public: 00168 DefaultNumberingPolicy() : m_num(0) {}; 00169 00181 virtual ~DefaultNumberingPolicy(void){}; 00182 00208 virtual std::string onCreate(void* obj); 00209 00231 virtual void onDelete(void* obj); 00232 00233 protected: 00259 long int find(void* obj); 00260 00261 private: 00262 int m_num; 00263 std::vector<void*> m_objects; 00264 }; 00265 #endif // RTC_NUMBERINGPOLICY_H