3 //=============================================================================
5 * @file Auto_IncDec_T.h
7 * @author Edan Ayal <EdanA@cti2.com>
9 //=============================================================================
12 #ifndef ACE_AUTO_INCDEC_T_H
13 #define ACE_AUTO_INCDEC_T_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/config-all.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "ace/Global_Macros.h"
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 * @class ACE_Auto_IncDec
30 * @brief This class automatically increments and decrements a
31 * parameterized counter.
33 * This data structure is meant to be used within a method,
34 * function, or scope. The actual parameter given for the
35 * @c ACE_SAFELY_INCREMENTABLE_DECREMENTABLE template parameter
36 * must provide at least operators ++ and --.
38 template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE
>
42 /// Implicitly increment the counter.
43 ACE_Auto_IncDec (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE
&counter
);
45 /// Implicitly decrement the counter.
46 ~ACE_Auto_IncDec (void);
48 /// Dump the state of an object.
49 void dump (void) const;
51 /// Declare the dynamic allocation hooks.
52 ACE_ALLOC_HOOK_DECLARE
;
55 /// Reference to the @c ACE_SAFELY_INCREMENTABLE_DECREMENTABLE counter
56 /// we're incrementing/decrementing.
57 ACE_SAFELY_INCREMENTABLE_DECREMENTABLE
&counter_
;
59 ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Auto_IncDec
<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE
> &))
60 ACE_UNIMPLEMENTED_FUNC (ACE_Auto_IncDec (const ACE_Auto_IncDec
<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE
> &))
63 ACE_END_VERSIONED_NAMESPACE_DECL
65 #if defined (__ACE_INLINE__)
66 #include "ace/Auto_IncDec_T.inl"
67 #endif /* __ACE_INLINE__ */
69 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
70 #include "ace/Auto_IncDec_T.cpp"
71 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
73 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
74 #pragma implementation ("Auto_IncDec_T.cpp")
75 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
77 #include /**/ "ace/post.h"
79 #endif /* ACE_AUTO_INCDEC_T_H */