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 <rhs>.
virtual Topology_Objectload_child (const ACE_CString &type, CORBA::Long id, const NVPList &attrs)
 Create a child of the appropriate type and return it.
virtual TAO_Notify_Object::ID get_id (void) 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 (void) const
 Is there an unsaved change for this object or its children?

Protected Member Functions

virtual bool is_persistent (void) const
 Should this object be saved?
bool self_change (void)
 Method to report change in this object.
Topology_Parenttopology_parent () const
 pointer to our topological parent
bool send_change (void)
 Handle details of propagating change.
bool send_deletion_change ()
 Handle details of propagating change for a deleted object.

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 (void)
 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 107 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 ( void   )  [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 125 of file Topology_Object.cpp.

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

Referenced by send_change(), and send_deletion_change().

00126     {
00127       bool result = false;
00128       Topology_Parent * parent = this->topology_parent();
00129       if (parent != 0)
00130       {
00131         result = parent->child_change();
00132       }
00133       return result;
00134     }

TAO_Notify_Object::ID TAO_Notify::Topology_Object::get_id ( void   )  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 147 of file Topology_Object.cpp.

References ACE_ASSERT.

00148   {
00149     // If this assert triggers then implement the
00150     // get_id method in the actual class
00151     // derived from Topology_Object
00152     // or else figure out why this method was called
00153     // on an object that doesn't have an id.
00154     ACE_ASSERT (false);
00155     // if it is called in a release build, provide 'em a value
00156     return -1;
00157   }

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 137 of file Topology_Object.cpp.

References ACE_Vector< T, DEFAULT_SIZE >::push_back().

00138   {
00139     if (this->topology_parent() != 0)
00140     {
00141       this->topology_parent()->get_id_path (id_path);
00142     }
00143     id_path.push_back (this->get_id ());
00144   }

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

Init this object with data from <rhs>.

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

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

bool TAO_Notify::Topology_Object::is_persistent ( void   )  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 66 of file Topology_Object.cpp.

References CosNotification::Persistent.

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

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

Topology_Object * TAO_Notify::Topology_Object::load_child ( const ACE_CString type,
CORBA::Long  id,
const NVPList attrs 
) [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_Admin, TAO_Notify_ConsumerAdmin, TAO_Notify_EventChannel, TAO_Notify_EventChannelFactory, TAO_Notify_EventTypeSeq, TAO_Notify_FilterAdmin, TAO_Notify_Proxy, TAO_Notify::Reconnection_Registry, and TAO_Notify_SupplierAdmin.

Definition at line 58 of file Topology_Object.cpp.

00061   {
00062     return 0;
00063   }

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

Method to report change in this object.

see also Topology_Parent::child_change ()

Returns:
false if save will never happen

Definition at line 81 of file Topology_Object.cpp.

References self_changed_, and send_change().

Referenced by TAO_Notify_SupplierAdmin::add_filter(), TAO_Notify_Proxy_T< SERVANT_TYPE >::add_filter(), TAO_Notify_ConsumerAdmin::add_filter(), TAO_Notify_ProxyPushSupplier::connect_any_push_consumer(), TAO_Notify_ProxyPushConsumer::connect_any_push_supplier(), TAO_Notify_SequenceProxyPushSupplier::connect_sequence_push_consumer(), TAO_Notify_SequenceProxyPushConsumer::connect_sequence_push_supplier(), TAO_Notify_StructuredProxyPushSupplier::connect_structured_push_consumer(), TAO_Notify_StructuredProxyPushConsumer::connect_structured_push_supplier(), TAO_Notify_EventChannelFactory::create_channel(), TAO_Notify_ProxyPushConsumer::disconnect_push_consumer(), TAO_Notify_ProxyPushSupplier::disconnect_push_supplier(), TAO_Notify_SequenceProxyPushConsumer::disconnect_sequence_push_consumer(), TAO_Notify_SequenceProxyPushSupplier::disconnect_sequence_push_supplier(), TAO_Notify_EventChannel::new_for_consumers(), TAO_Notify_EventChannel::new_for_suppliers(), TAO_Notify_SupplierAdmin::obtain_notification_push_consumer(), TAO_Notify_SupplierAdmin::obtain_notification_push_consumer_with_qos(), TAO_Notify_ConsumerAdmin::obtain_notification_push_supplier(), TAO_Notify_ConsumerAdmin::obtain_notification_push_supplier_with_qos(), TAO_Notify_SupplierAdmin::obtain_push_consumer(), TAO_Notify_ConsumerAdmin::obtain_push_supplier(), TAO_Notify_EventChannelFactory::remove(), TAO_Notify_EventChannelFactory::save_topology(), TAO_Notify_ConsumerAdmin::subscription_change(), and TAO_Notify_ProxySupplier_T< SERVANT_TYPE >::suspend_connection().

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

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

Handle details of propagating change.

Returns:
false if save will never happen

Definition at line 88 of file Topology_Object.cpp.

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

Referenced by TAO_Notify::Topology_Parent::child_change(), and self_change().

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

bool TAO_Notify::Topology_Object::send_deletion_change (  )  [protected]

Handle details of propagating change for a deleted object.

Returns:
false if save will never happen

Definition at line 112 of file Topology_Object.cpp.

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

Referenced by TAO_Notify_StructuredProxyPushConsumer::disconnect_structured_push_consumer(), and TAO_Notify_StructuredProxyPushSupplier::disconnect_structured_push_supplier().

00113   {
00114     bool saving = false;
00115     if (is_persistent ())
00116     {
00117       saving = this->change_to_parent ();
00118     }
00119     this->self_changed_ = false;
00120     this->children_changed_ = false;
00121     return saving;
00122   }

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(), TAO_Notify_ProxyConsumer::init(), and initialize().

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 186 of file Topology_Object.h.

Referenced by TAO_Notify::Topology_Parent::child_change(), is_changed(), TAO_Notify::Reconnection_Registry::save_persistent(), TAO_Notify_Proxy::save_persistent(), TAO_Notify_EventTypeSeq::save_persistent(), TAO_Notify_EventChannelFactory::save_persistent(), TAO_Notify_EventChannel::save_persistent(), TAO_Notify_Admin::save_persistent(), send_change(), and send_deletion_change().

bool TAO_Notify::Topology_Object::self_changed_ [protected]

true if this object changed since last save_persistent

Definition at line 184 of file Topology_Object.h.

Referenced by is_changed(), TAO_Notify::Reconnection_Registry::save_persistent(), TAO_Notify_Proxy::save_persistent(), TAO_Notify_EventTypeSeq::save_persistent(), TAO_Notify_EventChannelFactory::save_persistent(), TAO_Notify_EventChannel::save_persistent(), TAO_Notify_Admin::save_persistent(), self_change(), send_change(), and send_deletion_change().

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

A safely-typed copy of parent_;.

Definition at line 189 of file Topology_Object.h.

Referenced by initialize(), TAO_Notify::Reconnection_Registry::Reconnection_Registry(), and topology_parent().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:46:45 2010 for TAO_CosNotification by  doxygen 1.4.7