Added resize method used to re-alloc a DataBlock if it doesn't have a required length.

git-svn-id: http://yate.null.ro/svn/yate/trunk@3762 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2010-11-02 08:54:58 +00:00
parent d6dc35ac2f
commit 76bf65c908
1 changed files with 9 additions and 0 deletions

View File

@ -2854,6 +2854,15 @@ public:
*/
void insert(const DataBlock& value);
/**
* Resize (re-alloc or free) this block if required size is not the same as the current one
* @param len Required block size
*/
inline void resize(unsigned int len) {
if (len != length())
assign(0,len);
}
/**
* Truncate the data block
* @param len The maximum length to keep