ORB-specific PortableInterceptor::PolicyFactory registry. More...
#include <PolicyFactory_Registry.h>
Public Types | |
typedef ACE_Map_Manager < CORBA::PolicyType, PortableInterceptor::PolicyFactory_ptr, ACE_Null_Mutex > | TABLE |
Public Member Functions | |
TAO_PolicyFactory_Registry (void) | |
Constructor. | |
~TAO_PolicyFactory_Registry (void) | |
Destructor. Releases duplicated PolicyFactory references. | |
void | register_policy_factory (CORBA::PolicyType type, PortableInterceptor::PolicyFactory_ptr policy_factory) |
CORBA::Policy_ptr | create_policy (CORBA::PolicyType type, const CORBA::Any &value) |
CORBA::Policy_ptr | _create_policy (CORBA::PolicyType type) |
bool | factory_exists (CORBA::PolicyType &type) const |
Private Attributes | |
TABLE | factories_ |
The table that maps policy type to policy factory. |
ORB-specific PortableInterceptor::PolicyFactory registry.
ORB-specific registry that contains all portable interceptor policy factories.
Definition at line 40 of file PolicyFactory_Registry.h.
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.
Definition at line 57 of file PolicyFactory_Registry.h.
TAO_PolicyFactory_Registry::TAO_PolicyFactory_Registry | ( | void | ) |
Constructor.
Definition at line 16 of file PolicyFactory_Registry.cpp.
TAO_PolicyFactory_Registry::~TAO_PolicyFactory_Registry | ( | void | ) |
Destructor. Releases duplicated PolicyFactory references.
Definition at line 21 of file PolicyFactory_Registry.cpp.
{ const TABLE::iterator end (this->factories_.end ()); for (TABLE::iterator i = this->factories_.begin (); i != end; ++i) { ::CORBA::release ((*i).int_id_); } this->factories_.close (); }
CORBA::Policy_ptr TAO_PolicyFactory_Registry::_create_policy | ( | CORBA::PolicyType | type | ) |
Create an empty policy, usually to be filled in later by demarshaling.
Definition at line 89 of file PolicyFactory_Registry.cpp.
{ PortableInterceptor::PolicyFactory_ptr policy_factory = PortableInterceptor::PolicyFactory::_nil (); if (this->factories_.find (type, policy_factory) == -1) { // Policy factory corresponding to given policy type does not // exist in policy factory map. throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE); } return policy_factory->_create_policy (type); }
CORBA::Policy_ptr TAO_PolicyFactory_Registry::create_policy | ( | CORBA::PolicyType | type, | |
const CORBA::Any & | value | |||
) |
Construct a policy of the given type with the information contained in the CORBA::Any value.
Definition at line 72 of file PolicyFactory_Registry.cpp.
{ PortableInterceptor::PolicyFactory_ptr policy_factory = PortableInterceptor::PolicyFactory::_nil (); if (this->factories_.find (type, policy_factory) == -1) { // Policy factory corresponding to given policy type does not // exist in policy factory map. throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE); } return policy_factory->create_policy (type, value); }
bool TAO_PolicyFactory_Registry::factory_exists | ( | CORBA::PolicyType & | type | ) | const |
Check if a PolicyFactory
corresponding to the given type, exists.
Definition at line 105 of file PolicyFactory_Registry.cpp.
{ return (this->factories_.find (type) == 0); }
void TAO_PolicyFactory_Registry::register_policy_factory | ( | CORBA::PolicyType | type, | |
PortableInterceptor::PolicyFactory_ptr | policy_factory | |||
) |
Register a PolicyFactory with the underlying PolicyFactory sequence. This method should only be called during ORB initialization.
Definition at line 34 of file PolicyFactory_Registry.cpp.
{ if (CORBA::is_nil (policy_factory)) { throw ::CORBA::BAD_PARAM ( CORBA::SystemException::_tao_minor_code ( 0, EINVAL), CORBA::COMPLETED_NO); } PortableInterceptor::PolicyFactory_ptr factory = PortableInterceptor::PolicyFactory::_duplicate (policy_factory); const int result = this->factories_.bind (type, factory); if (result != 0) { // Release the duplicated factory to prevent a memory leak ::CORBA::release (factory); if (result == 1) { // PolicyFactory of given type already exists. throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 16, CORBA::COMPLETED_NO); } else { // Could not add PolicyFactory due to internal bind failures. throw ::CORBA::INTERNAL (); } } }
TABLE TAO_PolicyFactory_Registry::factories_ [private] |
The table that maps policy type to policy factory.
Definition at line 90 of file PolicyFactory_Registry.h.