Re: orbit-list digest, Vol 1 #696 - 2 msgs



> The problem I'm having is finding the C mapping equivalent of lines 32
> to 36 where I "narrow" my reference to the desired object. Any examples
> or advice would be greatly appreciatted. In the meantime I'll carry on
> reading the OMG C mapping spec.
> 
> 

I think there's an example in the source? Anyway, what worked for me
(ORBit 1.15 or so):

~Matt
matt@trpz.com

  /* TODO Could use ORBit_string_to_CosNaming_Name() to make names
easier,
    and possibly the lname functions from ORBIt */
  CosNaming_Name *name = NULL;

    case 'f':
      // Read in the name service IOR from a file.
      strcpy(infile_name, optarg);
      infile = fopen(optarg,"rb");
      if (infile == NULL) {
	printf("Unable to open file: %s\n", infile_name);
	exit(2);
      }
      size = fread(ns_ior_string, 1, MAX_IOR_LEN, infile);
      fclose(infile);
      // TODO check that IOR was not truncated
      /* Ensure that the ior string is terminated correctly */
      ns_ior_string[--size] = '\0'; 
      use_ns = 1;
      break;

  int orb_argc = 2;
  char* orb_argv[2] = { "controller", "-ORBIIOPIPv4=1" };

  // Initialize the orb, passing in any command line ORB configuration
  CORBA_exception_init(&ev);
  orb = CORBA_ORB_init(&orb_argc, orb_argv, "orbit-local-orb", &ev);


    // Resolve the object reference to the name service
    CosNaming_NamingContext ns = CORBA_ORB_string_to_object(orb,
ns_ior_string, &ev);
    if(checkException(&ev)) {
      printf("Error: cannot connect to the name service in file
\"%s\"\n", infile_name);
      exit(1);
    }
	// Now resolve a name to an IOR of something
    name = ORBit_string_to_CosNaming_Name (requested_name, &ev);
    if(checkException(&ev)) {
      printf("Error: cannot create CORBA name for \"%s\"\n",
requested_name);
      exit(1);
    }
   




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]