Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Reconnecting / Supplier.h
blobc1d529325e85a4b6aa4ce342b7acc9d48696fe4e
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Supplier.h
6 * Test Supplier reconnect to existing channel/admin/proxy Notification Service
8 * @author Dale Wilson <wilson_d@ociweb.com>
9 */
10 //=============================================================================
13 #ifndef RECONNECTNG_SUPPLIER_H
14 #define RECONNECTNG_SUPPLIER_H
16 #include "orbsvcs/CosNotifyChannelAdminC.h"
17 #include "orbsvcs/CosNamingC.h"
18 #include "orbsvcs/NotifyExtS.h"
19 #include <ace/SString.h>
21 class Supplier_Main;
23 class StructuredPushSupplier_i : public virtual POA_CosNotifyComm::StructuredPushSupplier
25 virtual void subscription_change (
26 const CosNotification::EventTypeSeq & added,
27 const CosNotification::EventTypeSeq & removed);
29 virtual void disconnect_structured_push_supplier ();
32 class SequencePushSupplier_i : public virtual POA_CosNotifyComm::SequencePushSupplier
34 virtual void subscription_change (
35 const CosNotification::EventTypeSeq & added,
36 const CosNotification::EventTypeSeq & removed);
38 virtual void disconnect_sequence_push_supplier ();
41 class AnyPushSupplier_i : public virtual POA_CosNotifyComm::PushSupplier
43 virtual void subscription_change (
44 const CosNotification::EventTypeSeq & added,
45 const CosNotification::EventTypeSeq & removed);
47 virtual void disconnect_push_supplier ();
50 class ReconnectionCallback_i : public virtual POA_NotifyExt::ReconnectionCallback
52 public:
53 ReconnectionCallback_i (Supplier_Main & supplier_main);
55 virtual ~ReconnectionCallback_i ();
57 void init (
58 PortableServer::POA_ptr poa,
59 CosNotifyChannelAdmin::EventChannelFactory_ptr ecf_);
61 void fini ();
63 size_t reconnect_count () const;
65 virtual void reconnect (CORBA::Object_ptr reconnection);
67 virtual CORBA::Boolean is_alive ();
69 private:
70 Supplier_Main & supplier_main_;
71 bool id_is_valid_;
72 NotifyExt::ReconnectionRegistry::ReconnectionID callback_id_;
73 CosNotifyChannelAdmin::EventChannelFactory_var ecf_;
74 size_t reconnect_count_;
77 class Supplier_Main
79 public:
80 Supplier_Main ();
81 ~Supplier_Main ();
83 int parse_args (int argc, ACE_TCHAR *argv[]);
84 int parse_single_arg (int argc, ACE_TCHAR *argv[]);
86 int init (int argc, ACE_TCHAR *argv[]);
87 int run ();
88 int fini ();
89 void usage (FILE * log) const;
91 void reconnect (
92 CosNotifyChannelAdmin::EventChannelFactory_ptr dest_factory);
94 private:
95 /// Find naming service.
96 int resolve_naming_service ();
98 /// Resolve the Notify factory from the Naming service.
99 int find_notify_factory ();
101 /// Resolve the Notify factory using resolve_initial_reference ("NotifyEventChannelFactory")
102 int resolve_notify_factory ();
104 void init_event_channel ();
105 void init_supplier_admin ();
106 void init_structured_proxy_consumer ();
107 void init_sequence_proxy_consumer ();
108 void init_any_proxy_consumer ();
110 /// send events.
111 void send_structured_event ();
112 void send_sequence_event ();
113 void send_any_event ();
115 void save_ids();
116 bool load_ids();
118 ////////////////////
119 // forbidden methods
120 private:
121 Supplier_Main (const Supplier_Main & rhs);
122 Supplier_Main & operator = (const Supplier_Main & rhs);
124 ////////////////
125 // Data members
126 private:
127 // set by command line parameters
128 bool verbose_; // -v make a glorious noise
129 enum Mode_T {
130 MODE_ANY,
131 MODE_STRUCTURED,
132 MODE_SEQUENCE} mode_; // -any, -structured, or -sequence
133 ACE_TString channel_file_; // -channel filename
134 size_t send_; // -send n
135 bool use_naming_service_; // -nonamesvc
136 size_t serial_number_; // -serial_number
137 bool disconnect_on_exit_; // -disconnect
138 ACE_TString id_file_; // -ids
139 size_t pause_; // -pause n (pause after sending n messages)
140 CORBA::ORB_var orb_;
141 PortableServer::POA_var root_poa_;
142 CosNaming::NamingContext_var naming_context_;
143 CosNotifyChannelAdmin::EventChannelFactory_var ecf_;
145 CosNotifyChannelAdmin::EventChannel_var ec_;
146 CosNotifyChannelAdmin::ChannelID ec_id_;
148 CosNotifyChannelAdmin::SupplierAdmin_var sa_;
149 CosNotifyChannelAdmin::AdminID sa_id_;
151 CosNotifyChannelAdmin::StructuredProxyPushConsumer_var structured_proxy_push_consumer_;
152 CosNotifyChannelAdmin::ProxyID structured_proxy_id_;
153 StructuredPushSupplier_i structured_push_supplier_;
154 CosNotifyComm::StructuredPushSupplier_var structured_push_supplier_ref_;
157 CosNotifyChannelAdmin::SequenceProxyPushConsumer_var sequence_proxy_push_consumer_;
158 CosNotifyChannelAdmin::ProxyID sequence_proxy_id_;
159 SequencePushSupplier_i sequence_push_supplier_;
160 CosNotifyComm::SequencePushSupplier_var sequence_push_supplier_ref_;
162 CosNotifyChannelAdmin::ProxyPushConsumer_var any_proxy_push_consumer_;
163 CosNotifyChannelAdmin::ProxyID any_proxy_id_;
164 AnyPushSupplier_i any_push_supplier_;
165 CosNotifyComm::PushSupplier_var any_push_supplier_ref_;
167 ReconnectionCallback_i reconnection_callback_;
169 bool reconnecting_;
173 #endif /* RECONNECTNG_SUPPLIER_H */