Beispiel #1
0
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  try
    {
      CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
      CORBA::Object_var object =
        orb->resolve_initial_references ("InterfaceRepository");

      if (CORBA::is_nil (object.in ()))
        {
          ACE_ERROR_RETURN ((
              LM_ERROR,
              "Null objref from resolve_initial_references\n"),
             -1);
        }

      CORBA::Repository_var  ifr =
        CORBA::Repository::_narrow (object.in ());

      if (CORBA::is_nil (ifr.in ()))
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             "CORBA::Repository::_narrow failed\n"),
                            -1);
        }

      CORBA::ContainedSeq_var cont = ifr->contents (CORBA::dk_all, 0);

      printContents (cont.in ());

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("main");
      return -1;
    }

  return 0;
}
Beispiel #2
0
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  try
  {
    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);

    CORBA::Object_var obj =
      orb->resolve_initial_references("InterfaceRepository");

    CORBA::Repository_var ifrRepo = CORBA::Repository::_narrow(obj.in());

    if (CORBA::is_nil(ifrRepo.in()))
    {
      ACE_DEBUG((LM_ERROR,
        ACE_TEXT("(%N) failed to narrow interface repository referece.\n")
        ));
      return -1;
    }

    CORBA::ContainedSeq_var repoContents = ifrRepo->contents(CORBA::dk_all, 1);

    ACE_DEBUG((LM_INFO,
      ACE_TEXT("%s: the interface repository contains %d elements.\n"),
      programLabel,
      repoContents->length()
      ));
    listContents(repoContents.in());

    return 0;
  }
  catch(const CORBA::Exception& ex)
  {
    std::cerr << "main() Caught CORBA::Exception : " << ex << std::endl;
  }
  return 1;
}