1 // ////////////////////////////////////////////////////////
2 // Lecture on the CORBA Component Model, summer term 2003
3 // Assignment 2, Stephan Brumme, 702544
4 //
5 // CORBA client that class a remote "reverse" operation
6 //
7
8 // save and display IOR
9 #include <iostream>
10 #include <fstream>
11
12 // IDL compiler generated a stub
13 #include "Aufgabe2.h"
14 using namespace Aufgabe2;
15
16
17 int main(int argc, char* argv[])
18 {
19 // initialize CORBA and its BOA components
20 CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "mico-local-orb");
21 CORBA::BOA_var boa = orb->BOA_init(argc, argv, "mico-local-boa");
22
23 // read IOR
24 char reference[1000];
25 std::ifstream ior("ior.txt");
26 ior >> reference;
27 ior.close();
28 std::cout << reference << std::endl;
29
30 // create and cast the remote object
31 CORBA::Object_var obj = orb->string_to_object(reference);
32 Server_var remote = Server::_narrow(obj);
33
34 // invoke the "reverse" operation
35 std::cout << remote->reverse("Corba Component Model") << std::endl;
36
37 return 0;
38 }
39