#include <composition_object.hpp>
Inheritance diagram for ph::common::composite_object_base:
This class is the "Composite" in the "Composite" pattern.
Definition at line 34 of file composition_object.hpp.
Public Member Functions | |
virtual bool | add (object_base *obj, bool owned)=0 |
virtual bool | remove (object_base *obj)=0 |
virtual bool | owned () const |
virtual void | owned (bool owned) |
virtual bool | singleton () const =0 |
virtual int | count () const =0 |
virtual composite_object_base * | composite () |
virtual const composite_object_base * | composite () const |
|
Add a new object to the composite object. The client passes in their understanding of the ownership policy to make sure that it fits in with the composites ownership. If they don't match, then the object won't be added, and the client can take appropriate action. Implemented in reflect_test::c_ref, reflect_test::c_vector, persist_test::c_ref, and persist_test::c_vector. Referenced by reflect_test::test_composite::test(). |
|
Remove and object from the composite. Objects which are removed are not subject to the ownership policy of the composite, since they are simply forgotten by it. Implemented in reflect_test::c_ref, reflect_test::c_vector, persist_test::c_ref, and persist_test::c_vector. Referenced by reflect_test::test_composite::test(). |
|
|
Return true of the collection is owned. normally this means that when the composite is deleted, the objects it contains are deleted with it, but on in a more complex system (which would need to provide the ability to clone objects), this could be used to provide owned/non-owned composites. Definition at line 57 of file composition_object.hpp. |
|
If the composite can only hold one value (so a second add() will fail for example), then this returns true. It is used when reflecting through composites to prevent subscripts being required. Implemented in reflect_test::c_ref, reflect_test::c_vector, persist_test::c_ref, and persist_test::c_vector. |
|
Return the number of objects contained in this composite object. Implemented in reflect_test::c_ref, reflect_test::c_vector, persist_test::c_ref, and persist_test::c_vector. |
|
Reimplemented from ph::common::composition_object_base. Definition at line 76 of file composition_object.hpp. |
|
Reimplemented from ph::common::composition_object_base. Definition at line 78 of file composition_object.hpp. |