00001 // See ../../license.txt for license information. 00002 // 00003 // c_base.hpp 00004 // 00005 // 4-Jul-2003 phamilton Created 00006 // 00007 00008 #ifndef incC_BASE 00009 #define incC_BASE 00010 00011 // forwards 00012 #include "../../common/object.hpp" 00013 #include "../../common/persistable_object.hpp" 00014 #include "../../common/deletable_object.hpp" 00015 #include "../../common/outerable_object.hpp" 00016 #include "../../common/comparable_object.hpp" 00017 #include "../../common/composite_object.hpp" 00018 #include "../../common/composition_object.hpp" 00019 00020 namespace persist_test { 00021 00022 class c_base : 00023 public ph::common::object_base, 00024 public ph::common::persistable_object_base, 00025 public ph::common::deletable_object_base, 00026 public ph::common::outerable_object_base, 00027 ph::common::outerable_helper, 00028 public ph::common::comparable_object_base, 00029 public ph::common::composite_object_base, 00030 public ph::common::composite_object_helper 00031 { 00032 public: 00033 c_base(ph::common::object_base *outer, const std::string &name) : 00034 ph::common::outerable_helper(outer), _name(name) 00035 {}; 00036 00037 // ph::common::object_base overrides 00038 virtual ph::common::deletable_object_base *deletable() 00039 { return this; } 00040 virtual ph::common::outerable_object_base *outerable() 00041 { return this; } 00042 virtual const ph::common::outerable_object_base *outerable() const 00043 { return this; } 00044 virtual const ph::common::comparable_object_base *comparable() const 00045 { return this; } 00046 virtual const ph::common::composition_object_base *composition() const 00047 { return this; } 00048 virtual ph::common::composition_object_base *composition() 00049 { return this; } 00050 virtual const persistable_object_base *persistable() const 00051 { return this; } 00052 virtual persistable_object_base *persistable() 00053 { return this; } 00054 00055 // persistable_object_base overrides 00056 virtual ph::common::object_base *create( 00057 const std::string &type, 00058 const std::string &name, 00059 ph::common::persistable_object_context *context); 00060 virtual ph::common::object_base *get_composite_object(const std::string &name) 00061 { return 0; } 00062 virtual bool has(const std::string &name) const; 00063 virtual void set(const std::string &name, const std::string &value); 00064 virtual std::string get(const std::string &name) const; 00065 00066 // ph::common::outerable_object_base<object> overides 00067 virtual ph::common::object_base *outer() const { return outer_helper(); } 00068 virtual void outer(ph::common::object_base *outer) { outer_helper(outer); } 00069 00070 // ph::common::comparable_object_base overrides. 00071 virtual bool equal(const ph::common::object_base *obj) const 00072 { return helper_equal(obj, outer(), _name); } 00073 00074 protected: 00075 std::string _name; 00076 }; 00077 00078 }; 00079 00080 #endif // incC_BASE