Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / orbsvcs / FT_ReplicationManager / FT_FaultConsumer.h
blobcf86895b42423e6dd8454d4c20c34ce2b5b0f8ef
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
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>
9 */
10 //=============================================================================
13 #ifndef FT_FAULT_CONSUMER_H_
14 #define FT_FAULT_CONSUMER_H_
16 #include /**/ "ace/pre.h"
17 #include <ace/ACE.h>
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #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
29 namespace TAO
31 ///////////////////////
32 // Forward declarations
33 class FT_FaultAnalyzer;
35 /**
36 * Implement the CosNotifyComm::StructuredPushConsumer interface.
39 class TAO_ReplicationManagerLib_Export FT_FaultConsumer
40 : public virtual POA_CosNotifyComm::StructuredPushConsumer
42 //////////////////////
43 // non-CORBA interface
45 public:
46 /**
47 * Default constructor.
49 FT_FaultConsumer ();
51 /**
52 * Destructor.
54 virtual ~FT_FaultConsumer ();
56 /**
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
65 * object references.
67 int init (
68 PortableServer::POA_ptr poa,
69 FT::FaultNotifier_ptr fault_notifier,
70 TAO::FT_FaultAnalyzer * fault_analyzer);
72 /**
73 * Clean house for process shut down.
74 * - Disconnect from FT::FaultNotifier.
75 * - Deactivate from the POA.
77 int fini ();
79 /**
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.
85 /**
86 * Accessor for the number of notifications we have received.
88 size_t notifications () const;
90 public:
91 /**
92 * @name POA_CosNotifyComm::StructuredPushConsumer Methods
94 * Methods required by the POA_CosNotifyComm::StructuredPushConsumer
95 * interface.
97 //@{
98 ////////////////
99 // CORBA methods
100 virtual void push_structured_event (
101 const CosNotification::StructuredEvent &notification);
103 virtual void offer_change (
104 const CosNotification::EventTypeSeq & added,
105 const CosNotification::EventTypeSeq & removed);
107 virtual void disconnect_structured_push_consumer ();
109 //@}
111 ////////////////////
112 // Forbidden methods
113 private:
114 /// Copy constructor.
115 FT_FaultConsumer (const FT_FaultConsumer & rhs);
116 /// Assignment operator.
117 FT_FaultConsumer & operator = (const FT_FaultConsumer & rhs);
119 ///////////////
120 // Data Members
121 private:
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_;
144 } // namespace TAO
146 TAO_END_VERSIONED_NAMESPACE_DECL
148 #include /**/ "ace/post.h"
150 #endif /* FT_FAULT_CONSUMER_H_ */