예제 #1
0
ModelLoader_var hrp::getModelLoader(CORBA_ORB_var orb)
{
    CosNaming::NamingContext_var cxt;
    try {
        CORBA::Object_var nS = orb->resolve_initial_references("NameService");
        cxt = CosNaming::NamingContext::_narrow(nS);
    } catch(CORBA::SystemException& ex) {
        std::cerr << "NameService doesn't exist" << std::endl;
        return NULL;
    }
    return getModelLoader(cxt);
}
예제 #2
0
BodyInfo_var hrp::loadBodyInfo(const char* url, CORBA_ORB_var orb)
{
    CosNaming::NamingContext_var cxt;
    try {
        CORBA::Object_var nS = orb->resolve_initial_references("NameService");
        cxt = CosNaming::NamingContext::_narrow(nS);
    } catch(CORBA::SystemException& ex) {
        std::cerr << "NameService doesn't exist" << std::endl;
        return false;
    }
    return loadBodyInfo(url, cxt);
}
예제 #3
0
bool hrp::loadBodyFromModelLoader(BodyPtr body, const char* url, CORBA_ORB_var orb, bool loadGeometryForCollisionDetection)
{
    CosNaming::NamingContext_var cxt;
    try {
        CORBA::Object_var nS = orb->resolve_initial_references("NameService");
        cxt = CosNaming::NamingContext::_narrow(nS);
    } catch(CORBA::SystemException& ex) {
        std::cerr << "NameService doesn't exist" << std::endl;
        return false;
    }

    return loadBodyFromModelLoader(body, url, cxt, loadGeometryForCollisionDetection);
}
예제 #4
0
int loadBodyFromModelLoader(::World* world, const char* name, const char *url, CORBA_ORB_var orb)
{
    CosNaming::NamingContext_var cxt;
    try {
      CORBA::Object_var	nS = orb->resolve_initial_references("NameService");
      cxt = CosNaming::NamingContext::_narrow(nS);
    } catch(CORBA::SystemException& ex) {
		std::cerr << "NameService doesn't exist" << std::endl;
		return 0;
	}

	return loadBodyFromModelLoader(world, name, url, cxt);
}
예제 #5
0
파일: client.cpp 프로젝트: HPCKP/gridengine
CORBA_Object_ptr getMasterViaNameService(CORBA_ORB_var& orb) {
   char *cell;
   CORBA_Object_ptr obj = CORBA_Object::_nil();

   cell = getenv("SGE_CELL");
   if (!cell)
      cell = "default";

   cout << "Resolving name service...";
   try {
      CORBA_Object_var ns_obj = orb->resolve_initial_references("NameService");
      if(CORBA_is_nil(ns_obj)) {
         cerr << "Sorry, no ns_obj" << endl;
         return obj;
      }
      cout << "done" << endl;
      ns = CosNaming_NamingContext::_narrow(ns_obj);
      if(CORBA_is_nil(ns)) {
         cerr << "Sorry, no ns" << endl;
         return obj;
      }
      name = new CosNaming_Name();
      name->length(2);
      name[0].id = CORBA_string_dup(cell);
      name[0].kind = CORBA_string_dup("");
      name[1].id = CORBA_string_dup("cod_qidl");
      name[1].kind = CORBA_string_dup("");
   
      cout << "resolving master object...";
      obj = ns->resolve(name);
      cout << "done" << endl;
   }
   catch(...) {
      cout << endl << "master not found via nameservice." << endl;
   }

   return obj;
}