got TcpServer and Thread to inherit Mmged

This commit is contained in:
2018-07-01 02:11:33 +00:00
parent 1d12ec3e3f
commit 27039d9693
13 changed files with 118 additions and 98 deletions

View File

@ -49,23 +49,23 @@ QSE_BEGIN_NAMESPACE(QSE)
class QSE_EXPORT HeapMmgr: public Mmgr, public Mmged
{
public:
HeapMmgr (qse_size_t heap_size);
HeapMmgr (qse_size_t heap_size) QSE_CPP_NOEXCEPT;
/// The constructor function accepts an memory manager \a mmgr that
/// is used to create a heap of the size \a heap_size.
HeapMmgr (Mmgr* mmgr, qse_size_t heap_size);
HeapMmgr (Mmgr* mmgr, qse_size_t heap_size) QSE_CPP_NOEXCEPT;
/// The destructor function frees the heap. Memory areas returned by
/// allocate(), reallocate(), allocMem(), reallocMem() are invalidated
/// all at once.
~HeapMmgr ();
~HeapMmgr () QSE_CPP_NOEXCEPT;
void* allocMem (qse_size_t n);
void* reallocMem (void* ptr, qse_size_t n);
void freeMem (void* ptr);
void* allocMem (qse_size_t n) QSE_CPP_NOEXCEPT;
void* reallocMem (void* ptr, qse_size_t n) QSE_CPP_NOEXCEPT;
void freeMem (void* ptr) QSE_CPP_NOEXCEPT;
// the library does not provide a stock instance of this class
//static HeapMmgr* getInstance ();
//static HeapMmgr* getInstance () QSE_CPP_NOEXCEPT;
protected:
qse_xma_t* xma;

View File

@ -62,7 +62,7 @@ public:
/// The Mmgr() function builds a memory manager composed of bridge
/// functions connecting itself with it.
///
Mmgr ()
Mmgr () QSE_CPP_NOEXCEPT
{
// NOTE:
// the #qse_mmgr_t interface is not affected by raise_exception
@ -77,7 +77,7 @@ public:
///
/// The ~Mmgr() function finalizes a memory manager.
///
virtual ~Mmgr () {}
virtual ~Mmgr () QSE_CPP_NOEXCEPT {}
///
/// The allocate() function calls allocMem() for memory
@ -125,7 +125,7 @@ public:
///
virtual void* allocMem (
qse_size_t n ///< size of memory chunk to allocate in bytes
) = 0;
) QSE_CPP_NOEXCEPT = 0;
///
/// The reallocMem() function resizes a chunk of memory previously
@ -136,7 +136,7 @@ public:
virtual void* reallocMem (
void* ptr, ///< pointer to memory chunk to resize
qse_size_t n ///< new size in bytes
) = 0;
) QSE_CPP_NOEXCEPT = 0;
///
/// The freeMem() function frees a chunk of memory allocated with
@ -144,27 +144,27 @@ public:
///
virtual void freeMem (
void* ptr ///< pointer to memory chunk to free
) = 0;
) QSE_CPP_NOEXCEPT = 0;
protected:
///
/// bridge function from the #qse_mmgr_t type the allocMem() function.
///
static void* alloc_mem (mmgr_t* mmgr, qse_size_t n);
static void* alloc_mem (mmgr_t* mmgr, qse_size_t n) QSE_CPP_NOEXCEPT;
///
/// bridge function from the #qse_mmgr_t type the reallocMem() function.
///
static void* realloc_mem (mmgr_t* mmgr, void* ptr, qse_size_t n);
static void* realloc_mem (mmgr_t* mmgr, void* ptr, qse_size_t n) QSE_CPP_NOEXCEPT;
///
/// bridge function from the #qse_mmgr_t type the freeMem() function.
///
static void free_mem (mmgr_t* mmgr, void* ptr);
static void free_mem (mmgr_t* mmgr, void* ptr) QSE_CPP_NOEXCEPT;
public:
static Mmgr* getDFL ();
static void setDFL (Mmgr* mmgr);
static Mmgr* getDFL () QSE_CPP_NOEXCEPT;
static void setDFL (Mmgr* mmgr) QSE_CPP_NOEXCEPT;
protected:
static Mmgr* dfl_mmgr;

View File

@ -40,15 +40,15 @@ QSE_BEGIN_NAMESPACE(QSE)
class QSE_EXPORT StdMmgr: public Mmgr
{
public:
StdMmgr (): Mmgr () {}
StdMmgr () QSE_CPP_NOEXCEPT: Mmgr () {}
void* allocMem (qse_size_t n);
void* reallocMem (void* ptr, qse_size_t n);
void freeMem (void* ptr);
void* allocMem (qse_size_t n) QSE_CPP_NOEXCEPT;
void* reallocMem (void* ptr, qse_size_t n) QSE_CPP_NOEXCEPT;
void freeMem (void* ptr) QSE_CPP_NOEXCEPT;
/// The getInstance() function returns the stock instance of the StdMmgr
/// class.
static StdMmgr* getInstance ();
static StdMmgr* getInstance () QSE_CPP_NOEXCEPT;
};
/////////////////////////////////