Auto_IncDec_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Auto_IncDec_T.h
00006  *
00007  *  Auto_IncDec_T.h,v 4.11 2006/02/10 09:22:26 jwillemsen Exp
00008  *
00009  *  @author Edan Ayal <EdanA@cti2.com>
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_AUTO_INCDEC_T_H
00015 #define ACE_AUTO_INCDEC_T_H
00016 
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "ace/config-all.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #include "ace/Global_Macros.h"
00026 
00027 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 /**
00030  * @class ACE_Auto_IncDec
00031  *
00032  * @brief This class automatically increments and decrements a
00033  * parameterized counter.
00034  *
00035  * This data structure is meant to be used within a method,
00036  * function, or scope.  The actual parameter given for the
00037  * <ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> template parameter
00038  * must provide at least operators ++ and --.
00039  */
00040 template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>
00041 class ACE_Auto_IncDec
00042 {
00043 public:
00044 
00045   /// Implicitly increment the counter.
00046   ACE_Auto_IncDec (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter);
00047 
00048   /// Implicitly decrement the counter.
00049   ~ACE_Auto_IncDec (void);
00050 
00051   /// Dump the state of an object.
00052   void dump (void) const;
00053 
00054 protected:
00055   /// Reference to the <ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> counter
00056   /// we're incrementing/decrementing.
00057   ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter_;
00058 
00059 private:
00060   // = Prevent assignment and initialization.
00061   ACE_UNIMPLEMENTED_FUNC (void operator= (const
00062                                           ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &))
00063     ACE_UNIMPLEMENTED_FUNC (ACE_Auto_IncDec (const
00064                                              ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &))
00065 };
00066 
00067 ACE_END_VERSIONED_NAMESPACE_DECL
00068 
00069 #if defined (__ACE_INLINE__)
00070 #include "ace/Auto_IncDec_T.inl"
00071 #endif /* __ACE_INLINE__ */
00072 
00073 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00074 #include "ace/Auto_IncDec_T.cpp"
00075 // On Win32 platforms, this code will be included as template source
00076 // code and will not be inlined. Therefore, we first turn off
00077 // ACE_INLINE, set it to be nothing, include the code, and then turn
00078 // ACE_INLINE back to its original setting. All this nonsense is
00079 // necessary, since the generic template code that needs to be
00080 // specialized cannot be inlined, else the compiler will ignore the
00081 // specialization code. Also, the specialization code *must* be
00082 // inlined or the compiler will ignore the specializations.
00083 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00084 
00085 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00086 #pragma implementation ("Auto_IncDec_T.cpp")
00087 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00088 
00089 #include /**/ "ace/post.h"
00090 
00091 #endif /* ACE_AUTO_INCDEC_T_H */

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