Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Auto_IncDec_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Auto_IncDec_T.h
00006  *
00007  *  $Id: Auto_IncDec_T.h,v 1.1.1.4 2003/02/21 18:36:32 chad 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 /**
00028  * @class ACE_Auto_IncDec
00029  *
00030  * @brief This class automatically increments and decrements a
00031  * parameterized counter.
00032  *
00033  * This data structure is meant to be used within a method,
00034  * function, or scope.  The actual parameter given for the
00035  * <ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> template parameter
00036  * must provide at least operators ++ and --.
00037  */
00038 template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>
00039 class ACE_Auto_IncDec
00040 {
00041 public:
00042 
00043   /// Implicitly increment the counter.
00044   ACE_Auto_IncDec (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter);
00045 
00046   /// Implicitly decrement the counter.
00047   ~ACE_Auto_IncDec (void);
00048 
00049   /// Dump the state of an object.
00050   void dump (void) const;
00051 
00052 protected:
00053   /// Reference to the <ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> counter
00054   /// we're incrementing/decrementing.
00055   ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter_;
00056 
00057 private:
00058   // = Prevent assignment and initialization.
00059   ACE_UNIMPLEMENTED_FUNC (void operator= (const
00060                                           ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &))
00061     ACE_UNIMPLEMENTED_FUNC (ACE_Auto_IncDec (const
00062                                              ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &))
00063 };
00064 
00065 #if defined (__ACE_INLINE__)
00066 #include "ace/Auto_IncDec_T.i"
00067 // On non-Win32 platforms, this code will be inlined
00068 #endif /* __ACE_INLINE__ */
00069 
00070 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00071 #include "ace/Auto_IncDec_T.cpp"
00072 // On Win32 platforms, this code will be included as template source
00073 // code and will not be inlined. Therefore, we first turn off
00074 // ACE_INLINE, set it to be nothing, include the code, and then turn
00075 // ACE_INLINE back to its original setting. All this nonsense is
00076 // necessary, since the generic template code that needs to be
00077 // specialized cannot be inlined, else the compiler will ignore the
00078 // specialization code. Also, the specialization code *must* be
00079 // inlined or the compiler will ignore the specializations.
00080 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00081 
00082 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00083 #pragma implementation ("Auto_IncDec_T.cpp")
00084 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00085 
00086 #include "ace/post.h"
00087 
00088 #endif /* ACE_AUTO_INCDEC_T_H */

Generated on Mon Jun 16 11:19:11 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002