2 #include "Stock_Consumer.h"
3 #include <orbsvcs/CosNamingC.h>
4 #include <orbsvcs/Event_Utilities.h>
5 #include "ace/streams.h"
6 #include "ace/OS_NS_string.h"
7 #include "tao/Exception.h"
9 int ACE_TMAIN (int argc
, ACE_TCHAR
* argv
[])
12 // First initialize the ORB, that will remove some arguments...
14 CORBA::ORB_init (argc
, argv
);
15 CORBA::Object_var poa_object
=
16 orb
->resolve_initial_references ("RootPOA");
17 PortableServer::POA_var poa
=
18 PortableServer::POA::_narrow (poa_object
.in ());
19 PortableServer::POAManager_var poa_manager
=
20 poa
->the_POAManager ();
21 poa_manager
->activate ();
23 CORBA::Object_var naming_context_object
=
24 orb
->resolve_initial_references ("NameService");
25 CosNaming::NamingContext_var naming_context
=
26 CosNaming::NamingContext::_narrow (naming_context_object
.in ());
28 CosNaming::Name
name (1);
30 name
[0].id
= CORBA::string_dup ("EventService");
32 CORBA::Object_var ec_object
=
33 naming_context
->resolve (name
);
35 // Now downcast the object reference to the appropriate type
36 RtecEventChannelAdmin::EventChannel_var ec
=
37 RtecEventChannelAdmin::EventChannel::_narrow (ec_object
.in ());
39 ACE_ConsumerQOS_Factory qos
;
40 qos
.start_disjunction_group ();
42 for (int i
= 1; i
!= argc
; ++i
) {
43 if (ACE_OS::strlen (argv
[i
]) < 4)
47 ((int(argv
[i
][0]) << 24)
48 | (int(argv
[i
][1]) << 16)
49 | (int(argv
[i
][2]) << 8)
52 qos
.insert_type (type
, 0);
55 Stock_Consumer stock_consumer_i
;
56 stock_consumer_i
.connect (ec
.in (), qos
.get_ConsumerQOS ());
60 stock_consumer_i
.disconnect ();
62 poa
->destroy (true, true);
65 catch (const CORBA::Exception
&ex
) {
66 cerr
<< "CORBA exception raised!" << ex
<< endl
;