Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TAO_PolicyFactory_Registry Class Reference

ORB-specific registry. More...

#include <PolicyFactory_Registry.h>

Collaboration diagram for TAO_PolicyFactory_Registry:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Map_Manager< CORBA::PolicyType,
PortableInterceptor::PolicyFactory_ptr,
ACE_Null_Mutex
TABLE

Public Methods

 TAO_PolicyFactory_Registry (void)
 Constructor. More...

 ~TAO_PolicyFactory_Registry (void)
 Destructor. Releases duplicated PolicyFactory references. More...

void register_policy_factory (CORBA::PolicyType type, PortableInterceptor::PolicyFactory_ptr policy_factory ACE_ENV_ARG_DECL)
 Register a PolicyFactory with the underlying PolicyFactory sequence. This method should only be called during ORB initialization. More...

CORBA::Policy_ptr create_policy (CORBA::PolicyType type, const CORBA::Any &value ACE_ENV_ARG_DECL) throw (CORBA::SystemException, CORBA::PolicyError)
 Construct a policy of the given type with the information contained in the CORBA::Any <value>. More...

CORBA::Policy_ptr _create_policy (CORBA::PolicyType type ACE_ENV_ARG_DECL) throw (CORBA::SystemException, CORBA::PolicyError)
 Create an empty policy, usually to be filled in later by demarshaling. More...


Private Attributes

TABLE factories_
 The table that maps policy type to policy factory. More...


Detailed Description

ORB-specific registry.

ORB-specific registry that contains all portable interceptor policy factories.

Definition at line 38 of file PolicyFactory_Registry.h.


Member Typedef Documentation

typedef ACE_Map_Manager< CORBA::PolicyType, PortableInterceptor::PolicyFactory_ptr, ACE_Null_Mutex> TAO_PolicyFactory_Registry::TABLE
 

The type of table that maps policy type to policy factory.

Note:
An ACE_Null_Mutex is used for this type since policy factories are only registered when CORBA::ORB_init() is called, at which a point a lock has already been acquired. In short, the table is only modified during ORB bootstrap-time.

Definition at line 54 of file PolicyFactory_Registry.h.


Constructor & Destructor Documentation

TAO_PolicyFactory_Registry::TAO_PolicyFactory_Registry void   
 

Constructor.

Definition at line 11 of file PolicyFactory_Registry.cpp.

References TAO_DEFAULT_POLICY_FACTORY_REGISTRY_SIZE.

TAO_PolicyFactory_Registry::~TAO_PolicyFactory_Registry void   
 

Destructor. Releases duplicated PolicyFactory references.

Definition at line 16 of file PolicyFactory_Registry.cpp.

References ACE_Map_Manager< CORBA::PolicyType, PortableInterceptor::PolicyFactory_ptr, ACE_Null_Mutex >::begin, ACE_Map_Manager< CORBA::PolicyType, PortableInterceptor::PolicyFactory_ptr, ACE_Null_Mutex >::close, ACE_Map_Manager< CORBA::PolicyType, PortableInterceptor::PolicyFactory_ptr, ACE_Null_Mutex >::end, factories_, and CORBA::release.

00017 {
00018   TABLE::ITERATOR end = this->factories_.end ();
00019 
00020   for (TABLE::ITERATOR i = this->factories_.begin (); i != end; ++i)
00021     CORBA::release ((*i).int_id_);
00022 
00023   this->factories_.close ();
00024 }


Member Function Documentation

CORBA::Policy_ptr TAO_PolicyFactory_Registry::_create_policy CORBA::PolicyType type    ACE_ENV_ARG_DECL throw (CORBA::SystemException, CORBA::PolicyError)
 

Create an empty policy, usually to be filled in later by demarshaling.

Definition at line 85 of file PolicyFactory_Registry.cpp.

References CORBA::Policy::_nil, PortableInterceptor::PolicyFactory::_nil, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, and ACE_THROW_RETURN.

00089 {
00090   PortableInterceptor::PolicyFactory_ptr policy_factory =
00091     PortableInterceptor::PolicyFactory::_nil ();
00092 
00093   if (this->factories_.find (type,
00094                              policy_factory) == -1)
00095     {
00096       // Policy factory corresponding to given policy type does not
00097       // exist in policy factory map.
00098       ACE_THROW_RETURN (
00099          CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),  // @@ Right exception?
00100          CORBA::Policy::_nil ());
00101     }
00102 
00103   return policy_factory->_create_policy (type
00104                                          ACE_ENV_ARG_PARAMETER);
00105 }

CORBA::Policy_ptr TAO_PolicyFactory_Registry::create_policy CORBA::PolicyType    type,
const CORBA::Any &value    ACE_ENV_ARG_DECL
throw (CORBA::SystemException, CORBA::PolicyError)
 

Construct a policy of the given type with the information contained in the CORBA::Any <value>.

Definition at line 60 of file PolicyFactory_Registry.cpp.

References CORBA::Policy::_nil, PortableInterceptor::PolicyFactory::_nil, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, and ACE_THROW_RETURN.

00065 {
00066   PortableInterceptor::PolicyFactory_ptr policy_factory =
00067     PortableInterceptor::PolicyFactory::_nil ();
00068 
00069   if (this->factories_.find (type,
00070                              policy_factory) == -1)
00071     {
00072       // Policy factory corresponding to given policy type does not
00073       // exist in policy factory map.
00074       ACE_THROW_RETURN (
00075          CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),  // @@ Right exception?
00076          CORBA::Policy::_nil ());
00077     }
00078 
00079   return policy_factory->create_policy (type,
00080                                         value
00081                                         ACE_ENV_ARG_PARAMETER);
00082 }

void TAO_PolicyFactory_Registry::register_policy_factory CORBA::PolicyType    type,
PortableInterceptor::PolicyFactory_ptr policy_factory    ACE_ENV_ARG_DECL
 

Register a PolicyFactory with the underlying PolicyFactory sequence. This method should only be called during ORB initialization.

Definition at line 27 of file PolicyFactory_Registry.cpp.

References PortableInterceptor::PolicyFactory::_duplicate, CORBA_SystemException::_tao_minor_code, ACE_ENV_ARG_DECL, ACE_THROW, ACE_Map_Manager< CORBA::PolicyType, PortableInterceptor::PolicyFactory_ptr, ACE_Null_Mutex >::bind, factories_, CORBA::is_nil, and TAO_DEFAULT_MINOR_CODE.

Referenced by TAO_ORBInitInfo::register_policy_factory.

00031 {
00032   if (CORBA::is_nil (policy_factory))
00033     ACE_THROW (CORBA::BAD_PARAM (
00034                  CORBA_SystemException::_tao_minor_code (
00035                    TAO_DEFAULT_MINOR_CODE,
00036                    EINVAL),
00037                  CORBA::COMPLETED_NO));
00038 
00039   PortableInterceptor::PolicyFactory_ptr factory =
00040     PortableInterceptor::PolicyFactory::_duplicate (policy_factory);
00041 
00042   int result = this->factories_.bind (type,
00043                                       factory);
00044 
00045   if (result == 1)
00046     {
00047       // PolicyFactory of given type already exists.
00048 
00049       ACE_THROW (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 16,
00050                                        CORBA::COMPLETED_NO));
00051     }
00052   else if (result == -1)
00053     {
00054       // Could not add PolicyFactory due to internal bind failures.
00055       ACE_THROW (CORBA::INTERNAL ());
00056     }
00057 }


Member Data Documentation

TABLE TAO_PolicyFactory_Registry::factories_ [private]
 

The table that maps policy type to policy factory.

Definition at line 90 of file PolicyFactory_Registry.h.

Referenced by register_policy_factory, and ~TAO_PolicyFactory_Registry.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:36:52 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002