/home/vlg/develop/libASSA/libassa/assa/MemDump.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //------------------------------------------------------------------------------
00003 //                                 MemDump.h
00004 //------------------------------------------------------------------------------
00005 //  Copyright (c) 1995 by Vladislav Grinchenko
00006 //
00007 //  This library is free software; you can redistribute it and/or
00008 //  modify it under the terms of the GNU Library General Public
00009 //  License as published by the Free Software Foundation; either
00010 //  version 2 of the License, or (at your option) any later version.
00011 //
00012 //  Permission to use, copy, modify, and distribute this software      
00013 //  and its documentation for any purpose and without fee is hereby     
00014 //  granted, provided that the above copyright notice appear in all     
00015 //  copies.  The author makes no representations about the suitability  
00016 //  of this software for any purpose.  It is provided "as is" without   
00017 //  express or implied warranty.
00018 //------------------------------------------------------------------------------
00019 // Creation Date: November 25, 1995
00020 //------------------------------------------------------------------------------
00021 #ifndef MEM_DUMP_H
00022 #define MEM_DUMP_H
00023 
00024 #include <stdio.h>
00025 #include <string.h>
00026 
00027 namespace ASSA {
00028 
00040 class MemDump 
00041 {
00042 private:
00044     char* m_dump;
00045 
00047     static const char m_empty_str[];
00048     
00049 public:
00058     MemDump (const char* msg_, int len_);
00059 
00061     ~MemDump();
00062 
00066     const char* getMemDump() const;
00067 
00075     static void dump_to_log (unsigned long mask_, 
00076                              const char* info_, 
00077                              const char* msg_, 
00078                              int len_);
00079 };
00080 
00081 
00082 inline 
00083 MemDump::
00084 ~MemDump()
00085 {
00086     if (m_dump && m_dump != m_empty_str) {
00087         delete [] m_dump;
00088     }
00089     m_dump = NULL;
00090 }
00091 
00092 inline const char*
00093 MemDump::
00094 getMemDump () const
00095 {
00096     return (m_dump ? (const char*) m_dump : m_empty_str);
00097 }
00098 
00099 } // end namespace ASSA
00100     
00101 #endif /* MEM_DUMP_H */

Generated on Sun Aug 13 15:08:00 2006 for libassa by  doxygen 1.4.6