Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / FT_ReplicationManager / FT_FaultConsumer.h
blob48cf24e59701f6103d1bc5cc4eb8a424d37f3f71
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
32 ///////////////////////
33 // Forward declarations
34 class FT_FaultAnalyzer;
36 /**
37 * Implement the CosNotifyComm::StructuredPushConsumer interface.
40 class TAO_ReplicationManagerLib_Export FT_FaultConsumer
41 : public virtual POA_CosNotifyComm::StructuredPushConsumer
44 //////////////////////
45 // non-CORBA interface
47 public:
48 /**
49 * Default constructor.
51 FT_FaultConsumer ();
53 /**
54 * Destructor.
56 virtual ~FT_FaultConsumer ();
58 /**
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
67 * object references.
69 int init (
70 PortableServer::POA_ptr poa,
71 FT::FaultNotifier_ptr fault_notifier,
72 TAO::FT_FaultAnalyzer * fault_analyzer);
74 /**
75 * Clean house for process shut down.
76 * - Disconnect from FT::FaultNotifier.
77 * - Deactivate from the POA.
79 int fini (void);
81 /**
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.
87 /**
88 * Accessor for the number of notifications we have received.
90 size_t notifications () const;
92 public:
94 /**
95 * @name POA_CosNotifyComm::StructuredPushConsumer Methods
97 * Methods required by the POA_CosNotifyComm::StructuredPushConsumer
98 * interface.
100 //@{
102 ////////////////
103 // CORBA methods
104 virtual void push_structured_event (
105 const CosNotification::StructuredEvent &notification);
107 virtual void offer_change (
108 const CosNotification::EventTypeSeq & added,
109 const CosNotification::EventTypeSeq & removed);
111 virtual void disconnect_structured_push_consumer ();
113 //@}
115 ////////////////////
116 // Forbidden methods
117 private:
118 /// Copy constructor.
119 FT_FaultConsumer (const FT_FaultConsumer & rhs);
120 /// Assignment operator.
121 FT_FaultConsumer & operator = (const FT_FaultConsumer & rhs);
123 ///////////////
124 // Data Members
125 private:
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_;
151 } // namespace TAO
153 TAO_END_VERSIONED_NAMESPACE_DECL
155 #include /**/ "ace/post.h"
157 #endif /* FT_FAULT_CONSUMER_H_ */