LF_Multi_Event.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file LF_Multi_Event.h
00006  *
00007  *  LF_Multi_Event.h,v 1.2 2006/05/03 03:38:25 mesnier_p Exp
00008  *
00009  *  @author Phil Mesnier <mesnier_p@ociweb.com>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_LF_MULTI_EVENT_H
00014 #define TAO_LF_MULTI_EVENT_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "tao/LF_Event.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 // Forward decls
00027 class TAO_Connection_Handler;
00028 class TAO_Transport;
00029 
00030 /**
00031  * @class TAO_LF_Multi_Event
00032  *
00033  * @brief Use the Leader/Follower loop to wait for one specific event
00034  * in the invocation path.
00035  *
00036  * Used by the parallel connection strategy for waiting on one of many
00037  * connections.
00038  */
00039 class TAO_Export TAO_LF_Multi_Event: public TAO_LF_Event
00040 {
00041 public:
00042   /// Constructor
00043   TAO_LF_Multi_Event (void);
00044 
00045   /// Destructor
00046   virtual ~TAO_LF_Multi_Event (void);
00047 
00048   /// propogate the follower to all the events in the collection.
00049   virtual int bind (TAO_LF_Follower *follower);
00050 
00051   /// Unbind the follower from all the collected events.
00052   virtual int unbind (void);
00053 
00054   /// Adds a handler to the collection
00055   void add_event (TAO_Connection_Handler *ch);
00056 
00057   /// Returns the connection handler that caused the successful status
00058   /// to be returned.
00059   TAO_Connection_Handler *winner(void);
00060 
00061   /// Returns the transport associated with the first entry in the collection.
00062   TAO_Transport *base_transport(void);
00063 
00064   //@{
00065   /// Return 1 if the condition was satisfied successfully, 0 if it
00066   /// has not - This iterates over the list of attached events and
00067   /// returns 1 if any of them return 1 from successful.
00068   int successful (void) const;
00069 
00070   /// Return 1 if an error was detected while waiting for the
00071   /// event - This iterates over the list of events and returns
00072   /// 1 only if all of them return 1 from error_detected.
00073   int error_detected (void) const;
00074 
00075   //@}
00076 protected:
00077 
00078   /// Validate the state change
00079   virtual void state_changed_i (int new_state);
00080 
00081   /// Check whether we have reached the final state..
00082   virtual int is_state_final (void);
00083 
00084 private:
00085 
00086   struct Event_Node {
00087     TAO_Connection_Handler * ptr_;
00088     Event_Node *next_;
00089   };
00090 
00091   struct Event_Node *events_;
00092 
00093   mutable TAO_Connection_Handler * winner_;
00094 
00095 };
00096 
00097 TAO_END_VERSIONED_NAMESPACE_DECL
00098 
00099 #include /**/ "ace/post.h"
00100 
00101 #endif  /* TAO_LF_Multi_EVENT_H */

Generated on Thu Nov 9 11:54:15 2006 for TAO by doxygen 1.3.6