本文整理汇总了C++中portableserver::POA_ptr::create_implicit_activation_policy方法的典型用法代码示例。如果您正苦于以下问题:C++ POA_ptr::create_implicit_activation_policy方法的具体用法?C++ POA_ptr::create_implicit_activation_policy怎么用?C++ POA_ptr::create_implicit_activation_policy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类portableserver::POA_ptr
的用法示例。
在下文中一共展示了POA_ptr::create_implicit_activation_policy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: policies
PortableServer::POA_ptr
setup_poa (PortableServer::POA_ptr root_poa)
{
// Policies for the childPOA to be created.
CORBA::PolicyList policies (2);
policies.length (2);
// Tell the POA to use a servant manager.
policies[0] =
root_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER);
// Allow implicit activation.
policies[1] =
root_poa->create_implicit_activation_policy (PortableServer::IMPLICIT_ACTIVATION);
PortableServer::POAManager_var poa_manager =
root_poa->the_POAManager ();
// Create POA as child of RootPOA with the above policies. This POA
// will use a SERVANT_ACTIVATOR because of RETAIN policy.
PortableServer::POA_var child_poa =
root_poa->create_POA ("childPOA",
poa_manager.in (),
policies);
// Creation of childPOAs is over. Destroy the Policy objects.
for (CORBA::ULong i = 0;
i < policies.length ();
++i)
{
policies[i]->destroy ();
}
return child_poa._retn ();
}
示例2: policies
int
create_POA_and_register_servant (CORBA::Policy_ptr threadpool_policy,
const char *poa_name,
PortableServer::POAManager_ptr poa_manager,
PortableServer::POA_ptr root_poa,
CORBA::ORB_ptr orb,
RTCORBA::RTORB_ptr rt_orb)
{
// Policies for the firstPOA to be created.
CORBA::PolicyList policies (3); policies.length (3);
// Implicit_activation policy.
policies[0] =
root_poa->create_implicit_activation_policy
(PortableServer::IMPLICIT_ACTIVATION);
// Thread pool policy.
policies[1] =
CORBA::Policy::_duplicate (threadpool_policy);
// Priority Model policy.
policies[2] =
rt_orb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED, 0);
// Create the POA under the RootPOA.
PortableServer::POA_var poa =
root_poa->create_POA (poa_name,
poa_manager,
policies);
// Creation of POAs is over. Destroy the Policy objects.
for (CORBA::ULong i = 0;
i < policies.length ();
++i)
{
policies[i]->destroy ();
}
test_i *servant =
new test_i (orb,
poa.in (),
nap_time);
PortableServer::ServantBase_var safe_servant (servant);
ACE_UNUSED_ARG (safe_servant);
PortableServer::ObjectId_var id =
poa->activate_object (servant);
CORBA::Object_var object = poa->id_to_reference (id.in ());
test_var test = test::_narrow (object.in ());
int const result = write_ior_to_file (orb, test.in ());
return result;
}
示例3: policies
void
Quoter_Stock_Factory_i::load_stock_objects (
PortableServer::POA_ptr poa,
PortableServer::POAManager_ptr poa_manager,
RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin)
{
if (!CORBA::is_nil (this->stock_factory_poa_.in ()))
return;
CORBA::PolicyList policies (2);
policies.length (2);
policies[0] =
poa->create_id_assignment_policy (PortableServer::USER_ID);
policies[1] =
poa->create_implicit_activation_policy (PortableServer::NO_IMPLICIT_ACTIVATION);
this->stock_factory_poa_ =
poa->create_POA ("Stock_Factory_POA",
poa_manager,
policies);
for (CORBA::ULong i = 0; i != policies.length (); ++i) {
policies[i]->destroy ();
}
while (!cin.eof () && cin.peek () != EOF) {
const int max_symbol_length = 8;
char symbol[max_symbol_length];
const int max_full_name_length = 64;
char full_name[max_full_name_length];
double price;
cin.getline (symbol, max_symbol_length, '\n');
cin.getline (full_name, max_full_name_length, '\n');
cin >> price;
cin.ignore (1, '\n');
Quoter_Stock_i *stock =
new Quoter_Stock_i (symbol, full_name, price);
PortableServer::ServantBase_var servant = stock;
PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId (symbol);
this->stock_factory_poa_->activate_object_with_id (oid.in (),
servant.in ());
stock->connect (supplier_admin);
}
}
示例4: initialize
void
HomeServantBase::initialize
( PortableServer::POA_ptr root_poa
, Components::HomeExecutorBase_ptr home_executor
, ContainerInterfaceImpl* container
, std::string install_dir )
throw (Components::Deployment::InstallationFailure)
{
home_executor_ = Components::HomeExecutorBase::_duplicate (home_executor);
container_ = container;
container_->_add_ref();
install_dir_ = install_dir;
// Create a new POA for the components
CORBA::PolicyList policies;
policies.length (7);
policies[0] = root_poa->create_thread_policy (PortableServer::ORB_CTRL_MODEL);
policies[1] = root_poa->create_lifespan_policy (PortableServer::TRANSIENT);
policies[2] = root_poa->create_id_uniqueness_policy (PortableServer::UNIQUE_ID);
policies[3] = root_poa->create_id_assignment_policy (PortableServer::USER_ID);
policies[4] = root_poa->create_implicit_activation_policy (PortableServer::NO_IMPLICIT_ACTIVATION);
policies[5] = root_poa->create_servant_retention_policy (PortableServer::NON_RETAIN);
policies[6] = root_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER);
static CORBA::ULong poa_name = 0;
char buffer[17];
sprintf (buffer, "Qedo_POA_%ld", ++poa_name);
try
{
home_poa_ = root_poa->create_POA (buffer, NULL, policies);
}
catch (PortableServer::POA::AdapterAlreadyExists&)
{
NORMAL_ERR ("HomeServantBase: Fatal internal error - POA already exists???");
throw Components::Deployment::InstallationFailure();
}
catch (PortableServer::POA::InvalidPolicy&)
{
NORMAL_ERR ("HomeServantBase: Fatal internal error - Invalid policy during POA creation: ORB not CORBA 2.3 compliant???");
throw Components::Deployment::InstallationFailure();
}
// Set servant locator
try
{
home_poa_->set_servant_manager (servant_locator_);
}
catch (PortableServer::POA::WrongPolicy&)
{
// Cannot be, since our POA has the right policies
NORMAL_ERR ("HomeServantBase: Fatal internal error - Setting servant manager complains about a wrong policy???");
throw Components::Deployment::InstallationFailure();
}
my_home_servant_ = dynamic_cast <PortableServer::Servant> (this);
if (! my_home_servant_)
{
NORMAL_ERR ("HomeServantBase: initialize(): Cannot dynamic_cast this pointer to PortableServer::Servant");
throw Components::Deployment::InstallationFailure();
}
// Activate the POA using the POA manager
home_poa_manager_ = home_poa_->the_POAManager();
home_poa_manager_->activate();
// Create a first object reference, which belongs to this home
CORBA::Object_var home_obj = this->create_primary_object_reference (repository_id_);
my_object_id_ = this->reference_to_oid (home_obj);
// Narrow the object reference for the home (this can involve remote _is_a() calls to the
// servant, so it must be active at this time)
my_home_ref_ = Components::CCMHome::_narrow (home_obj);
}