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