Object.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file Object.h
00005  *
00006  *  Object.h,v 1.23 2006/03/14 06:14:34 jtc Exp
00007  *
00008  *  @author Pradeep Gore <pradeep@oomworks.com>
00009  *
00010  *
00011  */
00012 
00013 #ifndef TAO_Notify_OBJECT_H
00014 #define TAO_Notify_OBJECT_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "orbsvcs/Notify/notify_serv_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "orbsvcs/Notify/QoSProperties.h"
00025 #include "orbsvcs/Notify/AdminProperties.h"
00026 #include "orbsvcs/Notify/Worker_Task.h"
00027 #include "orbsvcs/Notify/Refcountable.h"
00028 #include "orbsvcs/Notify/Name_Value_Pair.h"
00029 #include "orbsvcs/Notify/Event_Manager.h"
00030 
00031 #include "orbsvcs/NotifyExtC.h"
00032 
00033 #include "tao/PortableServer/Servant_Base.h"
00034 
00035 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00036 
00037 class TAO_Notify_POA_Helper;
00038 class TAO_Notify_Timer;
00039 class TAO_Notify_RT_Builder;
00040 
00041 /**
00042  * @class TAO_Notify_Object
00043  *
00044  * @brief Base Object for RT_Notify's CORBA Objects.
00045  *
00046  */
00047 class TAO_Notify_Serv_Export TAO_Notify_Object : public TAO_Notify_Refcountable
00048 {
00049   friend class TAO_Notify_Builder;
00050   friend class TAO_Notify_RT_Builder;
00051 
00052 public:
00053   /// Id for Objects.
00054   typedef CORBA::Long ID;
00055 
00056   /// Destructor
00057   virtual ~TAO_Notify_Object (void);
00058 
00059   /// This Object's ID
00060   ID id (void) const;
00061 
00062   /// Activate
00063   virtual CORBA::Object_ptr activate (PortableServer::Servant servant ACE_ENV_ARG_DECL);
00064 
00065   /// Activate with existing id
00066   virtual CORBA::Object_ptr activate (
00067       PortableServer::Servant servant,
00068       CORBA::Long id
00069       ACE_ENV_ARG_DECL);
00070 
00071   /// Deactivate
00072   void deactivate (ACE_ENV_SINGLE_ARG_DECL);
00073 
00074   /// Have we been shutdown. returns 1 if shutdown.
00075   int has_shutdown (void);
00076 
00077   void execute_task (TAO_Notify_Method_Request& method_request ACE_ENV_ARG_DECL);
00078 
00079   /// Get CORBA Ref.
00080   CORBA::Object_ptr ref (ACE_ENV_SINGLE_ARG_DECL);
00081 
00082   /// Set the QoS Properties.
00083   virtual void set_qos (const CosNotification::QoSProperties & qos ACE_ENV_ARG_DECL);
00084 
00085   /// Get the QoS Properties.
00086   CosNotification::QoSProperties* get_qos (ACE_ENV_SINGLE_ARG_DECL);
00087 
00088   bool find_qos_property_value (
00089     const char * name,
00090     CosNotification::PropertyValue & value)const;
00091 
00092   /// Obtain the Timer manager associated with this object.
00093   virtual TAO_Notify_Timer* timer (void);
00094 
00095   /// Accessor for the Event Manager
00096   TAO_Notify_Event_Manager& event_manager (void);
00097 
00098   /// shutdown. Returns 1 ifif the shutdown was already run once before.
00099   virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL);
00100 
00101   /// Load our attributes. Each derived type should call the superclass
00102   /// load first before loading its own attributes.
00103   virtual void load_attrs(const TAO_Notify::NVPList& attrs);
00104 
00105 protected:
00106   /// Constructor
00107   TAO_Notify_Object (void);
00108 
00109   /// Init this object with data from <rhs>.
00110   void initialize (TAO_Notify_Object* parent);
00111 
00112   /// Uses the poas from the supplied object
00113   void inherit_poas (TAO_Notify_Object& parent);
00114 
00115   /// Adopts the supplied poa as all are poas
00116   void adopt_poa (TAO_Notify_POA_Helper* single);
00117 
00118   /// Changes the primary poa to the current proxy poa
00119   void set_primary_as_proxy_poa();
00120  
00121   /// Accessor for the proxy_poa_
00122   TAO_Notify_POA_Helper* proxy_poa (void);
00123 
00124   /// Accessor for the object_poa_
00125   TAO_Notify_POA_Helper* object_poa (void);
00126 
00127   /// Get the POA assigned to us.
00128   TAO_Notify_POA_Helper* poa (void);
00129 
00130   // Sets the admin properties
00131   void set_event_manager( TAO_Notify_Event_Manager* event_manager );
00132 
00133   // Sets the admin properties
00134   void set_admin_properties( TAO_Notify_AdminProperties* admin_properties );
00135 
00136   /// Accessor for the Admin Properties
00137   TAO_Notify_AdminProperties& admin_properties (void);
00138 
00139   /// Notification that can be overridden by subclasses to be informed that <qos_properties_> have been modified.
00140   virtual void qos_changed (const TAO_Notify_QoSProperties& qos_properties);
00141 
00142   /// Called by derived types to save their attributes. Each
00143   /// derived type should call its superclass version before
00144   /// saving its own attrs.
00145   virtual void save_attrs(TAO_Notify::NVPList& attrs);
00146 
00147   ///= Protected data members.
00148 
00149   /// QoS Properties.
00150   TAO_Notify_QoSProperties qos_properties_;
00151 
00152 private:
00153   /// Set Worker Task. This object assume ownership of the set object.
00154   void set_worker_task (TAO_Notify_Worker_Task* worker_task);
00155 
00156   /// Setting the proxy_poa_ gives ownership to this class.
00157   void set_proxy_poa (TAO_Notify_POA_Helper* proxy_poa);
00158 
00159   /// Setting the object_poa_ gives ownership to this class.
00160   void set_object_poa (TAO_Notify_POA_Helper* object_poa);
00161 
00162   /// Setting the object_poa_ gives ownership to this class.
00163   void set_poa (TAO_Notify_POA_Helper* object_poa);
00164 
00165   /// Shutdown the current worker task and delete it if we own it.
00166   void shutdown_worker_task (void);
00167 
00168   /// Shutdown the current proxy poa.
00169   void destroy_proxy_poa (void);
00170 
00171   /// Shutdown the current object poa.
00172   void destroy_object_poa (void);
00173 
00174   /// Shutdown the current poa.
00175   void destroy_poa (void);
00176 
00177 protected:
00178 
00179   /// The mutex to serialize access to state variables.
00180   TAO_SYNCH_MUTEX lock_;
00181 
00182 private:
00183 
00184   /// The POA in which the object is activated.
00185   TAO_Notify_POA_Helper* poa_;
00186 
00187   /// The POA in which the proxys are activated.
00188   TAO_Notify_POA_Helper* proxy_poa_;
00189   bool own_proxy_poa_;
00190 
00191   /// The POA in which the object's children are activated.
00192   TAO_Notify_POA_Helper* object_poa_;
00193   bool own_object_poa_;
00194 
00195   /// Id assigned to this object
00196   ID id_;
00197 
00198   /// The event manager.
00199   //TAO_Notify_Event_Manager inl includes Object.h
00200   TAO_Notify_Refcountable_Guard_T< TAO_Notify_Event_Manager > event_manager_;
00201 
00202   /// Admin Properties.
00203   TAO_Notify_AdminProperties::Ptr admin_properties_;
00204 
00205   /// Worker Task.
00206   TAO_Notify_Worker_Task::Ptr worker_task_;
00207   bool own_worker_task_;
00208 
00209   /// Are we shutdown (i,e. scheduled for destroy).
00210   bool shutdown_;
00211 };
00212 
00213 TAO_END_VERSIONED_NAMESPACE_DECL
00214 
00215 #if defined (__ACE_INLINE__)
00216 #include "orbsvcs/Notify/Object.inl"
00217 #endif /* __ACE_INLINE__ */
00218 
00219 #include /**/ "ace/post.h"
00220 
00221 #endif /* TAO_Notify_OBJECT_H */

Generated on Thu Nov 9 13:24:12 2006 for TAO_CosNotification by doxygen 1.3.6