Skip navigation.

CORBA Programming Reference

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

 


PortableServer::POA::create_POA

Synopsis

Creates a new POA as a child of the target POA.

C++ Binding

POA_ptr PortableServer::create_POA (
const char * adapter_name,
POAManager_ptr a_POAManager,
const CORBA::PolicyList & policies)

Arguments

adapter_name

The name of the POA to be created.

a_POAManager

Either a NULL value, indicating that a new POAManager is to be created and associated with the new POA, or a pointer to an existing POAManager.

policies

Policy objects to be associated with the new POA.

Exceptions

AdapterAlreadyExists

Raised if the target POA already has a child POA with the specified name.

InvalidPolicy

Raised 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. This exception contains the index in the policy parameter value of the first offending policy object.

IMP_LIMIT

Raised if the program tries to create a POA with a LifespanPolicy of PERSISTENT without having set a port, as described in the operation CORBA::ORB_init.

Description

This operation creates a new POA as a child of the target POA. The specified name, which must be unique, identifies the new POA with respect to other POAs with the same parent POA.

If the a_POAManager parameter is NULL, a new PortableServer::POAManager object is created and associated with the new POA. Otherwise, the specified POAManager object is associated with the new POA. The POAManager object can be obtained using the attribute name the_POAManager.

The specified policy objects are associated with the POA and are used to control its behavior. The policy objects are effectively copied before this operation returns, so the application is free to destroy them while the POA is in use. Policies are not inherited from the parent POA.

Note: This function is supported only for joint client/servers.

Return Values

Returns a pointer to the POA that was created.

Examples

Example 1

In this example, the child POA would use the same manager as the parent POA; the child POA would then have the same state as the parent (that is, it would be active if the parent is active).

CORBA::PolicyList policies(2);
policies.length (1);
policies[0] = rootPOA->create_lifespan_policy(
PortableServer::LifespanPolicy::TRANSIENT);
PortableServer::POA_ptr poa =
rootPOA->create_POA("my_little_poa",
rootPOA->the_POAManager, policies);

Example 2

In this example, a new POA is created as a child of the root POA.

CORBA::PolicyList policies(2);
policies.length (1);
policies[0] = rootPOA->create_lifespan_policy(
PortableServer::LifespanPolicy::TRANSIENT);
PortableServer::POA_ptr poa =
rootPOA->create_POA("my_little_poa",
PortableServer::POAManager::_nil(), policies);

 

Skip navigation bar  Back to Top Previous Next