00001 // See ../../license.txt for license information. 00002 // 00003 // c_ref.hpp 00004 // 00005 // 4-Jul-2003 phamilton Created 00006 // 00007 00008 #ifndef incC_REF 00009 #define incC_REF 00010 00011 // forwards 00012 #include <string> 00013 #include "c_base.hpp" 00014 #include "../../common/ref_object.hpp" 00015 00016 namespace persist_test { 00017 00018 class c_ref : 00019 public c_base, 00020 public ph::common::ref_object_helper 00021 /* 00022 A composite object implemented as a reference to a single object. 00023 */ 00024 { 00025 public: 00026 c_ref(ph::common::object_base *outer, const std::string &name) : 00027 c_base(outer, name) 00028 {}; 00029 00030 const ph::common::object_base *obj() const { return _obj; } 00031 // no refelction here. we need the object. 00032 00033 // ph::common::deletable_object_base overrides. 00034 virtual void delete_object() 00035 { helper_delete_object(owned()); } 00036 00037 // ph::common::composite_object_base overrides. 00038 virtual bool add(ph::common::object_base *obj, bool own) 00039 { return helper_add(this, obj, own, owned()); } 00040 virtual bool remove(ph::common::object_base *obj) 00041 { return helper_remove(obj); } 00042 virtual bool singleton() const 00043 { return helper_singleton(); } 00044 virtual int count() const 00045 { return helper_count(); } 00046 }; 00047 00048 }; 00049 00050 #endif // incC_REF