Dynamic.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //==========================================================================
00004 /**
00005  *  @file    Dynamic.h
00006  *
00007  *  Dynamic.h,v 4.19 2005/12/08 20:21:35 ossama Exp
00008  *
00009  *  @author Doug Schmidt
00010  *  @author Irfan Pyarali.
00011  */
00012 //==========================================================================
00013 
00014 #ifndef ACE_DYNAMIC_H
00015 #define ACE_DYNAMIC_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/ACE_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 /**
00027  * @class ACE_Dynamic
00028  *
00029  * @brief Checks to see if an object was dynamically allocated.
00030  *
00031  * This class holds the pointer in a thread-safe manner between
00032  * the call to operator new and the call to the constructor.
00033  */
00034 class ACE_Export ACE_Dynamic
00035 {
00036 public:
00037   // = Initialization and termination method.
00038   /// Constructor.
00039   ACE_Dynamic (void);
00040 
00041   /// Destructor.
00042   ~ACE_Dynamic (void);
00043 
00044   /**
00045    * Sets a flag that indicates that the object was dynamically
00046    * created. This method is usually called in operator new and then
00047    * checked and reset in the constructor.
00048    */
00049   void set (void);
00050 
00051   /// @c true if we were allocated dynamically, else @c false.
00052   bool is_dynamic (void);
00053 
00054   /// Resets state flag.
00055   void reset (void);
00056 
00057   static ACE_Dynamic *instance (void);
00058 
00059 private:
00060   /**
00061    * Flag that indicates that the object was dynamically created. This
00062    * method is usually called in operator new and then checked and
00063    * reset in the constructor.
00064    */
00065   bool is_dynamic_;
00066 };
00067 
00068 ACE_END_VERSIONED_NAMESPACE_DECL
00069 
00070 #if defined (__ACE_INLINE__)
00071 #include "ace/Dynamic.inl"
00072 #endif /* __ACE_INLINE__ */
00073 
00074 #include /**/ "ace/post.h"
00075 #endif /* ACE_DYNAMIC_H */

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