65 char* tmp = &(
mem[idx]);
66 memused += int(strlen(str)) + 1;
69 *(
set.create(p_key)) = idx;
77 for(
int i = 0; i < p_set.
num(); ++i)
88 for(
int i = 0; i < p_set.
num(); ++i)
93 add(p_key[i], p_set[i]);
120 for(
int i = 0; i < n; ++i)
126 for(
int i = 0; i < n; ++i)
132 for(
int i = 0; i <
set.num(); i++)
166 for(
int i =
num() - 1; i >= 0; --i)
180 for(i = 0; i <
num(); i++)
182 const char* t = &
mem[
set[i]];
185 newlast += int(strlen(t)) + 1;
188 memcpy(
mem, newmem, static_cast<size_t>(newlast));
195 for(i = 0; i <
num(); i++)
202 unsigned int res = 37;
203 const char* sptr = str->
name;
208 res += (
unsigned int)(*sptr++);
224 memmax = (mmax < 1) ? (8 *
set.
max() + 1) : mmax;
235 #ifdef ENABLE_CONSISTENCY_CHECKS 242 for(i = 0; i <
num(); i++)
244 const char* t = &
mem[
set[i]];
249 if(strcmp(t,
operator[](
key(t))))
253 return set.isConsistent() &&
hashtab.isConsistent();
261 for(
int i = 0; i < nset.
num(); i++)
265 << nset.
key(i).
idx <<
"= " #define SOPLEX_HASHTABLE_FILLFACTOR
static int NameSetNameHashFunction(const NameSet::Name *str)
returns the hash value of the name.
int memSize() const
returns used length of string memory.
const char * name
pointer to the name string.
int num() const
returns nr. of names in NameSet.
Memory allocation routines.
DataHashTable< Name, DataKey > hashtab
hashtable for names
void reMax(int newmax=0)
resets max() to newmax.
#define SPX_MSG_INCONSISTENT(name)
Entry identifier class for items of a DataSet.Every item in a DataSet is assigned a DataKey by which ...
static const char deflt
default zero string.
int memmax
size of string memory
Handles of names in a NameSet.Class Name provides the handles (i.e., char*s) of names in a NameSet...
NameSet(int max=10000, int mmax=-1, Real fac=2, Real memFac=2)
default constructor.
void spx_alloc(T &p, int n=1)
Allocate memory.
DataSet< int > set
name set.
std::ostream & operator<<(std::ostream &s, const VectorBase< R > &vec)
Output operator.
int spxSnprintf(char *t, size_t len, const char *s,...)
safe version of snprintf
int info
user information to store values -1, 0, +1
Real factor
memory extension factor for entries.
DataKey key(int pnum) const
returns DataKey of the pnum 'th name in NameSet.
void add(const char *str)
void clear()
removes all names from NameSet.
Debugging, floating point type and parameter definitions.
Set of strings.Class NameSet implements a symbol or name table. It allows to store or remove names (i...
void spx_realloc(T &p, int n)
Change amount of allocated memory.
Everything should be within this namespace.
int memused
size of used string memory
void memRemax(int newmax=0)
resets memMax() to newmax.
void memPack()
garbage collection.
Real memFactor
memory extension factor for names.
bool isConsistent() const
consistency check.
int max() const
returns maximum nr. of names that fit into NameSet.
int size() const
returns maximum DataKey::idx used in NameSet.
void remove(const DataKey &key)
removes name with DataKey key from NameSet.
int idx
(locally) unique key index
void spx_free(T &p)
Release memory.
bool has(int pnum) const
does NameSet has a name with number pnum?
int memMax() const
returns maximum length of string memory.