CMS 3D CMS Logo

LowMemoryPool.h

Go to the documentation of this file.
00001 #ifndef CLASSLIB_LOW_MEMORY_POOL_H
00002 # define CLASSLIB_LOW_MEMORY_POOL_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "classlib/utils/Callback.h"
00007 # if HAVE_NEW
00008 #  include <new>
00009 # elif HAVE_NEW_H
00010 #  include <new.h>
00011 # endif
00012 
00013 namespace lat {
00014 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00015 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00016 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00017 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00018 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00019 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00020 
00107 class LowMemoryPool
00108 {
00109 public:
00110     static void                 add (unsigned kbytes, Callback notifier,
00111                                      bool last = false);
00112     static void                 reset (void);
00113     static unsigned             pools (void);
00114     static unsigned             size (unsigned pool);
00115 
00116 private:
00117     LowMemoryPool (unsigned kbytes, Callback notifier, bool last);
00118     ~LowMemoryPool (void);
00119 
00120     static void                 trigger (void);
00121     static bool                 pop (void);
00122 
00123     LowMemoryPool               *m_next;
00124     char                        *m_reserve;
00125     unsigned                    m_size;
00126     Callback                    m_callback;
00127 # if HAVE_STD_NEW_HANDLER
00128     std::new_handler            m_old_handler;
00129 # else
00130     new_handler                 m_old_handler;
00131 # endif
00132     bool                        m_last;
00133 
00134     static LowMemoryPool        *s_pools;
00135 
00136     // undefined semantics
00137     LowMemoryPool (const LowMemoryPool &);
00138     LowMemoryPool &operator= (const LowMemoryPool &);
00139 };
00140 
00141 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00142 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00143 
00144 } // namespace lat
00145 #endif // CLASSLIB_LOW_MEMORY_POOL_H

Generated on Tue Jun 9 17:38:54 2009 for CMSSW by  doxygen 1.5.4