本文整理汇总了C++中portableserver::POA_ptr::create_lifespan_policy方法的典型用法代码示例。如果您正苦于以下问题:C++ POA_ptr::create_lifespan_policy方法的具体用法?C++ POA_ptr::create_lifespan_policy怎么用?C++ POA_ptr::create_lifespan_policy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类portableserver::POA_ptr
的用法示例。
在下文中一共展示了POA_ptr::create_lifespan_policy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize_poa
//
// initialize_poa
//
void Tao_Data_Channel_Service::initialize_poa (::PortableServer::POA_ptr poa)
{
// Construct the policy list for the LoggingServerPOA.
::CORBA::PolicyList policies (6);
policies.length (6);
policies[0] = poa->create_thread_policy (PortableServer::ORB_CTRL_MODEL);
policies[1] = poa->create_servant_retention_policy (PortableServer::RETAIN);
policies[2] = poa->create_id_assignment_policy (PortableServer::SYSTEM_ID);
policies[3] = poa->create_id_uniqueness_policy (PortableServer::UNIQUE_ID);
policies[4] = poa->create_lifespan_policy (PortableServer::TRANSIENT);
policies[5] = poa->create_request_processing_policy (PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY);
// Create the child POA for the test logger factory servants.
this->poa_ =
poa->create_POA ("DataChannelPOA",
::PortableServer::POAManager::_nil (),
policies);
for (size_t i = 0; i < 6; ++ i)
policies[i]->destroy ();
// Activate this POA's manager.
PortableServer::POAManager_var the_mgr = this->poa_->the_POAManager ();
the_mgr->activate ();
}
示例2:
PortableServer::POA_ptr
createPOA (PortableServer::POA_ptr root_poa,
bool share_mgr,
const char* poa_name)
{
PortableServer::LifespanPolicy_var life =
root_poa->create_lifespan_policy(PortableServer::PERSISTENT);
PortableServer::IdAssignmentPolicy_var assign =
root_poa->create_id_assignment_policy(PortableServer::USER_ID);
CORBA::PolicyList pols;
pols.length(2);
pols[0] = PortableServer::LifespanPolicy::_duplicate(life.in());
pols[1] = PortableServer::IdAssignmentPolicy::_duplicate(assign.in());
PortableServer::POAManager_var mgr = PortableServer::POAManager::_nil();
if (share_mgr)
{
mgr = root_poa->the_POAManager();
}
PortableServer::POA_var poa =
root_poa->create_POA(poa_name, mgr.in(), pols);
life->destroy();
assign->destroy();
return poa._retn();
}
示例3:
void
TAO_Notify_POA_Helper::set_persistent_policy (PortableServer::POA_ptr parent_poa, CORBA::PolicyList &policy_list)
{
policy_list.length (2);
policy_list[0] =
parent_poa->create_lifespan_policy (PortableServer::PERSISTENT);
policy_list[1] =
parent_poa->create_id_assignment_policy (PortableServer::USER_ID);
}
示例4: main
//.........这里部分代码省略.........
new_argv[new_argc - 1] = port;
int orb_argc = port_given ? argc : new_argc;
char ** orb_argv = port_given ? argv : new_argv;
//
// ORB initialization
//
my_global_orb = CORBA::ORB_init(orb_argc, orb_argv);
// Get internal ORB
TIDorb::core::TIDORB* m_orb =
dynamic_cast<TIDorb::core::TIDORB*> (CORBA::ORB::_duplicate(my_global_orb));
//
// Getting RootPOA & Manager references
//
CORBA::Object_var poa_obj = my_global_orb->resolve_initial_references("RootPOA");
PortableServer::POA_ptr rootPOA = PortableServer::POA::_narrow(poa_obj);
PortableServer::POAManager_var manager = rootPOA->the_POAManager();
//
// NamingContexts POA creation
//
CORBA::PolicyList policies;
policies.length(4);
policies[0] = rootPOA->create_servant_retention_policy(PortableServer::RETAIN);
policies[1] = rootPOA->create_request_processing_policy(
PortableServer::USE_SERVANT_MANAGER);
policies[2] = rootPOA->create_id_assignment_policy(PortableServer::USER_ID);
policies[3] = rootPOA->create_lifespan_policy(PortableServer::PERSISTENT);
PortableServer::POA_var namingContextsPOA =
rootPOA->create_POA("namingContextsPOA", manager, policies);
PortableServer::POAManager_var namingContextsManager =
namingContextsPOA->the_POAManager();
//
// BindingIterators POA creation
//
CORBA::PolicyList bindingIterators_policies;
bindingIterators_policies.length(2);
bindingIterators_policies[0] =
rootPOA->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL);
bindingIterators_policies[1] =
rootPOA->create_id_assignment_policy(PortableServer::USER_ID);
PortableServer::POA_var bindingIteratorsPOA =
namingContextsPOA->create_POA("bindingIteratorsPOA", namingContextsManager,
bindingIterators_policies);
//
// Creates and sets a new ServantManager
//
TIDNaming::ServantManagerNSImpl* servant_manager =
new TIDNaming::ServantManagerNSImpl(my_global_orb, bindingIteratorsPOA,
max_binding_iterators);
示例5: policies
void
create_poas (PortableServer::POA_ptr root_poa,
PortableServer::LifespanPolicyValue lifespan_policy,
PortableServer::POA_out first_poa,
PortableServer::POA_out second_poa,
PortableServer::POA_out third_poa,
PortableServer::POA_out forth_poa)
{
// Policies for the new POAs
CORBA::PolicyList policies (3);
policies.length (3);
policies[0] = root_poa->create_lifespan_policy (lifespan_policy);
policies[1] = root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID);
policies[2] = root_poa->create_id_assignment_policy (PortableServer::SYSTEM_ID);
// Creation of the firstPOA
ACE_CString name = "firstPOA";
first_poa = root_poa->create_POA (name.c_str (),
PortableServer::POAManager::_nil (),
policies);
policies[1]->destroy ();
policies[1] = root_poa->create_id_uniqueness_policy (PortableServer::UNIQUE_ID);
// Creation of the secondPOA
name = "secondPOA";
second_poa = root_poa->create_POA (name.c_str (),
PortableServer::POAManager::_nil (),
policies);
policies[2]->destroy ();
policies[2] = root_poa->create_id_assignment_policy (PortableServer::USER_ID);
// Creation of the thirdPOA
name = "thirdPOA";
third_poa = root_poa->create_POA (name.c_str (),
PortableServer::POAManager::_nil (),
policies);
policies[1]->destroy ();
policies[1] = root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID);
// Creation of the forthPOA
name = "forthPOA";
forth_poa = root_poa->create_POA (name.c_str (),
PortableServer::POAManager::_nil (),
policies);
// Creation of the new POAs over, so destroy the policies
for (CORBA::ULong i = 0;
i < policies.length ();
++i)
{
policies[i]->destroy ();
}
}
示例6: 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);
}
示例7: main
int main(int argc,char *argv [])
{
CORBA::ORB_ptr orb_ptr;
try
{
/************************************************************************/
/* INICIALIZAMOS LA PARTE DEL ORB */
/************************************************************************/
int alt_argc = 0;
char ** alt_argv;
const char * orb_id="Test_TIDNotification";
orb_ptr=CORBA::ORB_init(argc, argv, orb_id);
if (!orb_ptr)
{
cerr<<"El ORB es null"<<endl;
return -1;
}
CORBA::Object_ptr delegado_POA;
PortableServer::POA_ptr rootPOA;
try
{
delegado_POA = orb_ptr->resolve_initial_references("RootPOA");
}
catch ( CORBA::ORB::InvalidName ex )
{
ex._name();
return -1;
}
rootPOA = PortableServer::_POAHelper::narrow( delegado_POA,true );
PortableServer::POAManager_var poa_manager = rootPOA->the_POAManager();
CORBA::PolicyList_var policies = NULL;
policies = new CORBA::PolicyList(2);
policies->length(2);
// Valores cambiados
(*policies)[0] = rootPOA->create_lifespan_policy
( PortableServer::PERSISTENT );
(*policies)[1] = rootPOA->create_id_assignment_policy
( PortableServer::USER_ID );
PortableServer::POA_var consumerPOA = rootPOA->create_POA("consumerPOA", poa_manager, *policies );
/***********************************************************************/
/* OBTENEMOS LA FACTORIA DEL CANAL DE EVENTOS Y CREAMOS EL CANAL */
/**********************************************************************/
CORBA::Object_ptr delegado_event_channel_factory;
delegado_event_channel_factory=orb_ptr->string_to_object(argv[1]);
CosNotifyChannelAdmin::EventChannelFactory_var factory;
factory = CosNotifyChannelAdmin::EventChannelFactory::_narrow(delegado_event_channel_factory);
if (CORBA::is_nil(factory)) {
cerr << "[server] ERROR: factoria nula " << endl;
return -1;
}
CosNotifyChannelAdmin::EventChannel_var channel;
//CosNotifyChannelAdmin::EventChannel_var channelv[10];
CosNotification::QoSProperties initial_qos;
CosNotification::AdminProperties initial_admin;
CosNotifyChannelAdmin::ChannelID id;
//CosNotifyChannelAdmin::ChannelID idv[10];
// // Politicas Soportadas:
// initial_qos.length(9);
// initial_qos[0].name = CORBA::string_dup("OrderPolicy");
// initial_qos[0].value <<= CosNotification::FifoOrder; // Any Fifo Priority Deadline
// initial_qos[1].name = CORBA::string_dup("EventReliability");
// initial_qos[1].value <<= CosNotification::BestEffort; // Persistent
// initial_qos[2].name = CORBA::string_dup("ConnectionReliability");
// initial_qos[2].value <<= CosNotification::BestEffort; // Persistent
// initial_qos[3].name = CORBA::string_dup("Priority");
// initial_qos[3].value <<= CosNotification::HighestPriority; // Highest, Default
// initial_qos[4].name = CORBA::string_dup("StartTime");
// initial_qos[4].value <<= *(new TimeBase::UtcT(
// TIDorb::core::util::Time::currentTimeMillis(),
// 0,0,0));
// initial_qos[5].name = CORBA::string_dup("StopTime");
// initial_qos[5].value <<= *(new TimeBase::UtcT(
// TIDorb::core::util::Time::currentTimeMillis(),
// 0,0,0));
// initial_qos[6].name = CORBA::string_dup("Timeout");
// initial_qos[6].value <<= (TimeBase::TimeT)TIDorb::core::util::Time::currentTimeMillis();
// initial_qos[7].name = CORBA::string_dup("StartTimeSupported");
// initial_qos[7].value <<= (CORBA::Boolean) 0;
// initial_qos[8].name = CORBA::string_dup("StopTimeSupported");
// initial_qos[8].value <<= (CORBA::Boolean) 1;
//.........这里部分代码省略.........