Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Corba-Orb Initialisation in Class Constructor

Corba-Orb Initialisation in Class Constructor

Corba-Orb Initialisation in Class Constructor


   I have got quite a big problem and I wonder if you could help me out!! ! The problem is as follows:

   I declared a Class in C++ called Messenger, offering some methods (Which are passed from my GUI). Its purpose
   is to handle this methods through to a CORBA Server, which passes it to someone else (should be some kind
   of video-conference....).
   So the constructor of the class Messenger should include the initialisation of a CORBA-Orb Client. But I absolutely
   don't have any idea how this works. I have looked at several examples, but they are all main programs
   and no seperated classes like I have.

   The code as it is suggested in the main programms is:
   main(int argc, char * argv[])
   // Initialize the ORB
   CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
   // Convert the contents of the file to an object reference.
   CORBA::Object_var obj = orb->string_to_object("file://Messenger.ior");
   if (CORBA::is_nil(obj.in()))
   cerr << "Nil Messenger reference" << endl;
   throw 0;
   // Narrow the object reference to a Messenger object reference.
   Messenger_var messenger = Messenger::_narrow(obj.in());
   if (CORBA::is_nil(messenger.in ()))
   cerr << "Not a Messenger object reference" << endl;
   throw 0;
   // Create a message and send it to the Messenger.
   CORBA::String_var message = CORBA::string_dup("Howdy!");
   messenger->send_message ("rick", "Test", message.inout());
   // Release resources.
   catch (const CORBA::Exception & ex)
   cerr << "Caught a CORBA exception: " << ex << endl;
   return 1;
   catch (...)
   return 1;
   cout << "Message was sent" << endl;
   return 0;

   exception handling included. I don't see the point of the following code line:
   CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);

   What are the parameters for, given the init-method??

   I hope you understand what I am asking. Sorry for my bad English . I'm going to learn it better  (At least I
   hope so...)

   Thank you very much for your help!

RE: Corba-Orb Initialisation in Class Constructor

You need not give any arguments to the main program unless it's needed.  
         in most of the corba implementations like visibroker, if you specify any arguments at the command line for main, they will be used only if they make sense to the orb. Otherwise they will be ignored.
            Please refer to the documentation to find out what valid arguments you can pass as command line parameters to control the corba server.

RE: Corba-Orb Initialisation in Class Constructor

hi charly,
why don't you use argc and argv from the main() as your class' constructor input params (or as input to an init() func which sound better)?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close