Loading...
Searching...
No Matches
MemDump.h
Go to the documentation of this file.
// -*- c++ -*-
//------------------------------------------------------------------------------
// MemDump.h
//------------------------------------------------------------------------------
// Copyright (c) 1995 by Vladislav Grinchenko
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// Permission to use, copy, modify, and distribute this software
// and its documentation for any purpose and without fee is hereby
// granted, provided that the above copyright notice appear in all
// copies. The author makes no representations about the suitability
// of this software for any purpose. It is provided "as is" without
// express or implied warranty.
//------------------------------------------------------------------------------
// Creation Date: November 25, 1995
//------------------------------------------------------------------------------
#ifndef MEM_DUMP_H
#define MEM_DUMP_H
#include <stdio.h>
#include <string.h>
namespace ASSA {
class MemDump
{
private:
char* m_dump;
static const char m_empty_str[];
public:
MemDump (const char* msg_, int len_);
~MemDump();
const char* getMemDump() const;
static void dump_to_log (unsigned long mask_,
const char* info_,
const char* msg_,
int len_);
};
inline
MemDump::
~MemDump()
{
if (m_dump && m_dump != m_empty_str) {
delete [] m_dump;
}
m_dump = NULL;
}
inline const char*
MemDump::
getMemDump () const
{
return (m_dump ? (const char*) m_dump : m_empty_str);
}
} // end namespace ASSA
#endif /* MEM_DUMP_H */
ASSA::AutoPtrRef
A wrapper class to provide AutoPtr with reference semantics.
Definition AutoPtr.h:32
ASSA::MemDump
Definition MemDump.h:41
ASSA::MemDump::m_empty_str
static const char m_empty_str[]
static Null string
Definition MemDump.h:47
ASSA::MemDump::getMemDump
const char * getMemDump() const
Obtain a pointer to the dump image (null-terminated char string).
Definition MemDump.h:94
ASSA::MemDump::~MemDump
~MemDump()
Destructor releases image memory.
Definition MemDump.h:84
ASSA::MemDump::m_dump
char * m_dump
pointer to converted image
Definition MemDump.h:44
ASSA::MemDump::dump_to_log
static void dump_to_log(unsigned long mask_, const char *info_, const char *msg_, int len_)
Write hex/ascii dump of a memory region to log file.
Definition MemDump.cpp:111
ASSA
Definition Acceptor.h:40