2 //=============================================================================
4 * @file FT_FaultConsumer.h
6 * This file is part of TAO's implementation of Fault Tolerant CORBA.
8 * @author Steve Totten <totten_s@ociweb.com>
10 //=============================================================================
13 #ifndef FT_FAULT_CONSUMER_H_
14 #define FT_FAULT_CONSUMER_H_
16 #include /**/ "ace/pre.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "orbsvcs/CosNotifyCommS.h"
24 #include "orbsvcs/FT_NotifierC.h"
25 #include "FT_ReplicationManagerLib_export.h"
27 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
32 ///////////////////////
33 // Forward declarations
34 class FT_FaultAnalyzer
;
37 * Implement the CosNotifyComm::StructuredPushConsumer interface.
40 class TAO_ReplicationManagerLib_Export FT_FaultConsumer
41 : public virtual POA_CosNotifyComm::StructuredPushConsumer
44 //////////////////////
45 // non-CORBA interface
49 * Default constructor.
56 virtual ~FT_FaultConsumer ();
59 * Connect to the FT::FaultNotifier.
60 * Note: We make the following assumptions about what the
61 * application will do:
62 * - Create an instance of this consumer class.
63 * - Obtain the object reference of the FaultNotifier to which this
64 * consumer should connect.
65 * - Call this init() method, passing it the POA with which we
66 * have been activated, the FaultNotifier, and ReplicationManager
70 PortableServer::POA_ptr poa
,
71 FT::FaultNotifier_ptr fault_notifier
,
72 TAO::FT_FaultAnalyzer
* fault_analyzer
);
75 * Clean house for process shut down.
76 * - Disconnect from FT::FaultNotifier.
77 * - Deactivate from the POA.
82 * Accessor for a duplicate of this consumer's object reference.
84 CosNotifyComm::StructuredPushConsumer_ptr
consumer_ref ();
86 //@@ For testing purposes only, will be removed later.
88 * Accessor for the number of notifications we have received.
90 size_t notifications () const;
95 * @name POA_CosNotifyComm::StructuredPushConsumer Methods
97 * Methods required by the POA_CosNotifyComm::StructuredPushConsumer
104 virtual void push_structured_event (
105 const CosNotification::StructuredEvent
¬ification
);
107 virtual void offer_change (
108 const CosNotification::EventTypeSeq
& added
,
109 const CosNotification::EventTypeSeq
& removed
);
111 virtual void disconnect_structured_push_consumer ();
118 /// Copy constructor.
119 FT_FaultConsumer (const FT_FaultConsumer
& rhs
);
120 /// Assignment operator.
121 FT_FaultConsumer
& operator = (const FT_FaultConsumer
& rhs
);
127 /// The POA with which we are activated.
128 PortableServer::POA_var poa_
;
130 /// The ObjectId from our activation in the POA.
131 PortableServer::ObjectId_var object_id_
;
133 /// The FaultNotifier's object reference.
134 FT::FaultNotifier_var fault_notifier_
;
136 /// Application-specific Fault Analyzer.
137 TAO::FT_FaultAnalyzer
* fault_analyzer_
;
139 /// ConsumerId assigned by the notifier.
140 FT::FaultNotifier::ConsumerId consumer_id_
;
142 /// Our consumer object reference.
143 CosNotifyComm::StructuredPushConsumer_var consumer_ref_
;
145 ///TODO: Remove this later, it is just for testing.
146 // Keep track of how many notifications we have received.
147 size_t notifications_
;
153 TAO_END_VERSIONED_NAMESPACE_DECL
155 #include /**/ "ace/post.h"
157 #endif /* FT_FAULT_CONSUMER_H_ */