summaryrefslogtreecommitdiff
path: root/ace/Auto_IncDec_T.h
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1999-11-07 18:13:13 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1999-11-07 18:13:13 +0000
commitd70bbd2cc7ea69e37ab9de711c6778a2acb6e025 (patch)
tree315ba2bd16c8147983a1cd2611f604d6f6ef7e09 /ace/Auto_IncDec_T.h
parent17a726ad15e243e2898acac0f0d2a028a19fedb7 (diff)
downloadATCD-d70bbd2cc7ea69e37ab9de711c6778a2acb6e025.tar.gz
ChangeLogTag:Sun Nov 7 12:03:31 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
Diffstat (limited to 'ace/Auto_IncDec_T.h')
-rw-r--r--ace/Auto_IncDec_T.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/ace/Auto_IncDec_T.h b/ace/Auto_IncDec_T.h
new file mode 100644
index 00000000000..024729bf7be
--- /dev/null
+++ b/ace/Auto_IncDec_T.h
@@ -0,0 +1,83 @@
+/* -*- C++ -*- */
+// $Id$
+
+//============================================================================
+//
+// = LIBRARY
+// ace
+//
+// = FILENAME
+// Auto_IncDec_T.h
+//
+// = AUTHOR
+// Edan Ayal <EdanA@cti2.com>
+//
+//============================================================================
+
+#ifndef ACE_AUTO_INCDEC_T_H
+#define ACE_AUTO_INCDEC_T_H
+
+#include "ace/OS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>
+class ACE_Auto_IncDec
+{
+ // = TITLE
+ // This class automatically increments and decrements a
+ // parameterized counter.
+ //
+ // = DESCRIPTION
+ // This data structure is meant to be used within a method,
+ // function, or scope. The actual parameter given for the
+ // <ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> template parameter
+ // must provide at least opertaors ++ and --.
+public:
+ // = Initialization and termination methods.
+ ACE_Auto_IncDec (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter);
+ // Implicitly increment the counter.
+
+ ~ACE_Auto_IncDec (void);
+ // Implicitly decrement the counter.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+protected:
+ ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter_;
+ // Reference to the <ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> counter
+ // we're incrementing/decrementing.
+
+private:
+ // = Prevent assignment and initialization.
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const
+ ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &))
+ ACE_UNIMPLEMENTED_FUNC (ACE_Auto_IncDec (const
+ ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &))
+};
+
+#if defined (__ACE_INLINE__)
+#include "ace/Auto_IncDec_T.i"
+// On non-Win32 platforms, this code will be inlined
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "ace/Auto_IncDec_T.cpp"
+// On Win32 platforms, this code will be included as template source
+// code and will not be inlined. Therefore, we first turn off
+// ACE_INLINE, set it to be nothing, include the code, and then turn
+// ACE_INLINE back to its original setting. All this nonsense is
+// necessary, since the generic template code that needs to be
+// specialized cannot be inlined, else the compiler will ignore the
+// specialization code. Also, the specialization code *must* be
+// inlined or the compiler will ignore the specializations.
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Auto_IncDec_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#endif /* ACE_AUTO_INCDEC_T_H */