本文整理汇总了C++中portableserver::Servant::_default_POA方法的典型用法代码示例。如果您正苦于以下问题:C++ Servant::_default_POA方法的具体用法?C++ Servant::_default_POA怎么用?C++ Servant::_default_POA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类portableserver::Servant
的用法示例。
在下文中一共展示了Servant::_default_POA方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Implicit_Deactivator::Implicit_Deactivator (PortableServer::Servant servant)
{
this->poa_ =
servant->_default_POA ();
this->id_ =
this->poa_->servant_to_id (servant);
}
示例2:
void
deactivate_servant (PortableServer::Servant servant)
{
PortableServer::POA_var poa =
servant->_default_POA ();
PortableServer::ObjectId_var id =
poa->servant_to_id (servant);
poa->deactivate_object (id.in ());
}
示例3: catch
/* static */
int
TAO_AV_Core::deactivate_servant (PortableServer::Servant servant)
{
// Because of reference counting, the POA will automatically delete
// the servant when all pending requests on this servant are
// complete.
try
{
PortableServer::POA_var poa = servant->_default_POA ();
PortableServer::ObjectId_var id = poa->servant_to_id (servant);
poa->deactivate_object (id.in ());
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("deactivate_servant");
return -1;
}
return 0;
}
示例4: bindServiceObject
bool ServiceOptions::bindServiceObject(CORBA::ORB_ptr orb,
CORBA::Object_ptr object,
PortableServer::Servant p_servant,
const char* objName,
bool rebind)
{
if(is_set("with-naming")) {
CosNaming::Name name;
name.length(1);
name[0].id=CORBA::string_dup(objName);
name[0].kind=CORBA::string_dup("");
CORBA::Object_var obj ;
try {
obj = orb->resolve_initial_references("NameService");
}catch(const CORBA::ORB::InvalidName& ex){
std::cerr << argv()[0] << ": can't resolve `NameService'" << std::endl;
return false;
}
CosNaming::NamingContext_var nc;
try {
nc = CosNaming::NamingContext::_narrow(obj.in());
}catch(const CORBA::SystemException& ex){
std::cerr << argv()[0] << ": can't narrow naming service" << std::endl;
return false;
}
try {
if(rebind){
nc->rebind(name,object);
}else{
try{
nc->bind(name,object);
}catch(const CosNaming::NamingContext::AlreadyBound&){
std::cerr<<argv()[0]<<":can't bind "<<objName<<" (AlreadyBound)"<< std::endl;
return false;
}
}
}catch(const CosNaming::NamingContext::CannotProceed&){
std::cerr<<argv()[0]<<": can't bind "<<objName<<" (CannotProceed)"<< std::endl;
return false;
}catch(const CosNaming::NamingContext::InvalidName&){
std::cerr<<argv()[0]<<":can't bind "<<objName<<" (InvalidName)"<< std::endl;
return false;
}
std::cout<<argv()[0]<<": binding completed successfully"<<std::endl;
}
CORBA::String_var ior ;
try {
ior = orb->object_to_string(object);
}catch(const CORBA::SystemException& ex){
#ifdef CORBA_SYSTEM_EXCEPTION_IS_STREAMBLE
std::cerr << ex << std::endl;
#else
std::cerr << "CORBA::SystemException" << std::endl;
#endif
return false;
}
const char* fname = get_ior_fname(objName);
if (fname!=NULL && strcmp(fname,"")!=0) {
std::ofstream ofs (fname);
if (ofs.bad()) {
std::cerr << argv()[0] << ": can't open file " << fname << std::endl;
perror(argv()[0]);
return false;
}
ofs << ior.in();
ofs.close();
}
if (is_set("ior-stdout")) {
std::cout << ior << std::flush;
}
#ifdef ORBACUS
CORBA::Object_var bmgrObj = orb->resolve_initial_references("BootManager");
OB::BootManager_var bootManager = OB::BootManager::_narrow(bmgrObj);
PortableServer::ObjectId_var oid = PortableServer::string_to_ObjectId(objName);
bootManager -> add_binding(oid.in(),object);
#elif defined(OMNIORB)
PortableServer::POA_var objPOA = p_servant->_default_POA();
CORBA::String_var objPOAName = objPOA->the_name();
if (strcmp(objPOAName.in(),"omniINSPOA")!=0) {
CORBA::Object_var insPOAObj = orb->resolve_initial_references("omniINSPOA");
PortableServer::POA_var insPOA = PortableServer::POA::_narrow(insPOAObj);
PortableServer::POAManager_var insPOAManager=insPOA->the_POAManager();
insPOAManager->activate();
PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId(objName);
insPOA->activate_object_with_id(oid.in(),p_servant);
}
#elif defined(RSSH_TAO)
#ifdef TAO_HAVE_IORTABLE_ADAPTER
CORBA::Object_var table = orb->resolve_initial_references ("IORTable");
IORTable::Table_var adapter = IORTable::Table::_narrow (table.in());
if (CORBA::is_nil(adapter.in())) {
cerr<<argv()[0]<<": nil IORTable reference"<<endl;
} else {
adapter->bind (objName, ior.in ());
}
#else
ACE_CString ins(objName);
if (orb->_tao_add_to_IOR_table(ins,object)!=0) {
return false;
//.........这里部分代码省略.........