00001 // See ../../license.txt for license information. 00002 // 00003 // base.hpp 00004 // 00005 // 4-Jul-2003 phamilton Created 00006 // 00007 00008 #ifndef incBASE 00009 #define incBASE 00010 00011 // forwards 00012 #include "../../common/object.hpp" 00013 #include "../../common/persistable_object.hpp" 00014 #include "../../common/outerable_object.hpp" 00015 #include "../../common/composition_object.hpp" 00016 00017 namespace persist_test { 00018 00019 class base : 00020 public ph::common::object_base, 00021 public ph::common::persistable_object_base, 00022 public ph::common::outerable_object_base, 00023 ph::common::outerable_helper, 00024 public ph::common::composition_object_base 00025 { 00026 public: 00027 base(const std::string &type, const std::string &name) : 00028 _type(type), _name(name) 00029 {}; 00030 virtual ~base() {}; 00031 00032 // ph::common::object_base overrides 00033 virtual ph::common::outerable_object_base *outerable() 00034 { return this; } 00035 virtual const ph::common::outerable_object_base *outerable() const 00036 { return this; } 00037 virtual const ph::common::composition_object_base *composition() const 00038 { return this; } 00039 virtual ph::common::composition_object_base *composition() 00040 { return this; } 00041 virtual const persistable_object_base *persistable() const 00042 { return this; } 00043 virtual persistable_object_base *persistable() 00044 { return this; } 00045 00046 // persistable_object_base overrides 00047 virtual ph::common::object_base *create( 00048 const std::string &type, 00049 const std::string &name, 00050 ph::common::persistable_object_context *context) 00051 { 00052 if (outer() && outer()->persistable()) 00053 return outer()->persistable()->create(type, name, context); 00054 return 0; 00055 } 00056 00057 // ph::common::outerable_object_base<object> overides 00058 virtual ph::common::object_base *outer() const { return outer_helper(); } 00059 virtual void outer(ph::common::object_base *outer) { outer_helper(outer); } 00060 00061 protected: 00062 std::string _type; 00063 std::string _name; 00064 }; 00065 00066 }; 00067 00068 #endif // incBASE