JebeDIAHSpringFieLd
Programmer
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[])
{
try
{
// 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.
orb->destroy();
}
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!
Charly