gnuace: use list of generated files from GENERATED_DIRTY for ADDITIONAL_IDL_TARGETS
[ACE_TAO.git] / ACE / ace / Countdown_Time_T.h
blob12aab657bf1c583f5efcb10480562b3d5b827dad
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Countdown_Time_T.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //=============================================================================
11 #ifndef ACE_COUNTDOWN_TIME_T_H
12 #define ACE_COUNTDOWN_TIME_T_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/ACE_export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/Time_Value.h"
23 #include "ace/Time_Policy.h"
24 #include "ace/Copy_Disabled.h"
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 /**
29 * @class ACE_Countdown_Time
31 * @brief Keeps track of the amount of elapsed time.
33 * This class has a side-effect on the @c max_wait_time -- every
34 * time the stop() method is called the @c max_wait_time is
35 * updated.
37 template <typename TIME_POLICY = ACE_Default_Time_Policy>
38 class ACE_Countdown_Time_T : private ACE_Copy_Disabled
40 public:
41 /// Cache the @a max_wait_time and call @c start().
42 ACE_Countdown_Time_T (ACE_Time_Value *max_wait_time,
43 TIME_POLICY const & time_policy = TIME_POLICY());
45 /// Destructor, makes sure the max_wait_time that got passed as pointer
46 /// to the constructor is updated with the time elapsed.
47 ~ACE_Countdown_Time_T (void);
49 /// Cache the current time and enter a start state.
50 void start (void);
52 /// Subtract the elapsed time from max_wait_time_ and enter a stopped
53 /// state.
54 void stop (void);
56 /// Calls stop and then start. max_wait_time_ is modified by the
57 /// call to stop.
58 void update (void);
60 /// Returns true if we've already been stopped, else false.
61 bool stopped (void) const;
63 /// Allows applications to control how the timer queue gets the time
64 /// of day.
65 void set_time_policy(TIME_POLICY const & time_policy);
67 private:
68 /// The policy to return the current time of day
69 TIME_POLICY time_policy_;
71 /// Maximum time we are monitoring
72 ACE_Time_Value *max_wait_time_;
74 /// Copy of the maximum time value, used to avoid nested decrements
75 ACE_Time_Value max_wait_value_;
77 /// Beginning of the start time.
78 ACE_Time_Value start_time_;
80 /// Keeps track of whether we've already been stopped.
81 bool stopped_;
84 ACE_END_VERSIONED_NAMESPACE_DECL
86 #include /**/ "ace/post.h"
88 #if defined (__ACE_INLINE__)
89 #include "ace/Countdown_Time_T.inl"
90 #endif /* __ACE_INLINE__ */
92 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
93 #include "ace/Countdown_Time_T.cpp"
94 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
96 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
97 #pragma implementation ("Countdown_Time_T.cpp")
98 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
101 #endif /* ACE_COUNTDOWN_TIME_T_H */