TAO_Notify::Topology_Object Class Reference

Base class for Persistent Topology Objects. More...

#include <Topology_Object.h>

Inheritance diagram for TAO_Notify::Topology_Object:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify::Topology_Object:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Topology_Object ()
 The constructor.

virtual ~Topology_Object ()
 The destructor.

virtual void initialize (Topology_Parent *topology_parent)
 Init this object with data from .

virtual Topology_Objectload_child (const ACE_CString &, CORBA::Long, const NVPList &)
 Create a child of the appropriate type and return it.

virtual TAO_Notify_Object::ID get_id () const
 Find the id associated with topology object.

void get_id_path (IdVec &id_path) const
 Get the path of id's from the root to this object.

bool is_changed () const
 Is there an unsaved change for this object or its children?


Protected Member Functions

virtual bool is_persistent () const
 Should this object be saved?

bool self_change ()
 Method to report change in this object.

Topology_Parenttopology_parent () const
 pointer to our topological parent

bool send_change ()
 Handle details of propagating change.


Protected Attributes

bool self_changed_
 true if this object changed since last save_persistent

bool children_changed_
 true of any of this object's children changed since last save_persistent

Topology_Parenttopology_parent_
 A safely-typed copy of parent_;.


Private Member Functions

virtual bool change_to_parent ()
 Send change to parent.


Detailed Description

Base class for Persistent Topology Objects.

Topology objects must be derived from this class to allow themselves to be persisted. Note: virtual inheritance from TopologySavable is unnecessary, but HP ACC compiler warns if it's not there.

Definition at line 109 of file Topology_Object.h.


Constructor & Destructor Documentation

TAO_Notify::Topology_Object::Topology_Object  ) 
 

The constructor.

Definition at line 29 of file Topology_Object.cpp.

00030     : TAO_Notify_Object ()
00031     , Topology_Savable ()
00032     , self_changed_ (false)
00033     , children_changed_ (false)
00034     , topology_parent_ (0)
00035   {
00036   }

TAO_Notify::Topology_Object::~Topology_Object  )  [virtual]
 

The destructor.

Definition at line 38 of file Topology_Object.cpp.

00039   {
00040   }


Member Function Documentation

bool TAO_Notify::Topology_Object::change_to_parent  )  [private, virtual]
 

Send change to parent.

Override this if you don't expect to have a parent (top level of tree) private virtual because this should only be called from send_change()

Returns:
false if save will never happen

Reimplemented in TAO_Notify_EventChannelFactory.

Definition at line 114 of file Topology_Object.cpp.

References ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, TAO_Notify::Topology_Parent::child_change(), and topology_parent().

Referenced by send_change().

00115   {
00116     bool result = false;
00117     Topology_Parent * parent = this->topology_parent();
00118     if (parent != 0)
00119     {
00120       result = parent->child_change(ACE_ENV_SINGLE_ARG_PARAMETER);
00121       ACE_CHECK_RETURN (false);
00122     }
00123     return result;
00124   }

TAO_Notify_Object::ID TAO_Notify::Topology_Object::get_id  )  const [virtual]
 

Find the id associated with topology object.

A bit of a hack because id is unknown to Topology_Object the get_id returns the same thing as id -- we just need someone to find it for us.

Reimplemented in TAO_Notify_EventChannel, and TAO_Notify_EventChannelFactory.

Definition at line 137 of file Topology_Object.cpp.

References ACE_ASSERT.

00138   {
00139     // If this assert triggers then implement the
00140     // get_id method in the actual class
00141     // derived from Topology_Object
00142     // or else figure out why this method was called
00143     // on an object that doesn't have an id.
00144     ACE_ASSERT (false);
00145     // if it is called in a release build, provide 'em a value
00146     return -1;
00147   }

void TAO_Notify::Topology_Object::get_id_path IdVec id_path  )  const
 

Get the path of id's from the root to this object.

Definition at line 127 of file Topology_Object.cpp.

References TAO_Notify::IdVec, ACE_Vector< T, DEFAULT_SIZE >::push_back(), and topology_parent().

00128   {
00129     if (this->topology_parent() != 0)
00130     {
00131       this->topology_parent()->get_id_path (id_path);
00132     }
00133     id_path.push_back (this->get_id ());
00134   }

void TAO_Notify::Topology_Object::initialize Topology_Parent topology_parent  )  [virtual]
 

Init this object with data from .

Definition at line 43 of file Topology_Object.cpp.

References ACE_ASSERT, TAO_Notify_Object::initialize(), topology_parent(), and topology_parent_.

Referenced by TAO_Notify_ProxySupplier::init(), TAO_Notify_ProxyConsumer::init(), TAO_Notify_EventChannel::init(), and TAO_Notify_Admin::init().

00044   {
00045     ACE_ASSERT (topology_parent != 0 && this->topology_parent_ == 0);
00046     this->topology_parent_ = topology_parent;
00047     TAO_Notify_Object::initialize (topology_parent);
00048   }

ACE_INLINE bool TAO_Notify::Topology_Object::is_changed  )  const
 

Is there an unsaved change for this object or its children?

Definition at line 11 of file Topology_Object.inl.

References children_changed_, and self_changed_.

Referenced by TAO_Notify_Proxy::save_persistent(), TAO_Notify_EventChannelFactory::save_persistent(), and TAO_Notify_Admin::save_persistent().

00012   {
00013     return this->self_changed_ | this->children_changed_;
00014   }

bool TAO_Notify::Topology_Object::is_persistent  )  const [protected, virtual]
 

Should this object be saved?

This is a way for send_change() and save_persistent() to find out if this object has a persistent QoS connection property.

Returns:
true (default) if object should be saved.

Reimplemented in TAO_Notify_EventChannelFactory.

Definition at line 67 of file Topology_Object.cpp.

References TAO_Notify_QoSProperties::event_reliability(), TAO_Notify_PropertyBase_T< TYPE >::is_valid(), topology_parent(), and TAO_Notify_PropertyBase_T< TYPE >::value().

Referenced by TAO_Notify_Proxy::save_persistent(), TAO_Notify_EventChannel::save_persistent(), TAO_Notify_Admin::save_persistent(), and send_change().

00068   {
00069     bool result = false;
00070     if (this->qos_properties_.event_reliability().is_valid ())
00071     {
00072       result = CosNotification::Persistent == this->qos_properties_.event_reliability().value ();
00073     }
00074     else if (this->topology_parent () != 0)
00075     {
00076       result = this->topology_parent ()->is_persistent ();
00077     }
00078     return result;
00079   }

Topology_Object * TAO_Notify::Topology_Object::load_child const ACE_CString ,
CORBA::Long  ,
const NVPList
[virtual]
 

Create a child of the appropriate type and return it.

Use "type" as passed in to determine what kind of child (supporting the Topology_Object interface) to create and return. Inform it of its new ID.

Reimplemented in TAO_Notify::Reconnection_Registry.

Definition at line 58 of file Topology_Object.cpp.

00062   {
00063     return 0;
00064   }

bool TAO_Notify::Topology_Object::self_change  )  [protected]
 

Method to report change in this object.

see also Topology_Parent::child_change ()

Returns:
false if save will never happen

Definition at line 82 of file Topology_Object.cpp.

References ACE_ENV_SINGLE_ARG_PARAMETER, self_changed_, and send_change().

Referenced by TAO_Notify::Reconnection_Registry::register_callback(), TAO_Notify_EventChannelFactory::remove(), and TAO_Notify::Reconnection_Registry::unregister_callback().

00083   {
00084     this->self_changed_ = true;
00085     return send_change (ACE_ENV_SINGLE_ARG_PARAMETER);
00086   }

bool TAO_Notify::Topology_Object::send_change  )  [protected]
 

Handle details of propagating change.

Returns:
false if save will never happen

Definition at line 89 of file Topology_Object.cpp.

References ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, change_to_parent(), children_changed_, is_persistent(), and self_changed_.

Referenced by self_change().

00090   {
00091     bool saving = false;
00092     if (is_persistent ())
00093     {
00094       while (this->self_changed_ || this->children_changed_)
00095       {
00096         saving = this->change_to_parent (ACE_ENV_SINGLE_ARG_PARAMETER);
00097         ACE_CHECK_RETURN (false);
00098         if (!saving)
00099         {
00100           this->self_changed_ = false;
00101           this->children_changed_ = false;
00102         }
00103       }
00104     }
00105     else
00106     {
00107       this->self_changed_ = false;
00108       this->children_changed_ = false;
00109     }
00110     return saving;
00111   }

Topology_Parent * TAO_Notify::Topology_Object::topology_parent  )  const [protected]
 

pointer to our topological parent

Returns:
0 if none

Definition at line 51 of file Topology_Object.cpp.

References topology_parent_.

Referenced by change_to_parent(), get_id_path(), initialize(), and is_persistent().

00052   {
00053     return this->topology_parent_;
00054   }


Member Data Documentation

bool TAO_Notify::Topology_Object::children_changed_ [protected]
 

true of any of this object's children changed since last save_persistent

Definition at line 183 of file Topology_Object.h.

Referenced by is_changed(), and send_change().

bool TAO_Notify::Topology_Object::self_changed_ [protected]
 

true if this object changed since last save_persistent

Definition at line 181 of file Topology_Object.h.

Referenced by is_changed(), self_change(), and send_change().

Topology_Parent* TAO_Notify::Topology_Object::topology_parent_ [protected]
 

A safely-typed copy of parent_;.

Definition at line 186 of file Topology_Object.h.

Referenced by initialize(), and topology_parent().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:34:38 2006 for TAO_CosNotification by doxygen 1.3.6