All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Protected Member Functions
QGpCoreTools::IncreaseStorage Class Reference

Brief description of class still missing. More...

#include <IncreaseStorage.h>

Inheritance diagram for QGpCoreTools::IncreaseStorage:
DinverCore::ActiveModels DinverCore::BestModels DinverCore::ModelSet

List of all members.

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)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

QGpCoreTools::IncreaseStorage::IncreaseStorage ( int  defaultCapacity) [inline]

References clear().

{
  _defaultCapacity=defaultCapacity;
  clear();
}
{
  _defaultCapacity=o._defaultCapacity;
  _capacity=o._capacity;
  _size=o._size;
}
virtual QGpCoreTools::IncreaseStorage::~IncreaseStorage ( ) [inline, virtual]
{}

Member Function Documentation

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]

Reimplemented in DinverCore::ModelSet, DinverCore::BestModels, and DinverCore::ActiveModels.

Referenced by IncreaseStorage().

{
  _capacity=_defaultCapacity;
  _size=0;
}
void QGpCoreTools::IncreaseStorage::downSize ( int  s) [inline]
virtual void QGpCoreTools::IncreaseStorage::reallocate ( ) [protected, pure virtual]

Referenced by add(), and reserve().

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]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines