#include <PolicyFactory_Registry.h>
Inheritance diagram for TAO_PolicyFactory_Registry:


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 registry that contains all portable interceptor policy factories.
Definition at line 40 of file PolicyFactory_Registry.h.
|
|
The type of table that maps policy type to policy factory.
Definition at line 57 of file PolicyFactory_Registry.h. |
|
|
Constructor.
Definition at line 16 of file PolicyFactory_Registry.cpp. References TAO_DEFAULT_POLICY_FACTORY_REGISTRY_SIZE.
00017 : factories_ (TAO_DEFAULT_POLICY_FACTORY_REGISTRY_SIZE) 00018 { 00019 } |
|
|
Destructor. Releases duplicated PolicyFactory references.
Definition at line 21 of file PolicyFactory_Registry.cpp. References factories_.
00022 {
00023 const TABLE::iterator end (this->factories_.end ());
00024
00025 for (TABLE::iterator i = this->factories_.begin (); i != end; ++i)
00026 {
00027 ::CORBA::release ((*i).int_id_);
00028 }
00029
00030 this->factories_.close ();
00031 }
|
|
|
Create an empty policy, usually to be filled in later by demarshaling. Implements TAO::PolicyFactory_Registry_Adapter. Definition at line 89 of file PolicyFactory_Registry.cpp. References PortableInterceptor::PolicyFactory::_nil(), and factories_.
00090 {
00091 PortableInterceptor::PolicyFactory_ptr policy_factory =
00092 PortableInterceptor::PolicyFactory::_nil ();
00093
00094 if (this->factories_.find (type, policy_factory) == -1)
00095 {
00096 // Policy factory corresponding to given policy type does not
00097 // exist in policy factory map.
00098 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
00099 }
00100
00101 return policy_factory->_create_policy (type);
00102 }
|
|
||||||||||||
|
Construct a policy of the given type with the information contained in the CORBA::Any value. Implements TAO::PolicyFactory_Registry_Adapter. Definition at line 72 of file PolicyFactory_Registry.cpp. References PortableInterceptor::PolicyFactory::_nil(), and factories_.
00074 {
00075 PortableInterceptor::PolicyFactory_ptr policy_factory =
00076 PortableInterceptor::PolicyFactory::_nil ();
00077
00078 if (this->factories_.find (type, policy_factory) == -1)
00079 {
00080 // Policy factory corresponding to given policy type does not
00081 // exist in policy factory map.
00082 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_TYPE);
00083 }
00084
00085 return policy_factory->create_policy (type, value);
00086 }
|
|
|
Check if a Implements TAO::PolicyFactory_Registry_Adapter. Definition at line 105 of file PolicyFactory_Registry.cpp. References factories_.
00106 {
00107 return (this->factories_.find (type) == 0);
00108 }
|
|
||||||||||||
|
Register a PolicyFactory with the underlying PolicyFactory sequence. This method should only be called during ORB initialization. Implements TAO::PolicyFactory_Registry_Adapter. Definition at line 34 of file PolicyFactory_Registry.cpp. References PortableInterceptor::PolicyFactory::_duplicate(), factories_, and CORBA::is_nil().
00037 {
00038 if (CORBA::is_nil (policy_factory))
00039 {
00040 throw ::CORBA::BAD_PARAM (
00041 CORBA::SystemException::_tao_minor_code (
00042 0,
00043 EINVAL),
00044 CORBA::COMPLETED_NO);
00045 }
00046
00047 PortableInterceptor::PolicyFactory_ptr factory =
00048 PortableInterceptor::PolicyFactory::_duplicate (policy_factory);
00049
00050 const int result = this->factories_.bind (type, factory);
00051
00052 if (result != 0)
00053 {
00054 // Release the duplicated factory to prevent a memory leak
00055 ::CORBA::release (factory);
00056
00057 if (result == 1)
00058 {
00059 // PolicyFactory of given type already exists.
00060 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 16,
00061 CORBA::COMPLETED_NO);
00062 }
00063 else
00064 {
00065 // Could not add PolicyFactory due to internal bind failures.
00066 throw ::CORBA::INTERNAL ();
00067 }
00068 }
00069 }
|
|
|
The table that maps policy type to policy factory.
Definition at line 90 of file PolicyFactory_Registry.h. Referenced by _create_policy(), create_policy(), factory_exists(), register_policy_factory(), and ~TAO_PolicyFactory_Registry(). |
1.3.6