Base Object for RT_Notify's CORBA Objects. More...
#include <Object.h>
Public Types | |
typedef CORBA::Long | ID |
Id for Objects. | |
Public Member Functions | |
virtual | ~TAO_Notify_Object (void) |
Destructor. | |
ID | id (void) const |
This Object's ID. | |
virtual CORBA::Object_ptr | activate (PortableServer::Servant servant) |
Activate. | |
virtual CORBA::Object_ptr | activate (PortableServer::Servant servant, CORBA::Long id) |
Activate with existing id. | |
void | deactivate (void) |
Deactivate. | |
bool | has_shutdown (void) |
Have we been shutdown. returns true if shutdown. | |
void | execute_task (TAO_Notify_Method_Request &method_request) |
CORBA::Object_ptr | ref (void) |
Get CORBA Ref. | |
virtual void | set_qos (const CosNotification::QoSProperties &qos) |
Set the QoS Properties. | |
CosNotification::QoSProperties * | get_qos (void) |
Get the QoS Properties. | |
bool | find_qos_property_value (const char *name, CosNotification::PropertyValue &value) const |
virtual TAO_Notify_Timer * | timer (void) |
Obtain the Timer manager associated with this object. | |
TAO_Notify_Event_Manager & | event_manager (void) |
Accessor for the Event Manager. | |
virtual int | shutdown (void) |
Shutdown. Returns 1 if the shutdown was already run once before. | |
virtual void | load_attrs (const TAO_Notify::NVPList &attrs) |
TAO_Notify_Worker_Task * | get_worker_task (void) |
Allow access to the underlying worker task. | |
Protected Member Functions | |
TAO_Notify_Object (void) | |
Constructor. | |
void | initialize (TAO_Notify_Object *parent) |
Init this object with data from <rhs>. | |
void | inherit_poas (TAO_Notify_Object &parent) |
Uses the poas from the supplied object. | |
void | adopt_poa (TAO_Notify_POA_Helper *single) |
Adopts the supplied poa as all are poas. | |
void | set_primary_as_proxy_poa () |
Changes the primary poa to the current proxy poa. | |
TAO_Notify_POA_Helper * | proxy_poa (void) |
Accessor for the proxy_poa_. | |
TAO_Notify_POA_Helper * | object_poa (void) |
Accessor for the object_poa_. | |
TAO_Notify_POA_Helper * | poa (void) |
Get the POA assigned to us. | |
void | set_event_manager (TAO_Notify_Event_Manager *event_manager) |
void | set_admin_properties (TAO_Notify_AdminProperties *admin_properties) |
TAO_Notify_AdminProperties & | admin_properties (void) |
Accessor for the Admin Properties. | |
virtual void | qos_changed (const TAO_Notify_QoSProperties &qos_properties) |
virtual void | save_attrs (TAO_Notify::NVPList &attrs) |
Protected Attributes | |
TAO_Notify_QoSProperties | qos_properties_ |
= Protected data members. | |
TAO_SYNCH_MUTEX | lock_ |
The mutex to serialize access to state variables. | |
Private Member Functions | |
void | set_worker_task (TAO_Notify_Worker_Task *worker_task) |
Set Worker Task. This object assume ownership of the set object. | |
void | set_proxy_poa (TAO_Notify_POA_Helper *proxy_poa) |
Setting the proxy_poa_ gives ownership to this class. | |
void | set_object_poa (TAO_Notify_POA_Helper *object_poa) |
Setting the object_poa_ gives ownership to this class. | |
void | set_poa (TAO_Notify_POA_Helper *object_poa) |
Setting the object_poa_ gives ownership to this class. | |
void | shutdown_worker_task (void) |
Shutdown the current worker task and delete it if we own it. | |
void | destroy_proxy_poa (void) |
Shutdown the current proxy poa. | |
void | destroy_object_poa (void) |
Shutdown the current object poa. | |
void | destroy_poa (void) |
Shutdown the current poa. | |
Private Attributes | |
TAO_Notify_POA_Helper * | poa_ |
The POA in which the object is activated. | |
TAO_Notify_POA_Helper * | proxy_poa_ |
The POA in which the proxys are activated. | |
bool | own_proxy_poa_ |
TAO_Notify_POA_Helper * | object_poa_ |
The POA in which the object's children are activated. | |
bool | own_object_poa_ |
ID | id_ |
Id assigned to this object. | |
TAO_Notify_Refcountable_Guard_T < TAO_Notify_Event_Manager > | event_manager_ |
TAO_Notify_AdminProperties::Ptr | admin_properties_ |
Admin Properties. | |
TAO_Notify_Worker_Task::Ptr | worker_task_ |
Worker Task. | |
bool | own_worker_task_ |
bool | shutdown_ |
Are we shutdown (i,e. scheduled for destroy). | |
Friends | |
class | TAO_Notify_Builder |
class | TAO_Notify_RT_Builder |
Base Object for RT_Notify's CORBA Objects.
Definition at line 47 of file Object.h.
typedef CORBA::Long TAO_Notify_Object::ID |
TAO_Notify_Object::~TAO_Notify_Object | ( | void | ) | [virtual] |
Destructor.
Definition at line 35 of file Object.cpp.
{ if (TAO_debug_level > 2 ) ACE_DEBUG ((LM_DEBUG,"object:%x destroyed\n", this )); this->destroy_proxy_poa (); this->destroy_object_poa (); this->destroy_poa (); }
TAO_Notify_Object::TAO_Notify_Object | ( | void | ) | [protected] |
Constructor.
Definition at line 21 of file Object.cpp.
: poa_ (0) , proxy_poa_ (0) , own_proxy_poa_ (false) , object_poa_ (0) , own_object_poa_ (false) , id_ (0) , own_worker_task_ (false) , shutdown_ (false) { if (TAO_debug_level > 2 ) ACE_DEBUG ((LM_DEBUG,"object:%x created\n", this )); }
CORBA::Object_ptr TAO_Notify_Object::activate | ( | PortableServer::Servant | servant | ) | [virtual] |
Activate.
Definition at line 71 of file Object.cpp.
CORBA::Object_ptr TAO_Notify_Object::activate | ( | PortableServer::Servant | servant, | |
CORBA::Long | id | |||
) | [virtual] |
Activate with existing id.
Definition at line 78 of file Object.cpp.
{ this->id_ = id; return this->poa_->activate_with_id (servant, this->id_); }
TAO_Notify_AdminProperties & TAO_Notify_Object::admin_properties | ( | void | ) | [protected] |
Accessor for the Admin Properties.
Definition at line 91 of file Object.inl.
{ ACE_ASSERT( this->admin_properties_.get() != 0 ); return *this->admin_properties_; }
void TAO_Notify_Object::adopt_poa | ( | TAO_Notify_POA_Helper * | single | ) | [protected] |
Adopts the supplied poa as all are poas.
Definition at line 36 of file Object.inl.
{ ACE_ASSERT( single != 0 ); this->set_proxy_poa( single ); this->set_object_poa( single ); this->set_poa( single ); // Maintain ownership of the poa }
void TAO_Notify_Object::deactivate | ( | void | ) |
Deactivate.
Definition at line 88 of file Object.cpp.
{ try { this->poa_->deactivate (this->id_); } catch (const CORBA::Exception& ex) { // Do not propagate any exceptions if (TAO_debug_level > 2) { ex._tao_print_exception ("(%P|%t)\n"); ACE_DEBUG ((LM_DEBUG, "Could not deactivate object %d\n", this->id_)); } } }
void TAO_Notify_Object::destroy_object_poa | ( | void | ) | [private] |
Shutdown the current object poa.
Definition at line 172 of file Object.cpp.
{ if (this->object_poa_ != 0) { try { if ( this->object_poa_ == this->proxy_poa_ ) this->proxy_poa_ = 0; if ( this->object_poa_ == this->poa_ ) this->poa_ = 0; if ( this->own_object_poa_ == true ) { this->own_object_poa_ = false; ACE_Auto_Ptr< TAO_Notify_POA_Helper > aop( object_poa_ ); this->object_poa_->destroy (); } this->object_poa_ = 0; } catch (const CORBA::Exception& ex) { if (TAO_debug_level > 2) ex._tao_print_exception ("Proxy shutdown error (%P|%t)\n"); } } }
void TAO_Notify_Object::destroy_poa | ( | void | ) | [private] |
void TAO_Notify_Object::destroy_proxy_poa | ( | void | ) | [private] |
Shutdown the current proxy poa.
Definition at line 146 of file Object.cpp.
{ if (this->proxy_poa_ != 0) { try { if ( this->proxy_poa_ == this->object_poa_ ) this->object_poa_ = 0; if ( this->proxy_poa_ == this->poa_ ) this->poa_ = 0; if ( this->own_proxy_poa_ == true ) { this->own_proxy_poa_ = false; ACE_Auto_Ptr< TAO_Notify_POA_Helper > app( proxy_poa_ ); this->proxy_poa_->destroy (); } this->proxy_poa_ = 0; } catch (const CORBA::Exception& ex) { if (TAO_debug_level > 2) ex._tao_print_exception ("Proxy shutdown error (%P|%t)\n"); } } }
TAO_Notify_Event_Manager & TAO_Notify_Object::event_manager | ( | void | ) |
Accessor for the Event Manager.
Definition at line 84 of file Object.inl.
{ ACE_ASSERT( this->event_manager_.get() != 0 ); return *this->event_manager_; }
void TAO_Notify_Object::execute_task | ( | TAO_Notify_Method_Request & | method_request | ) |
Definition at line 14 of file Object.inl.
{ TAO_Notify_Worker_Task::Ptr task( this->worker_task_ ); if ( task.isSet() ) { task->execute( method_request ); } }
bool TAO_Notify_Object::find_qos_property_value | ( | const char * | name, | |
CosNotification::PropertyValue & | value | |||
) | const |
Definition at line 300 of file Object.cpp.
{ // qos_properties_ is essentially a map and the find() method returns // zero on success. We must convert this to a boolean value. return (this->qos_properties_.find (name, value) == 0); }
CosNotification::QoSProperties * TAO_Notify_Object::get_qos | ( | void | ) |
Get the QoS Properties.
Definition at line 286 of file Object.cpp.
{ CosNotification::QoSProperties_var properties; ACE_NEW_THROW_EX (properties, CosNotification::QoSProperties (), CORBA::NO_MEMORY ()); this->qos_properties_.populate (properties); return properties._retn (); }
TAO_Notify_Worker_Task * TAO_Notify_Object::get_worker_task | ( | void | ) |
Allow access to the underlying worker task.
Definition at line 361 of file Object.cpp.
{ return this->worker_task_.get (); }
bool TAO_Notify_Object::has_shutdown | ( | void | ) |
Have we been shutdown. returns true if shutdown.
Definition at line 71 of file Object.inl.
{ return this->shutdown_; }
CORBA::Long TAO_Notify_Object::id | ( | void | ) | const |
void TAO_Notify_Object::inherit_poas | ( | TAO_Notify_Object & | parent | ) | [protected] |
Uses the poas from the supplied object.
Definition at line 24 of file Object.inl.
{ this->set_proxy_poa( parent.proxy_poa() ); this->set_object_poa( parent.object_poa() ); this->set_poa( parent.poa() ); // Do not take ownership of parent's poas own_proxy_poa_ = false; own_object_poa_ = false; }
void TAO_Notify_Object::initialize | ( | TAO_Notify_Object * | parent | ) | [protected] |
Init this object with data from <rhs>.
Definition at line 46 of file Object.cpp.
{ ACE_ASSERT (parent != 0 && this->event_manager_.get() == 0); // Do not use sets to avoid asserts. // Object must be able to inherit NULL references // due to current design. this->event_manager_ = parent->event_manager_; this->admin_properties_ = parent->admin_properties_; this->inherit_poas( *parent ); this->worker_task_ = parent->worker_task_; // Pass QoS parent->qos_properties_.transfer (this->qos_properties_); this->qos_changed (this->qos_properties_); }
void TAO_Notify_Object::load_attrs | ( | const TAO_Notify::NVPList & | attrs | ) | [virtual] |
Load our attributes. Each derived type should call the superclass load first before loading its own attributes.
Definition at line 348 of file Object.cpp.
{ attrs.load (this->qos_properties_.event_reliability ()); attrs.load (this->qos_properties_.connection_reliability ()); attrs.load (this->qos_properties_.priority ()); attrs.load (this->qos_properties_.timeout ()); attrs.load (this->qos_properties_.stop_time_supported ()); attrs.load (this->qos_properties_.maximum_batch_size ()); attrs.load (this->qos_properties_.pacing_interval ()); this->qos_properties_.init (); }
TAO_Notify_POA_Helper * TAO_Notify_Object::object_poa | ( | void | ) | [protected] |
Accessor for the object_poa_.
Definition at line 59 of file Object.inl.
{ return this->object_poa_; }
TAO_Notify_POA_Helper * TAO_Notify_Object::poa | ( | void | ) | [protected] |
TAO_Notify_POA_Helper * TAO_Notify_Object::proxy_poa | ( | void | ) | [protected] |
void TAO_Notify_Object::qos_changed | ( | const TAO_Notify_QoSProperties & | qos_properties | ) | [protected, virtual] |
Notification that can be overridden by subclasses to be informed that <qos_properties_> have been modified.
Definition at line 311 of file Object.cpp.
{
// NOP.
}
CORBA::Object_ptr TAO_Notify_Object::ref | ( | void | ) |
Get CORBA Ref.
Definition at line 125 of file Object.cpp.
{ return this->poa_->id_to_reference (this->id_); }
void TAO_Notify_Object::save_attrs | ( | TAO_Notify::NVPList & | attrs | ) | [protected, virtual] |
Called by derived types to save their attributes. Each derived type should call its superclass version before saving its own attrs.
Definition at line 336 of file Object.cpp.
{ add_qos_attr(attrs, this->qos_properties_.event_reliability ()); add_qos_attr(attrs, this->qos_properties_.connection_reliability ()); add_qos_attr(attrs, this->qos_properties_.priority ()); add_qos_attr(attrs, this->qos_properties_.timeout ()); add_qos_attr(attrs, this->qos_properties_.stop_time_supported ()); add_qos_attr(attrs, this->qos_properties_.maximum_batch_size ()); add_qos_attr(attrs, this->qos_properties_.pacing_interval ()); }
void TAO_Notify_Object::set_admin_properties | ( | TAO_Notify_AdminProperties * | admin_properties | ) | [protected] |
Definition at line 77 of file Object.inl.
{ ACE_ASSERT( admin_properties != 0 ); this->admin_properties_.reset( admin_properties ); }
void TAO_Notify_Object::set_event_manager | ( | TAO_Notify_Event_Manager * | event_manager | ) | [protected] |
Definition at line 64 of file Object.cpp.
{ ACE_ASSERT( event_manager != 0 ); this->event_manager_.reset( event_manager ); }
void TAO_Notify_Object::set_object_poa | ( | TAO_Notify_POA_Helper * | object_poa | ) | [private] |
Setting the object_poa_ gives ownership to this class.
Definition at line 228 of file Object.cpp.
{ // shutdown current object poa. this->destroy_object_poa (); this->object_poa_ = object_poa; this->own_object_poa_ = true; }
void TAO_Notify_Object::set_poa | ( | TAO_Notify_POA_Helper * | object_poa | ) | [private] |
Setting the object_poa_ gives ownership to this class.
Definition at line 239 of file Object.cpp.
{ this->poa_ = poa; }
void TAO_Notify_Object::set_primary_as_proxy_poa | ( | ) | [protected] |
Changes the primary poa to the current proxy poa.
Definition at line 47 of file Object.inl.
void TAO_Notify_Object::set_proxy_poa | ( | TAO_Notify_POA_Helper * | proxy_poa | ) | [private] |
Setting the proxy_poa_ gives ownership to this class.
Definition at line 217 of file Object.cpp.
{ // shutdown current proxy poa. this->destroy_proxy_poa (); this->proxy_poa_ = proxy_poa; this->own_proxy_poa_ = true; }
void TAO_Notify_Object::set_qos | ( | const CosNotification::QoSProperties & | qos | ) | [virtual] |
Set the QoS Properties.
Definition at line 245 of file Object.cpp.
{ CosNotification::PropertyErrorSeq err_seq; TAO_Notify_QoSProperties new_qos_properties; if (new_qos_properties.init (qos, err_seq) == -1) throw CORBA::INTERNAL (); // Apply the appropriate concurrency QoS if (new_qos_properties.thread_pool ().is_valid ()) { if (new_qos_properties.thread_pool ().value ().static_threads == 0) { TAO_Notify_PROPERTIES::instance()->builder()->apply_reactive_concurrency (*this); } else { TAO_Notify_PROPERTIES::instance()->builder()-> apply_thread_pool_concurrency (*this, new_qos_properties.thread_pool ().value ()); } } else if (new_qos_properties.thread_pool_lane ().is_valid ()) TAO_Notify_PROPERTIES::instance()->builder()-> apply_lane_concurrency (*this, new_qos_properties.thread_pool_lane ().value ()); // Update the Thread Task's QoS properties.. this->worker_task_->update_qos_properties (new_qos_properties); // Inform subclasses of QoS changed. this->qos_changed (new_qos_properties); // Init the the overall QoS on this object. if (new_qos_properties.copy (this->qos_properties_) == -1) throw CORBA::INTERNAL (); if (err_seq.length () > 0) // Unsupported Property throw CosNotification::UnsupportedQoS (err_seq); }
void TAO_Notify_Object::set_worker_task | ( | TAO_Notify_Worker_Task * | worker_task | ) | [private] |
Set Worker Task. This object assume ownership of the set object.
Definition at line 204 of file Object.cpp.
{ ACE_ASSERT( worker_task != 0 ); // shutdown the current worker. this->shutdown_worker_task (); this->worker_task_.reset (worker_task); this->own_worker_task_ = true; }
int TAO_Notify_Object::shutdown | ( | void | ) | [virtual] |
Shutdown. Returns 1 if the shutdown was already run once before.
Definition at line 106 of file Object.cpp.
{ { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 1); if (this->shutdown_ == 1) return 1; // Another thread has already run shutdown. this->shutdown_ = 1; } this->deactivate (); this->shutdown_worker_task (); return 0; }
void TAO_Notify_Object::shutdown_worker_task | ( | void | ) | [private] |
Shutdown the current worker task and delete it if we own it.
Definition at line 131 of file Object.cpp.
{ // Only do this if we are the owner. TAO_Notify_Worker_Task::Ptr task( this->worker_task_ ); this->worker_task_.reset(); if ( task.isSet() ) { if ( this->own_worker_task_ ) { task->shutdown (); } } }
TAO_Notify_Timer * TAO_Notify_Object::timer | ( | void | ) | [virtual] |
Obtain the Timer manager associated with this object.
Definition at line 317 of file Object.cpp.
{ ACE_ASSERT (worker_task_.get() != 0); return this->worker_task_->timer (); }
friend class TAO_Notify_Builder [friend] |
friend class TAO_Notify_RT_Builder [friend] |
TAO_Notify_Refcountable_Guard_T< TAO_Notify_Event_Manager > TAO_Notify_Object::event_manager_ [private] |
The event manager. TAO_Notify_Event_Manager inl includes Object.h
ID TAO_Notify_Object::id_ [private] |
TAO_SYNCH_MUTEX TAO_Notify_Object::lock_ [protected] |
bool TAO_Notify_Object::own_object_poa_ [private] |
bool TAO_Notify_Object::own_proxy_poa_ [private] |
bool TAO_Notify_Object::own_worker_task_ [private] |
TAO_Notify_POA_Helper* TAO_Notify_Object::poa_ [private] |
bool TAO_Notify_Object::shutdown_ [private] |