1 #include "MessengerC.h"
5 const char* server_ior
= "file://server.ior";
6 using namespace demo::value::idl
;
7 const char* IOR
= "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
9 int ACE_TMAIN (int ac
, ACE_TCHAR
* av
[]) {
11 CORBA::ORB_var orb
= CORBA::ORB_init(ac
, av
);
13 NodeFactory::register_new_factory(* orb
.in());
14 BoxedValueFactory::register_new_factory(* orb
.in());
15 BaseValueFactory::register_new_factory(* orb
.in());
16 TValueFactory::register_new_factory(* orb
.in());
17 ConfigValueFactory::register_new_factory(* orb
.in());
19 CORBA::Object_var obj
= orb
->string_to_object(server_ior
);
20 ValueServer_var tst
= ValueServer::_narrow(obj
.in());
21 ACE_ASSERT(! CORBA::is_nil(tst
.in()));
23 // invoke operations and print the results
24 boxedLong
* p1
= new boxedLong (774);
25 boxedLong
* p2
= new boxedLong (775);
26 boxedString
* s1
= new boxedString ("hello");
27 boxedString
* s2
= new boxedString ("world");
28 boxedString
* null
= 0;
29 boxedValue
* b
= new OBV_demo::value::idl::boxedValue ();
32 boxedValue
* bb
= new OBV_demo::value::idl::boxedValue ();
36 ACE_DEBUG ((LM_DEBUG
, "(%P|%t)Passing two boxed values in one valuetype: %s\n",
37 tst
->receive_boxedvalue (b
)));
38 ACE_DEBUG ((LM_DEBUG
, "(%P|%t)Passing one boxed values twice in one valuetype: %s\n",
39 tst
->receive_boxedvalue (bb
)));
40 ACE_DEBUG ((LM_DEBUG
, "(%P|%t)Passing two integers: %s\n",
41 tst
->receive_long (p1
, p2
)));
42 ACE_DEBUG ((LM_DEBUG
, "(%P|%t)Passing one integer twice: %s\n",
43 tst
->receive_long (p1
, p1
)));
44 ACE_DEBUG ((LM_DEBUG
, "(%P|%t)Passing two strings: %s\n",
45 tst
->receive_string (s1
, s2
)));
46 ACE_DEBUG ((LM_DEBUG
, "(%P|%t)Passing null: %s\n",
47 tst
->receive_string (s1
, null
)));
49 Node
* n4
= new OBV_demo::value::idl::Node (4, 0);
50 Node
* n3
= new OBV_demo::value::idl::Node (3, n4
);
51 Node
* n2
= new OBV_demo::value::idl::Node (2, n3
);
52 Node
* n1
= new OBV_demo::value::idl::Node (1, n2
);
56 ACE_DEBUG ((LM_DEBUG
, "(%P|%t)Passing a list structure: %s\n",
57 tst
->receive_list (n1
)));
60 TValue
* t
= new OBV_demo::value::idl::TValue ();
64 ACE_DEBUG ((LM_DEBUG
, "(%P|%t)Passing inout truncatable: %s\n",
65 tst
->receive_truncatable (t
)));
66 if (t
->data () != 21 || t
->basic_data () != 11)
68 std::cerr
<< "Received incorrect truncatable data" << std::endl
;
73 const CORBA::ULong sz
= 50;
74 ::demo::value::idl::ConfigValues
configs (sz
);
76 for (CORBA::ULong i
= 0; i
< sz
; ++i
)
78 configs
[i
] = new ConfigValueImpl ("IOR", IOR
);
81 ACE_DEBUG ((LM_DEBUG
, "(%P|%t)Passing sequence: %s\n",
82 tst
->receive_sequence (configs
)));
84 while (orb
->work_pending()) {
89 } catch(const CORBA::Exception
& e
) {
90 std::cerr
<< e
<< std::endl
;