class MyVarMem specifications

This is a variable length memory class. A memory is extended automatically if needed. The held initial memory is 0 byte. When data is able to be given, a memory is allocated for the first time. If internal, |\0| is always added to the terminus. You may expect this terminus, when dealing with a strings. Since it is not thread safe, please do not call the same instance from two or more threads.

MyVarMem
+GetBuffer() const size_t GetLength() const : void*
+AddHead( const void* pAddData, size_t nDataLen) : size_t
+Add( const void* pAddData, size_t nDataLen) : size_t
+AddHead(MyVarMem* pH) : size_t
+Add(MyVarMem* pH) : size_t
+Add(const char* pszStr) : size_t
+virtual void Clear(); virtual int IsEmpty() : void
+operator const void*() : void*
+operator const char*() : char*

void* GetBuffer() const

The allocated memory pointer is returned. If Add() and AddHead() are called, an internal memory will be changed, and this value becomes invalid.
In this point, the reason which is not thread safe.

size_t GetLength() const

The data length which holds now is returned. Real Alloc size is this length +1 (terminus).

size_t AddHead( const void* pAddData, size_t nDataLen);
size_t AddHead(MyVarMem* pH);

The data given is added to the head of a memory . 0 is returned when it fails.

size_t Add( const void* pAddData, size_t nDataLen);
size_t Add(MyVarMem* pH);
size_t Add(const char* pszStr);

The given data is added. 0 is returned when it fails.

virtual void Clear();

All allocation memories will be cleared.

virtual int IsEmpty();

When there is no memory, it returns except zero.

operator const void*();

const void* operator

operator const char*();

const void* operator


yu-ishi@ya2.so-net.ne.jp
Copyright (C) 2003 IshiSoft Allrights reserved.