本文整理汇总了C++中portableserver::POA_ptr::create_reference_with_id方法的典型用法代码示例。如果您正苦于以下问题:C++ POA_ptr::create_reference_with_id方法的具体用法?C++ POA_ptr::create_reference_with_id怎么用?C++ POA_ptr::create_reference_with_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类portableserver::POA_ptr
的用法示例。
在下文中一共展示了POA_ptr::create_reference_with_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CosNaming::NamingContext_ptr
createNamingContextReference(
PortableServer::POA_ptr poa,
const char * oid)
{
PortableServer::ObjectId_var id =
PortableServer::string_to_ObjectId(oid);
CORBA::Object_var obj = poa->create_reference_with_id(
id,"IDL:omg.org/CosNaming/NamingContextExt:1.0");
return CosNaming::NamingContext::_narrow(obj);
}
示例2: assert
static CCS::Thermometer_ptr make_dref (PortableServer::POA_ptr poa, CCS::AssetType anum)
{
// Convert asset number to OID.
ostrstream ostr;
ostr << anum << ends;
char * anum_str = ostr.str ();
PortableServer::ObjectId_var oid
= PortableServer::string_to_ObjectId (anum_str);
delete[] anum_str;
// Look at the model via the network to determine
// the repository ID.
char buf[32];
assert (ICP_get (anum, "model", buf, sizeof (buf)) == 0);
const char * rep_id = ACE_OS::strcmp (buf, "Sens-A-Temp") == 0
? "IDL:acme.com/CCS/Thermometer:1.0"
: "IDL:acme.com/CCS/Thermostat:1.0";
// Make a new reference.
CORBA::Object_var obj
= poa->create_reference_with_id (oid.in (), rep_id);
return CCS::Thermometer::_narrow (obj.in ());
}
示例3: servant
void
test_poas (CORBA::ORB_ptr orb,
PortableServer::POA_ptr root_poa,
PortableServer::POA_ptr first_poa,
PortableServer::POA_ptr second_poa,
PortableServer::POA_ptr third_poa,
PortableServer::POA_ptr forth_poa,
int perform_deactivation_test)
{
{
test_i servant (root_poa);
CORBA::Object_var obj = root_poa->create_reference ("IDL:test:1.0");
CORBA::String_var string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
PortableServer::ObjectId_var id = root_poa->reference_to_id (obj.in ());
root_poa->activate_object_with_id (id.in (),
&servant);
obj = root_poa->id_to_reference (id.in ());
string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
PortableServer::ServantBase_var servant_from_reference =
root_poa->reference_to_servant (obj.in ());
PortableServer::ServantBase_var servant_from_id =
root_poa->id_to_servant (id.in ());
if (servant_from_reference.in () != servant_from_id.in ()
|| servant_from_reference.in () != &servant)
{
ACE_ERROR ((LM_ERROR,
"Mismatched servant_from_reference, "
"servant_from_id and &servant\n"));
}
obj = root_poa->servant_to_reference (&servant);
string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
obj = servant._this ();
string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
PortableServer::ObjectId_var id_from_servant = root_poa->servant_to_id (&servant);
ACE_ASSERT (id_from_servant.in () == id.in ());
root_poa->deactivate_object (id.in ());
if (perform_deactivation_test)
{
root_poa->activate_object_with_id (id.in (),
&servant);
servant_from_reference = root_poa->reference_to_servant (obj.in ());
ACE_ASSERT (servant_from_reference.in () == &servant);
root_poa->deactivate_object (id.in ());
}
}
{
test_i servant (root_poa);
PortableServer::ObjectId_var id = root_poa->activate_object (&servant);
CORBA::Object_var obj = root_poa->id_to_reference (id.in ());
CORBA::String_var string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
obj = root_poa->create_reference_with_id (id.in (),
"IDL:test:1.0");
string = orb->object_to_string (obj.in ());
ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));
root_poa->deactivate_object (id.in ());
}
{
test_i servant (first_poa);
CORBA::Object_var obj = first_poa->create_reference ("IDL:test:1.0");
//.........这里部分代码省略.........
示例4: repo_id
//.........这里部分代码省略.........
repo_id += "CORBA/ExtAbstractInterfaceDef:";
break;
case CORBA::dk_LocalInterface:
repo_id += "CORBA/ExtLocalInterfaceDef:";
break;
case CORBA::dk_Module:
repo_id += "CORBA/ComponentIR/ModuleDef:";
break;
case CORBA::dk_Operation:
repo_id += "CORBA/OperationDef:";
break;
case CORBA::dk_Typedef:
repo_id += "CORBA/TypedefDef:";
break;
case CORBA::dk_Alias:
repo_id += "CORBA/AliasDef:";
break;
case CORBA::dk_Struct:
repo_id += "CORBA/StructDef:";
break;
case CORBA::dk_Union:
repo_id += "CORBA/UnionDef:";
break;
case CORBA::dk_Enum:
repo_id += "CORBA/EnumDef:";
break;
case CORBA::dk_Primitive:
repo_id += "CORBA/PrimitiveDef:";
break;
case CORBA::dk_String:
repo_id += "CORBA/StringDef:";
break;
case CORBA::dk_Sequence:
repo_id += "CORBA/SequenceDef:";
break;
case CORBA::dk_Array:
repo_id += "CORBA/ArrayDef:";
break;
case CORBA::dk_Wstring:
repo_id += "CORBA/WstringDef:";
break;
case CORBA::dk_Fixed:
repo_id += "CORBA/FixedDef:";
break;
case CORBA::dk_Value:
repo_id += "CORBA/ExtValueDef:";
break;
case CORBA::dk_ValueBox:
repo_id += "CORBA/ValueBoxDef:";
break;
case CORBA::dk_ValueMember:
repo_id += "CORBA/ValueMemberDef:";
break;
case CORBA::dk_Native:
repo_id += "CORBA/NativeDef:";
break;
case CORBA::dk_Component:
repo_id += "CORBA/ComponentIR/ComponentDef:";
break;
case CORBA::dk_Home:
repo_id += "CORBA/ComponentIR/HomeDef:";
break;
case CORBA::dk_Factory:
repo_id += "CORBA/ComponentIR/FactoryDef:";
break;
case CORBA::dk_Finder:
repo_id += "CORBA/ComponentIR/FinderDef:";
break;
case CORBA::dk_Event:
repo_id += "CORBA/ComponentIR/EventDef:";
break;
case CORBA::dk_Emits:
repo_id += "CORBA/ComponentIR/EmitsDef:";
break;
case CORBA::dk_Publishes:
repo_id += "CORBA/ComponentIR/PublishesDef:";
break;
case CORBA::dk_Consumes:
repo_id += "CORBA/ComponentIR/ConsumesDef:";
break;
case CORBA::dk_Provides:
repo_id += "CORBA/ComponentIR/ProvidesDef:";
break;
case CORBA::dk_Uses:
repo_id += "CORBA/ComponentIR/UsesDef:";
break;
default:
throw CORBA::OBJECT_NOT_EXIST ();
}
repo_id += "1.0";
PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId (obj_id);
PortableServer::POA_ptr poa = repo->select_poa (def_kind);
return poa->create_reference_with_id (oid.in (),
repo_id.c_str ());
}