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

Dynamic.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //==========================================================================
00004 /**
00005  *  @file    Dynamic.h
00006  *
00007  *  $Id: Dynamic.h,v 1.1.1.4 2003/02/21 18:36:32 chad 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 /**
00025  * @class ACE_Dynamic
00026  *
00027  * @brief Checks to see if an object was dynamically allocated.
00028  *
00029  * This class holds the pointer in a thread-safe manner between
00030  * the call to operator new and the call to the constructor.
00031  */
00032 class ACE_Export ACE_Dynamic
00033 {
00034 public:
00035   // = Initialization and termination method.
00036   /// Constructor.
00037   ACE_Dynamic (void);
00038 
00039   /// Destructor.
00040   ~ACE_Dynamic (void);
00041 
00042   /**
00043    * Sets a flag that indicates that the object was dynamically
00044    * created. This method is usually called in operator new and then
00045    * checked and reset in the constructor.
00046    */
00047   void set (void);
00048 
00049   /// 1 if we were allocated dynamically, else 0.
00050   int is_dynamic (void);
00051 
00052   /// Resets state flag.
00053   void reset (void);
00054 
00055   static ACE_Dynamic *instance (void);
00056 
00057 private:
00058   /**
00059    * Flag that indicates that the object was dynamically created. This
00060    * method is usually called in operator new and then checked and
00061    * reset in the constructor.
00062    */
00063   int is_dynamic_;
00064 };
00065 
00066 #if defined (__ACE_INLINE__)
00067 #include "ace/Dynamic.i"
00068 #endif /* __ACE_INLINE__ */
00069 
00070 #include "ace/post.h"
00071 #endif /* ACE_DYNAMIC_H */

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