32const char NameSet::Name::deflt =
'\0';
34void NameSet::add(
const char* str)
97void NameSet::remove(
const char* str)
120 for(
int i = 0;
i <
n; ++
i)
124void NameSet::remove(
const int nums[],
int n)
126 for(
int i = 0;
i <
n; ++
i)
166 for(
int i =
num() - 1;
i >= 0; --
i)
170void NameSet::memPack()
180 for(
i = 0;
i <
num();
i++)
195 for(
i = 0;
i <
num();
i++)
202 unsigned int res = 37;
233bool NameSet::isConsistent()
const
235#ifdef ENABLE_CONSISTENCY_CHECKS
242 for(
i = 0;
i <
num();
i++)
261 for(
int i = 0;
i <
nset.num();
i++)
264 <<
nset.key(
i).info <<
"."
265 <<
nset.key(
i).idx <<
"= "
Safe arrays of data objects.
bool isConsistent() const
consistency check
void reMax(int newMax=1, int newSize=-1)
reset maximum number of elements.
void clear()
remove all elements.
void remove(int n=0, int m=1)
remove m elements starting at n.
Entry identifier class for items of a DataSet.
void remove(int removenum)
removes the removenum 'th element.
bool isConsistent() const
consistency check.
DATA * create(DataKey &newkey)
creates new data element in DataSet.
int max() const
returns maximum number of elements that would fit into DataSet.
ptrdiff_t reMax(int newmax=0)
resets max() to newmax.
int num() const
returns number of elements currently in DataSet.
void clear()
remove all elements.
Handles of names in a NameSet.
const char * name
pointer to the name string.
void memRemax(int newmax=0)
resets memMax() to newmax.
DataHashTable< Name, DataKey > hashtab
hashtable for names
int memmax
size of string memory
bool isConsistent() const
consistency check.
bool has(int pnum) const
does NameSet has a name with number pnum?
int memSize() const
returns used length of string memory.
Real factor
memory extension factor for entries.
int max() const
returns maximum nr. of names that fit into NameSet.
void remove(const DataKey &key)
removes name with DataKey key from NameSet.
int memused
size of used string memory
int memMax() const
returns maximum length of string memory.
int num() const
returns nr. of names in NameSet.
void reMax(int newmax=0)
resets max() to newmax.
void memPack()
garbage collection.
DataSet< int > set
name set.
Real memFactor
memory extension factor for names.
void add(const char *str)
int size() const
returns maximum DataKey::idx used in NameSet.
DataKey key(int pnum) const
returns DataKey of the pnum 'th name in NameSet.
#define HASHTABLE_FILLFACTOR
Everything should be within this namespace.
void spx_realloc(T &p, int n)
Change amount of allocated memory.
void spx_free(T &p)
Release memory.
int spxSnprintf(char *t, size_t len, const char *s,...)
safe version of snprintf
static int NameSetNameHashFunction(const NameSet::Name *str)
returns the hash value of the name.
void spx_alloc(T &p, int n=1)
Allocate memory.
Memory allocation routines.
Debugging, floating point type and parameter definitions.
#define MSGinconsistent(name)