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
31 ///////////////////////
32 // Forward declarations
33 class FT_FaultAnalyzer
;
36 * Implement the CosNotifyComm::StructuredPushConsumer interface.
39 class TAO_ReplicationManagerLib_Export FT_FaultConsumer
40 : public virtual POA_CosNotifyComm::StructuredPushConsumer
42 //////////////////////
43 // non-CORBA interface
47 * Default constructor.
54 virtual ~FT_FaultConsumer ();
57 * Connect to the FT::FaultNotifier.
58 * Note: We make the following assumptions about what the
59 * application will do:
60 * - Create an instance of this consumer class.
61 * - Obtain the object reference of the FaultNotifier to which this
62 * consumer should connect.
63 * - Call this init() method, passing it the POA with which we
64 * have been activated, the FaultNotifier, and ReplicationManager
68 PortableServer::POA_ptr poa
,
69 FT::FaultNotifier_ptr fault_notifier
,
70 TAO::FT_FaultAnalyzer
* fault_analyzer
);
73 * Clean house for process shut down.
74 * - Disconnect from FT::FaultNotifier.
75 * - Deactivate from the POA.
80 * Accessor for a duplicate of this consumer's object reference.
82 CosNotifyComm::StructuredPushConsumer_ptr
consumer_ref ();
84 //@@ For testing purposes only, will be removed later.
86 * Accessor for the number of notifications we have received.
88 size_t notifications () const;
92 * @name POA_CosNotifyComm::StructuredPushConsumer Methods
94 * Methods required by the POA_CosNotifyComm::StructuredPushConsumer
100 virtual void push_structured_event (
101 const CosNotification::StructuredEvent
¬ification
);
103 virtual void offer_change (
104 const CosNotification::EventTypeSeq
& added
,
105 const CosNotification::EventTypeSeq
& removed
);
107 virtual void disconnect_structured_push_consumer ();
114 /// Copy constructor.
115 FT_FaultConsumer (const FT_FaultConsumer
& rhs
);
116 /// Assignment operator.
117 FT_FaultConsumer
& operator = (const FT_FaultConsumer
& rhs
);
122 /// The POA with which we are activated.
123 PortableServer::POA_var poa_
;
125 /// The ObjectId from our activation in the POA.
126 PortableServer::ObjectId_var object_id_
;
128 /// The FaultNotifier's object reference.
129 FT::FaultNotifier_var fault_notifier_
;
131 /// Application-specific Fault Analyzer.
132 TAO::FT_FaultAnalyzer
* fault_analyzer_
;
134 /// ConsumerId assigned by the notifier.
135 FT::FaultNotifier::ConsumerId consumer_id_
;
137 /// Our consumer object reference.
138 CosNotifyComm::StructuredPushConsumer_var consumer_ref_
;
140 ///TODO: Remove this later, it is just for testing.
141 // Keep track of how many notifications we have received.
142 size_t notifications_
;
146 TAO_END_VERSIONED_NAMESPACE_DECL
148 #include /**/ "ace/post.h"
150 #endif /* FT_FAULT_CONSUMER_H_ */