PLearn 0.1
|
Special type of ParentableObject that cannot act as a visible parent. More...
#include <ParentableObject.h>
Public Member Functions | |
TransparentParentable (bool adoptive_parent=false, ParentKind=WeakParent) | |
Default constructor. | |
virtual void | updateChildrensParent (Object *the_parent) |
Overridden to ensure that if "the_parent == this", we actually set the children's parent to parent(). | |
virtual void | setParent (Object *parent) |
Setter directly calls all of its parentable children; transparent of transparent should work fine and skip both of them. | |
virtual void | checkParent () const |
Just forward the call to its subobjects. | |
virtual TransparentParentable * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Post-constructor. | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
Static Public Member Functions | |
static string | _classname_ () |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Private Types | |
typedef ParentableObject | inherited |
Private Member Functions | |
void | build_ () |
Traverse the options of *this, find the ParentableObjects, and update _their_ backpointers to point to *this. |
Special type of ParentableObject that cannot act as a visible parent.
Suppose that you have the following object structure:
MasterManager contains a list of ObjectDescriptor Each ObjectDescriptor contains a list of ChildrenObject
The idea here is that ObjectDescriptor is a simple holder class that provides additional information for how ChildrenObject should be built in the context of MasterManager. However, we want to have the situation wherein the parent() of each ChildrenObject is the MasterManager, and not the ObjectDescriptors.
That's the purpose of TransparentParentable: if you make ObjectDescriptor a derived class of TransparentParentable, they are skipped when going up on the children-parent paths.
Definition at line 275 of file ParentableObject.h.
typedef ParentableObject PLearn::TransparentParentable::inherited [private] |
Reimplemented from PLearn::ParentableObject.
Definition at line 277 of file ParentableObject.h.
PLearn::TransparentParentable::TransparentParentable | ( | bool | adoptive_parent = false , |
ParentKind | pk = WeakParent |
||
) |
Default constructor.
Definition at line 230 of file ParentableObject.cc.
: inherited(adoptive_parent, pk) { }
string PLearn::TransparentParentable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::ParentableObject.
Definition at line 228 of file ParentableObject.cc.
OptionList & PLearn::TransparentParentable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::ParentableObject.
Definition at line 228 of file ParentableObject.cc.
RemoteMethodMap & PLearn::TransparentParentable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::ParentableObject.
Definition at line 228 of file ParentableObject.cc.
Reimplemented from PLearn::ParentableObject.
Definition at line 228 of file ParentableObject.cc.
StaticInitializer TransparentParentable::_static_initializer_ & PLearn::TransparentParentable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::ParentableObject.
Definition at line 228 of file ParentableObject.cc.
void PLearn::TransparentParentable::build | ( | ) | [virtual] |
Post-constructor.
The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.
Reimplemented from PLearn::ParentableObject.
Definition at line 235 of file ParentableObject.cc.
References PLearn::ParentableObject::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::TransparentParentable::build_ | ( | ) | [private] |
Traverse the options of *this, find the ParentableObjects, and update _their_ backpointers to point to *this.
Reimplemented from PLearn::ParentableObject.
Definition at line 246 of file ParentableObject.cc.
Referenced by build().
{ }
void PLearn::TransparentParentable::checkParent | ( | ) | const [virtual] |
Just forward the call to its subobjects.
Reimplemented from PLearn::ParentableObject.
Definition at line 265 of file ParentableObject.cc.
References PLearn::OptionBase::nonparentable.
{ // Forward the call to sub-objects for (ObjectOptionsIterator it(this), end ; it != end ; ++it) { if (it.getCurrentOptionFlags() & OptionBase::nonparentable) continue; if (const ParentableObject* po = dynamic_cast<const ParentableObject*>(*it)) const_cast<ParentableObject*>(po)->checkParent(); } }
static const PPath& PLearn::TransparentParentable::declaringFile | ( | ) | [inline, static] |
TransparentParentable * PLearn::TransparentParentable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::ParentableObject.
Definition at line 228 of file ParentableObject.cc.
void PLearn::TransparentParentable::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::ParentableObject.
Definition at line 241 of file ParentableObject.cc.
References PLearn::ParentableObject::makeDeepCopyFromShallowCopy().
{ inherited::makeDeepCopyFromShallowCopy(copies); }
void PLearn::TransparentParentable::setParent | ( | Object * | parent | ) | [virtual] |
Setter directly calls all of its parentable children; transparent of transparent should work fine and skip both of them.
Reimplemented from PLearn::ParentableObject.
Definition at line 258 of file ParentableObject.cc.
References PLearn::ParentableObject::setParent(), and updateChildrensParent().
{ // Set it for ourselves and our children inherited::setParent(parent); updateChildrensParent(parent); }
void PLearn::TransparentParentable::updateChildrensParent | ( | Object * | the_parent | ) | [virtual] |
Overridden to ensure that if "the_parent == this", we actually set the children's parent to parent().
Reimplemented from PLearn::ParentableObject.
Definition at line 249 of file ParentableObject.cc.
References PLearn::ParentableObject::parent(), and PLearn::ParentableObject::updateChildrensParent().
Referenced by setParent().
{ if (the_parent == this) // parent() may be null -- this is fine inherited::updateChildrensParent(parent()); else inherited::updateChildrensParent(the_parent); }
Reimplemented from PLearn::ParentableObject.
Definition at line 300 of file ParentableObject.h.