#include <POAManagerFactory.h>


Public Member Functions | |
| TAO_POAManager_Factory (TAO_Object_Adapter &object_adapter) | |
| virtual | ~TAO_POAManager_Factory (void) |
| virtual ::PortableServer::POAManager_ptr | create_POAManager (const char *id, const ::CORBA::PolicyList &policies) |
| virtual ::PortableServer::POAManagerFactory::POAManagerSeq * | list (void) |
| virtual ::PortableServer::POAManager_ptr | find (const char *id) |
| void | remove_all_poamanagers (void) |
| int | remove_poamanager (::PortableServer::POAManager_ptr poamanager) |
| int | register_poamanager (::PortableServer::POAManager_ptr poamanager) |
Private Types | |
| typedef ACE_Unbounded_Set < ::PortableServer::POAManager_ptr > | POAMANAGERSET |
Private Attributes | |
| TAO_Object_Adapter & | object_adapter_ |
| POAMANAGERSET | poamanager_set_ |
Definition at line 41 of file POAManagerFactory.h.
typedef ACE_Unbounded_Set< ::PortableServer::POAManager_ptr> TAO_POAManager_Factory::POAMANAGERSET [private] |
Definition at line 67 of file POAManagerFactory.h.
| TAO_POAManager_Factory::TAO_POAManager_Factory | ( | TAO_Object_Adapter & | object_adapter | ) |
Definition at line 17 of file POAManagerFactory.cpp.
: object_adapter_ (object_adapter) { }
| TAO_POAManager_Factory::~TAO_POAManager_Factory | ( | void | ) | [virtual] |
Definition at line 22 of file POAManagerFactory.cpp.
{
this->remove_all_poamanagers ();
}
| PortableServer::POAManager_ptr TAO_POAManager_Factory::create_POAManager | ( | const char * | id, | |
| const ::CORBA::PolicyList & | policies | |||
| ) |
Definition at line 28 of file POAManagerFactory.cpp.
{
// Validate the policy.
TAO_POA_Policy_Set tao_policies (TAO_POA_Policy_Set (this->object_adapter_.default_poa_policies ()));
// Merge policies from the ORB level.
this->object_adapter_.validator ().merge_policies (tao_policies.policies ());
// Merge in any policies that the user may have specified.
tao_policies.merge_policies (policies);
// If any of the policy objects specified are not valid for the ORB
// implementation, if conflicting policy objects are specified, or
// if any of the specified policy objects require prior
// administrative action that has not been performed, an
// InvalidPolicy exception is raised containing the index in the
// policies parameter value of the first offending policy object.
tao_policies.validate_policies (this->object_adapter_.validator (),
this->object_adapter_.orb_core ());
PortableServer::POAManager_var poamanager;
if (id != 0)
{
poamanager = this->find (id);
// If we already have a manager with the same name throw an exception
if (!CORBA::is_nil (poamanager.in()))
{
throw ::PortableServer::POAManagerFactory::ManagerAlreadyExists ();
}
}
// this indirection brought to you by borland's compiler and its refusal
// to directly assign the newly created TAO_POA_Manager to a POAManager_var.
{
PortableServer::POAManager_ptr pm = 0;
ACE_NEW_THROW_EX (pm,
TAO_POA_Manager (object_adapter_, id, policies, this),
CORBA::NO_MEMORY
(CORBA::SystemException::_tao_minor_code (0, ENOMEM),
CORBA::COMPLETED_NO));
poamanager = pm;
}
this->register_poamanager (poamanager.in ());
return poamanager._retn ();
}
| PortableServer::POAManager_ptr TAO_POAManager_Factory::find | ( | const char * | id | ) |
Definition at line 108 of file POAManagerFactory.cpp.
{
::PortableServer::POAManager_ptr poamanager =
::PortableServer::POAManager::_nil();
for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin ();
iterator != this->poamanager_set_.end ();
++iterator)
{
CORBA::String_var poamanagerid = (*iterator)->get_id ();
if (ACE_OS::strcmp (id, poamanagerid.in()) == 0)
{
poamanager = PortableServer::POAManager::_duplicate (*iterator);
break;
}
}
return poamanager;
}
| PortableServer::POAManagerFactory::POAManagerSeq * TAO_POAManager_Factory::list | ( | void | ) |
Definition at line 82 of file POAManagerFactory.cpp.
{
::PortableServer::POAManagerFactory::POAManagerSeq_var poamanagers;
CORBA::ULong number_of_poamanagers = static_cast <CORBA::ULong>
(this->poamanager_set_.size ());
ACE_NEW_THROW_EX (poamanagers,
PortableServer::POAManagerFactory::POAManagerSeq (
number_of_poamanagers),
CORBA::NO_MEMORY ());
poamanagers->length (number_of_poamanagers);
CORBA::ULong index = 0;
for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin ();
iterator != this->poamanager_set_.end ();
++iterator, ++index)
{
::PortableServer::POAManager_ptr poamanager = (*iterator);
poamanagers[index] =
PortableServer::POAManager::_duplicate (poamanager);
}
return poamanagers._retn ();
}
| int TAO_POAManager_Factory::register_poamanager | ( | ::PortableServer::POAManager_ptr | poamanager | ) |
Definition at line 157 of file POAManagerFactory.cpp.
{
return this->poamanager_set_.insert (
PortableServer::POAManager::_duplicate (poamanager));
}
| void TAO_POAManager_Factory::remove_all_poamanagers | ( | void | ) |
Definition at line 130 of file POAManagerFactory.cpp.
{
for (POAMANAGERSET::iterator iterator = this->poamanager_set_.begin ();
iterator != this->poamanager_set_.end ();
++iterator)
{
::PortableServer::POAManager_ptr poamanager = (*iterator);
CORBA::release (poamanager);
}
this->poamanager_set_.reset ();
}
| int TAO_POAManager_Factory::remove_poamanager | ( | ::PortableServer::POAManager_ptr | poamanager | ) |
Definition at line 143 of file POAManagerFactory.cpp.
{
int retval = this->poamanager_set_.remove (poamanager);
if (retval == 0)
{
CORBA::release (poamanager);
}
return retval;
}
Definition at line 65 of file POAManagerFactory.h.
Definition at line 69 of file POAManagerFactory.h.
1.7.0