00001 // See ../license.txt for license information. 00002 // 00003 // object_navigator.hpp 00004 // 00005 // 8-Jul-2003 phamilton Created 00006 // 00007 00008 #ifndef incREFLECT_OBJECT_NAVIGATOR 00009 #define incREFLECT_OBJECT_NAVIGATOR 00010 00011 // forwards 00012 #include <string> 00013 #include "config.hpp" 00014 00015 namespace ph { 00016 namespace common { 00017 class object_base; 00018 }; 00019 namespace reflect { 00020 00021 class REFLECT_DECL object_navigator 00022 /** 00023 Abstract class used to navigate the object tree and return an object. 00024 */ 00025 { 00026 public: 00027 object_navigator(const ph::common::object_base *root, std::ostream *console) : 00028 _root(root), _console(console) 00029 {}; 00030 virtual ~object_navigator() {}; 00031 00032 virtual ph::common::object_base *navigate(const ph::common::object_base *obj, const std::string &path) = 0; 00033 //!< Return an object given a string path to that object. Subclasses 00034 //! implement the syntax of the path. 00035 00036 protected: 00037 const ph::common::object_base *_root; 00038 std::ostream *_console; 00039 }; 00040 00041 class REFLECT_DECL object_navigator_factory 00042 /** 00043 Abstract class used for a factory to create the object navigators. 00044 */ 00045 { 00046 public: 00047 object_navigator_factory(std::ostream *console) : 00048 _console(console) 00049 {}; 00050 virtual ~object_navigator_factory() {}; 00051 00052 virtual object_navigator *create(const ph::common::object_base *root) = 0; 00053 //!< Create a new object navigator. 00054 00055 protected: 00056 std::ostream *_console; 00057 }; 00058 00059 }; // reflect 00060 }; // ph 00061 00062 #endif // incREFLECT_OBJECT_NAVIGATOR