LF_CH_Event.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file LF_CH_Event.h
00006  *
00007  *  LF_CH_Event.h,v 1.12 2006/05/14 02:38:11 mesnier_p Exp
00008  *
00009  *  @author Balachandran Natarajan <bala@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_LF_CH_EVENT_H
00014 #define TAO_LF_CH_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 class TAO_LF_Multi_Event;
00027 
00028 /**
00029  * @class TAO_LF_CH_Event
00030  *
00031  * @brief Use the Leader/Follower loop to wait for one specific event
00032  * in the invocation path.
00033  *
00034  * Concrete event types and manipulation class which is used for
00035  * connection handling purposes.
00036  */
00037 class TAO_Export TAO_LF_CH_Event: public TAO_LF_Event
00038 {
00039 public:
00040   /**
00041    * The TAO_LF_Multi_Event class is another specialization of
00042    * TAO_LF_Event, used for aggregating many connection handlers into
00043    * a single event object.. It requires friendship so that it can
00044    * check the is_state_final() flag on each of its contained
00045    * connection handlers.
00046    */
00047   friend class TAO_LF_Multi_Event;
00048 
00049   /// Constructor
00050   TAO_LF_CH_Event (void);
00051 
00052   /// Destructor
00053   virtual ~TAO_LF_CH_Event (void);
00054 
00055   //@{
00056   /// Return 1 if the condition was satisfied successfully, 0 if it
00057   /// has not
00058   int successful (void) const;
00059 
00060   /// Return 1 if an error was detected while waiting for the
00061   /// event
00062   int error_detected (void) const;
00063 
00064 protected:
00065 
00066   /// Check whether we have reached the final state..
00067   virtual int is_state_final (void);
00068 
00069   //@}
00070 private:
00071   /// Validate and change the state
00072   /*
00073    * This concrete class uses the following states declared in the
00074    * class TAO_LF_Event to transition states
00075    *
00076    * LFS_IDLE                  - The event is created, and is in
00077    *                             initial  state.
00078    *
00079    * LFS_CONNECTION_WAIT       - The event is waiting for connection
00080    *                             completion and it can transition to
00081    *                             any of the following states, all the
00082    *                             states are final.
00083    *
00084    * LFS_SUCCESS               - The event, connection establishment, has
00085    *                             completed successfully.
00086    *
00087    * LFS_TIMEOUT               - The event has timed out.
00088    *
00089    * LFS_CONNECTION_CLOSED     - The connection was closed since
00090    *                             an error occured while trying to
00091    *                             establish connection
00092    *
00093    *  Event State Diagram
00094    *  -------------------
00095    *                              |----> CLOSED
00096    *                              |        ^
00097    *                              |        |
00098    *   IDLE ---> CONNECTION_WAIT--|        |
00099    *                              |        |
00100    *                              |        |
00101    *                              |----> SUCESS
00102    *
00103    * Timeouts can occur while waiting for connections.
00104    *
00105    */
00106   virtual void state_changed_i (int new_state);
00107 
00108   /// Set the state irrespective of anything.
00109   virtual void set_state (int new_state);
00110 
00111 private:
00112 
00113   /// The previous state that the LF_CH_Event was in
00114   int prev_state_;
00115 };
00116 
00117 TAO_END_VERSIONED_NAMESPACE_DECL
00118 
00119 #include /**/ "ace/post.h"
00120 
00121 #endif  /* TAO_LF_CH_EVENT_H */

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