Countdown_Time.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Countdown_Time.h
00006  *
00007  *  Countdown_Time.h,v 4.3 2005/10/28 16:14:52 ossama Exp
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_COUNTDOWN_TIME_H
00014 #define ACE_COUNTDOWN_TIME_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/ACE_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ace/Time_Value.h"
00025 
00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00027 
00028 /**
00029  * @class ACE_Countdown_Time
00030  *
00031  * @brief Keeps track of the amount of elapsed time.
00032  *
00033  * This class has a side-effect on the <max_wait_time> -- every
00034  * time the <stop> method is called the <max_wait_time> is
00035  * updated.
00036  */
00037 class ACE_Export ACE_Countdown_Time
00038 {
00039 public:
00040   // = Initialization and termination methods.
00041   /// Cache the <max_wait_time> and call <start>.
00042   ACE_Countdown_Time (ACE_Time_Value *max_wait_time);
00043 
00044   /// Call <stop>.
00045   ~ACE_Countdown_Time (void);
00046 
00047   /// Cache the current time and enter a start state.
00048   int start (void);
00049 
00050   /// Subtract the elapsed time from max_wait_time_ and enter a stopped
00051   /// state.
00052   int stop (void);
00053 
00054   /// Calls stop and then start.  max_wait_time_ is modified by the
00055   /// call to stop.
00056   int update (void);
00057 
00058   /// Returns 1 if we've already been stopped, else 0.
00059   int stopped (void) const;
00060 
00061 private:
00062   /// Maximum time we were willing to wait.
00063   ACE_Time_Value *max_wait_time_;
00064 
00065   /// Beginning of the start time.
00066   ACE_Time_Value start_time_;
00067 
00068   /// Keeps track of whether we've already been stopped.
00069   int stopped_;
00070 
00071   // Prevent copying
00072   ACE_Countdown_Time (const ACE_Countdown_Time &);
00073   ACE_Countdown_Time &operator= (const ACE_Countdown_Time &);
00074 };
00075 
00076 ACE_END_VERSIONED_NAMESPACE_DECL
00077 
00078 #include /**/ "ace/post.h"
00079 
00080 #endif /* ACE_COUNTDOWN_TIME_H */

Generated on Thu Nov 9 09:41:49 2006 for ACE by doxygen 1.3.6