75 AList(
int s = 0,
int sizeIncrement = 0);
83 inline T *
at(
int i)
const;
116 void put(
int i, T *anObject);
122 void clear(
bool deleteObjectFlag =
true);
164 template<
class T >
void 170 if ( deleteObjectFlag ) {
183 template<
class T >
void 188 T **newValues, **p1, **p2;
191 if ( newSize <
size ) {
193 OOFEM_ERROR(
"new list size (%d) not larger than current size (%d)", newSize,
size);
198 while ( ( --i ) >= newSize ) {
208 for ( i = 0; i <
size; i++ ) {
227 template<
class T >
void 232 T **newValues, **p1, **p2;
235 if ( newSize <
size ) {
239 while ( ( --i ) >= newSize ) {
249 for ( i = 0; i <
size; i++ ) {
269 template<
class T > T *
274 OOFEM_ERROR(
"Asking for negative or zero indices (%d)", i);
280 template<
class T >
bool 287 OOFEM_ERROR(
"Asking for negative or zero indices (%d)", i);
293 return (
values [ i - 1 ] != NULL );
297 template<
class T >
void 301 printf(
"List of components of size %d\n",
size);
302 for (
int i = 1; i <=
size; i++ ) {
303 printf(
"%d : %p\n", i,
values [ i - 1 ]);
312 OOFEM_ERROR(
"Trying to write to zero or negative indices (%d)", i);
324 values [ i - 1 ] = anObject;
331 OOFEM_ERROR(
"Trying to remove at zero or negative indices (%d)", i);
350 OOFEM_ERROR(
"Trying to unlink at zero or negative indices (%d)", i);
357 T *answer =
values [ i - 1 ];
Class implementing generic list (or more precisely array).
int allocatedSize
Real allocated size (may be larger than size, to prevent often reallocation).
T ** values
Array of pointers to particular components.
int sizeIncrement
List size allocation increment.
void printYourself() const
Prints the receiver on screen.
int size
Array or list size (number of components to store).
bool includes(int i) const
Checks if receiver includes object as given position.
void put(int i, T *anObject)
Stores anObject at position i.
void resize(int newSize)
Resize the receiver from its current size to newSize, in order to accommodate new entries...
T * unlink(int i)
Unlinks the object a i-th position.
void clear(bool deleteObjectFlag=true)
Clears receiver.
AList(int s=0, int sizeIncrement=0)
Creates list of size s.
void growTo(int newSize)
Expands the receiver from its current size to newSize, in order to accommodate new entries...
void remove(int i)
Deletes the object at i-th position.
the oofem namespace is to define a context or scope in which all oofem names are defined.