[omniORB] how to get a RootContext
Masaaki Sekiya
sekiya@nagoya.ydc.co.jp
Mon, 13 Dec 1999 17:47:27 +0900 (JST)
Hello there.
I'm new to the omniORB.
And I'm trying to get a RootContextObject of a arbitary Naming Server.
I made a code like below. It works how I expect.
But I am concerned whether this code has some bugs.
Are there any harmful point in this code or a better code ?
If you are aware of , I would be extremely appreciative for it.
===============
const ropeFactoryType* t;
ropeFactory_iterator next(globalOutgoingRopeFactories);
const ropeFactory* f;
while ((f = next())) {
t = f->getType();
if (t->is_IOPprofileId(IOP::TAG_INTERNET_IOP))
break;
}
if (f){
CORBA::Char* host= .. // arbitary
CORBA::UShort port= .. // arbitary
tcpSocketEndpoint addr(host,port);
CORBA::Char objkey[4];
objkey[0] = 'I'; objkey[1] = 'N'; objkey[2] = 'I';
objkey[3] = 'T';
IOP::TaggedProfileList p;
p.length(1);
t->encodeIOPprofile((Endpoint*)&addr,objkey,4,p[0]);
CORBA::String_var ior((char*) IOP::iorToEncapStr(
(const CORBA::Char*)CORBA_InitialReferences_IntfRepoID,&p));
CORBA::Object_var o((CORBA::Object_ptr) (
omni::stringToObject(ior)->_widenFromTheMostDerivedIntf(0)));
CORBA_InitialReferences_var bagent;
bagent = CORBA_InitialReferences::_narrow(o);
bagent->noExistentCheck();
CORBA::Object_ptr obj = pagent->get("NameService");
...
===============
Masaaki Sekiya