PLearn 0.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions
PLearn::TransparentParentable Class Reference

Special type of ParentableObject that cannot act as a visible parent. More...

#include <ParentableObject.h>

Inheritance diagram for PLearn::TransparentParentable:
Inheritance graph
[legend]
Collaboration diagram for PLearn::TransparentParentable:
Collaboration graph
[legend]

List of all members.

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 TransparentParentabledeepCopy (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 PPathdeclaringFile ()

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.

Detailed Description

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.


Member Typedef Documentation

Reimplemented from PLearn::ParentableObject.

Definition at line 277 of file ParentableObject.h.


Constructor & Destructor Documentation

PLearn::TransparentParentable::TransparentParentable ( bool  adoptive_parent = false,
ParentKind  pk = WeakParent 
)

Default constructor.

Definition at line 230 of file ParentableObject.cc.

    : inherited(adoptive_parent, pk)
{ }

Member Function Documentation

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.

bool PLearn::TransparentParentable::_isa_ ( const Object o) [static]

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_().

Here is the call graph for this function:

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().

{ }

Here is the caller graph for this function:

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]

Reimplemented from PLearn::ParentableObject.

Definition at line 300 of file ParentableObject.h.

: 
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().

Here is the call graph for this function:

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);
}

Here is the call graph for this function:

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);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from PLearn::ParentableObject.

Definition at line 300 of file ParentableObject.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines