1 #include <omniORB4/CORBA.h>
2 
3 #ifdef HAVE_STD
4 #  include <iostream>
5    using namespace std;
6 #else
7 #  include <iostream.h>
8 #endif
9 
10 #include "value.hh"
11 #include "valimpl.h"
12 
main(int argc,char ** argv)13 int main(int argc, char** argv)
14 {
15   CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
16 
17   OneFactory* onef = new OneFactory();
18   orb->register_value_factory("IDL:ValueTest/One:1.0", onef);
19 
20   if (argc != 2) {
21     cerr << "usage: vclient <object reference>" << endl;
22     return 1;
23   }
24 
25   CORBA::Object_var obj = orb->string_to_object(argv[1]);
26 
27   ValueTest::Test_var test = ValueTest::Test::_narrow(obj);
28 
29   One_i* one = new One_i("hello", 12345);
30   One_i* two = new One_i("hello again", 88888);
31 
32   ValueTest::One_var ret;
33 
34   ret = test->op1(one, two);
35 
36   if (ret.in()) {
37     cout << "String: " << ret->s() << ", long: " << ret->l() << endl;
38   }
39   else {
40     cout << "nil" << endl;
41   }
42 
43   ret = test->op1(one, one);
44   ret = test->op1(one, 0);
45   ret = test->op1(0, one);
46   ret = test->op1(0, 0);
47 
48   CORBA::remove_ref(one);
49   CORBA::remove_ref(two);
50   onef->_remove_ref();
51 
52   orb->destroy();
53 
54   return 0;
55 }
56