65 char* tmp = &(
mem[idx]);
66 memused += int(strlen(str)) + 1;
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]);
104 assert(hkey !=
nullptr);
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)
172 char* newmem =
nullptr;
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++);
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))))
261 for(
int i = 0; i < nset.
num(); i++)
265 << nset.
key(i).
idx <<
"= "
Entry identifier class for items of a DataSet.
int info
user information to store values -1, 0, +1
int idx
(locally) unique key index
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.
static const char deflt
default zero string.
const char * name
pointer to the name string.
NameSet(int max=10000, int mmax=-1, Real fac=2, Real memFac=2)
default constructor.
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 clear()
removes all names from NameSet.
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 SOPLEX_HASHTABLE_FILLFACTOR
Everything should be within this namespace.
int spxSnprintf(char *t, size_t len, const char *s,...)
safe version of snprintf
void spx_free(T &p)
Release memory.
std::ostream & operator<<(std::ostream &s, const VectorBase< R > &vec)
Output operator.
static int NameSetNameHashFunction(const NameSet::Name *str)
returns the hash value of the name.
void spx_alloc(T &p, int n=1)
Allocate memory.
void spx_realloc(T &p, int n)
Change amount of allocated memory.
Memory allocation routines.
Debugging, floating point type and parameter definitions.
#define SPX_MSG_INCONSISTENT(name)