Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / examples / Simulator / Event_Supplier / DOVE_Supplier.h
blob8fb279a321d89205c54e607289f1969f66657321
2 //=============================================================================
3 /**
4 * @file DOVE_Supplier.h
6 * A wrapper around the event service initialization and marshalling.
8 * @author Michael Kircher (mk1@cs.wustl.edu) Chris Gill (cdgill@cs.wustl.edu)
9 */
10 //=============================================================================
13 #include "orbsvcs/RtecEventChannelAdminC.h"
15 #if !defined (ACE_LACKS_PRAGMA_ONCE)
16 # pragma once
17 #endif /* ACE_LACKS_PRAGMA_ONCE */
19 #include "orbsvcs/RtecEventCommS.h"
20 #include "orbsvcs/Event_Utilities.h"
21 #include "orbsvcs/Event_Service_Constants.h"
22 #include "orbsvcs/Scheduler_Factory.h"
25 #ifndef DOVE_SUPPLIER_H
26 #define DOVE_SUPPLIER_H
28 #define SOURCE_ID 123
30 class DOVE_Supplier
32 public:
33 /// Constructor.
34 DOVE_Supplier ();
36 /// Destructor.
37 ~DOVE_Supplier ();
39 /// Initialize the ORB and the connection to the Name Service
40 int init ();
42 /// Connect to the event service.
43 int connect (const char * MIB_name = 0,
44 const char* es_name = 0,
45 const char * ss_name = 0,
46 ACE_Scheduler_Factory::POD_RT_Info * pod_rt_info = 0);
48 /// Perform all post-connection-establishment processing.
49 void connected ();
51 /// Disconnect from the event service.
52 void disconnect ();
54 /// Notify the consumer proxy that we have events
55 void notify (CORBA::Any& message);
57 /// Use the next connection in the list of established connections.
58 void use_next_connection ();
60 /// Use the previous connection in the list of established connections.
61 void use_prev_connection ();
63 private:
64 // The following Supplier is needed because DOVE_Supplier has not
65 // inherited from PushSupplier.
67 class Internal_DOVE_Supplier : public POA_RtecEventComm::PushSupplier
69 friend class DOVE_Supplier;
71 public:
72 virtual void disconnect_push_supplier ()
76 private:
77 Internal_DOVE_Supplier (DOVE_Supplier* impl_ptr);
79 DOVE_Supplier* impl_ptr_;
82 private:
83 struct Connection_Params
85 const char * es_name_;
86 const char * ss_name_;
87 RtecEventChannelAdmin::EventChannel_var eventChannel_var_;
88 RtecEventChannelAdmin::SupplierAdmin_var supplierAdmin_var_;
89 RtecEventChannelAdmin::ProxyPushConsumer_var proxyPushConsumer_var_;
90 RtecScheduler::Scheduler_var scheduler_var_;
91 RtecScheduler::handle_t rt_info_;
92 ACE_Scheduler_Factory::POD_RT_Info pod_rt_info_;
95 /// Get the event channel reference.
96 int get_EventChannel ();
98 /// Get the scheduler reference.
99 int get_Scheduler ();
101 /// Connect the the supplier with the event channel.
102 int connect_Supplier ();
104 /// Access the default rt_info singleton.
105 static ACE_Scheduler_Factory::POD_RT_Info * pod_rt_info_instance ();
107 static ACE_Scheduler_Factory::POD_RT_Info * pod_rt_info_instance_;
109 // Object initialization flags
110 int initialized_;
111 int connected_;
113 Connection_Params ** connection_params_list_;
114 Connection_Params * current_connection_params_;
115 int connection_count_;
116 int current_connection_index_;
118 // = ORB, ORB Services adminstration references.
119 CosNaming::NamingContext_var namingContext_var_;
120 PortableServer::POA_var root_POA_var_;
121 PortableServer::POAManager_var poa_manager_;
123 Internal_DOVE_Supplier* internal_DOVE_Supplier_ptr_;
125 /// Keep the name of the MIB around.
126 const char * MIB_name_;
129 #endif /* DOVE_SUPPLIER_H */