Brief description of class still missing. More...
#include <IncreaseStorage.h>
Public Member Functions | |
void | add (int n=1) |
void | clear () |
void | downSize (int s) |
IncreaseStorage (int defaultCapacity) | |
IncreaseStorage (const IncreaseStorage &o) | |
void | reserve (int n) |
int | size () const |
virtual | ~IncreaseStorage () |
Protected Member Functions | |
void * | allocateVector (int itemSize) |
virtual void | reallocate ()=0 |
void * | reallocateVector (void *vect, int itemSize) |
Brief description of class still missing.
Full description of class still missing
QGpCoreTools::IncreaseStorage::IncreaseStorage | ( | int | defaultCapacity | ) | [inline] |
QGpCoreTools::IncreaseStorage::IncreaseStorage | ( | const IncreaseStorage & | o | ) | [inline] |
{ _defaultCapacity=o._defaultCapacity; _capacity=o._capacity; _size=o._size; }
virtual QGpCoreTools::IncreaseStorage::~IncreaseStorage | ( | ) | [inline, virtual] |
{}
void QGpCoreTools::IncreaseStorage::add | ( | int | n = 1 | ) | [inline] |
Reimplemented in DinverCore::BestModels, and DinverCore::ActiveModels.
References reallocate().
{ _size+=n; if(_size>=_capacity) { do { _capacity=_capacity << 1; } while(_size>=_capacity); reallocate(); } }
void * QGpCoreTools::IncreaseStorage::allocateVector | ( | int | itemSize | ) | [inline, protected] |
Referenced by DinverCore::ActiveModels::ActiveModels(), DinverCore::BestModels::BestModels(), DinverCore::ActiveModels::clear(), DinverCore::BestModels::clear(), DinverCore::ModelSet::clear(), and DinverCore::ModelSet::ModelSet().
{
return malloc(_capacity * itemSize);
}
void QGpCoreTools::IncreaseStorage::clear | ( | ) | [inline] |
Reimplemented in DinverCore::ModelSet, DinverCore::BestModels, and DinverCore::ActiveModels.
Referenced by IncreaseStorage().
{ _capacity=_defaultCapacity; _size=0; }
void QGpCoreTools::IncreaseStorage::downSize | ( | int | s | ) | [inline] |
Referenced by DinverCore::BestModels::remove(), and DinverCore::BestModels::setNr().
{_size=s;}
virtual void QGpCoreTools::IncreaseStorage::reallocate | ( | ) | [protected, pure virtual] |
void * QGpCoreTools::IncreaseStorage::reallocateVector | ( | void * | vect, |
int | itemSize | ||
) | [inline, protected] |
{
return realloc(vect, _capacity * itemSize);
}
void QGpCoreTools::IncreaseStorage::reserve | ( | int | n | ) | [inline] |
Reimplemented in DinverCore::ModelSet, DinverCore::BestModels, and DinverCore::ActiveModels.
References reallocate().
{ if(_size+n >= _capacity) { while(_size+n >= _capacity) { _capacity=_capacity << 1; } reallocate(); } }
int QGpCoreTools::IncreaseStorage::size | ( | ) | const [inline] |