POA_Helper.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file POA_Helper.h
00005  *
00006  *  $Id: POA_Helper.h 79247 2007-08-07 15:24:22Z elliott_c $
00007  *
00008  *  @author Pradeep Gore <pradeep@oomworks.com>
00009  */
00010 
00011 #ifndef TAO_Notify_POA_Helper_H
00012 #define TAO_Notify_POA_Helper_H
00013 
00014 #include /**/ "ace/pre.h"
00015 
00016 #include "orbsvcs/Notify/notify_serv_export.h"
00017 
00018 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00019 # pragma once
00020 #endif /* ACE_LACKS_PRAGMA_ONCE */
00021 
00022 #include "orbsvcs/Notify/ID_Factory.h"
00023 
00024 #include "tao/PortableServer/PortableServer.h"
00025 
00026 #include "ace/Copy_Disabled.h"
00027 
00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00029 
00030 /**
00031  * @class TAO_Notify_POA_Helper
00032  *
00033  * @brief POA Abstraction.
00034  *
00035  */
00036 class TAO_Notify_Serv_Export TAO_Notify_POA_Helper : private ACE_Copy_Disabled
00037 {
00038 public:
00039   /// Default Constructor
00040   TAO_Notify_POA_Helper (void);
00041 
00042   /// Create a new PortableServer::POA.
00043   void init (PortableServer::POA_ptr parent_poa,
00044              const char* poa_name);
00045 
00046 #if !defined (CORBA_E_MICRO)
00047   /// Create a new persistent PortableServer::POA.
00048   void init_persistent (PortableServer::POA_ptr parent_poa,
00049                         const char* poa_name);
00050 #endif /* !CORBA_E_MICRO */
00051 
00052   /// Create a new PortableServer::POA. The name is chosen at random.
00053   void init (PortableServer::POA_ptr parent_poa);
00054 
00055   /// Destructor
00056   virtual ~TAO_Notify_POA_Helper ();
00057 
00058   /// Get underlying POA
00059   PortableServer::POA_ptr poa (void);
00060 
00061   /// Destroy underlying POA.
00062   void destroy (void);
00063 
00064   /// Activate Object, the POA will assign an ID and return its value.
00065   CORBA::Object_ptr activate (PortableServer::Servant servant,
00066                               CORBA::Long& id);
00067 
00068   /// Activate Object, using existing ID
00069   CORBA::Object_ptr activate_with_id (PortableServer::Servant servant, CORBA::Long id);
00070 
00071   /// Deactivate Object with ID
00072   void deactivate (CORBA::Long id) const;
00073 
00074   /// Convert ID to reference.
00075   CORBA::Object_ptr id_to_reference (CORBA::Long id) const;
00076 
00077   /// Convert reference to pointer to servant
00078   PortableServer::ServantBase * reference_to_servant (CORBA::Object_ptr ptr) const;
00079 
00080   CORBA::Object_ptr servant_to_reference (PortableServer::ServantBase * servant) const;
00081 
00082   /// Generate a unique id for each POA created.
00083   ACE_CString get_unique_id (void);
00084 
00085 protected:
00086   /// Set default POA policies.
00087   virtual void set_policy (PortableServer::POA_ptr parent_poa,
00088                            CORBA::PolicyList &policy_list);
00089 
00090 #if !defined (CORBA_E_MICRO)
00091   /// Set persistent POA policies.
00092   virtual void set_persistent_policy (PortableServer::POA_ptr parent_poa,
00093                                       CORBA::PolicyList &policy_list);
00094 #endif /* !CORBA_E_MICRO */
00095 
00096   /// Apply the polices and create child POA.
00097   void create_i (PortableServer::POA_ptr parent_poa,
00098                  const char* poa_name,
00099                  CORBA::PolicyList &policy_list);
00100 
00101   /// Convert id to ObjectID
00102   PortableServer::ObjectId* long_to_ObjectId (CORBA::Long id) const;
00103 
00104 protected:
00105   /// POA
00106   PortableServer::POA_var poa_;
00107 
00108   /// ID Factory for objects.
00109   TAO_Notify_ID_Factory id_factory_;
00110 };
00111 
00112 TAO_END_VERSIONED_NAMESPACE_DECL
00113 
00114 #if defined (__ACE_INLINE__)
00115 #include "orbsvcs/Notify/POA_Helper.inl"
00116 #endif /* __ACE_INLINE__ */
00117 
00118 #include /**/ "ace/post.h"
00119 
00120 #endif /* TAO_Notify_POA_Helper_H */

Generated on Sun Jan 27 15:39:57 2008 for TAO_CosNotification by doxygen 1.3.6