50 static void Discrete_val_delete_funct(
void *d) {
delete (
int *)d; }
54 nametrie.clear(Discrete_val_delete_funct);
61 cerr <<
"WARNING from EST_Discrete ctor : invalid vocab list !";
62 nametrie.clear(Discrete_val_delete_funct);
70 p_def_val = d.p_def_val;
71 nametrie.clear(Discrete_val_delete_funct);
72 namevector = d.namevector;
74 for (i=0; i<namevector.length(); ++i)
78 nametrie.add(namevector(i),t);
89 namevector.resize(vocab.
length());
90 nametrie.clear(Discrete_val_delete_funct);
92 for (i=0,w=vocab.
head(); w != 0; i++,w=w->
next()){
93 namevector[i] =
vocab(w);
98 if(nametrie.lookup(vocab(w)) !=
NULL)
100 cerr <<
"EST_Discrete : found repeated item '";
101 cerr <<
vocab(w) <<
"' in vocab list !" << endl;
106 nametrie.add(
vocab(w),tmp);
116 return (
bool)(namevector == d.namevector);
121 return (
bool)(namevector != d.namevector);
128 static EST_Regex needquotes(
".*[()'\";., \t\n\r].*");
131 for(i=0;i<length();i++)
133 if ((quote) && name(i).matches(needquotes))
147 s << d.
name(i) <<
" ";
155 for (i=0; i<next_free; i++)
165 if (next_free ==
max)
168 for (i=0; i<next_free; i++)
169 new_discretes[i] = discretes[i];
172 discretes = new_discretes;
176 pos = next_free + 10;
A Regular expression class to go with the CSTR EST_String class.
const EST_String & name(const int n) const
The name given the index.
int length(void) const
The number of members in the discrete.
int def(const EST_StrList &members)
float max(float a, float b)
void copy(const EST_Discrete &d)
bool operator!=(const EST_Discrete &d)
bool init(const EST_StrList &vocab)
(re-)initialise
bool operator==(const EST_Discrete &d)
EST_String print_to_string(int quote=0)
EST_String quote_string(const EST_String &s, const EST_String "e, const EST_String &escape, int force)
ostream & operator<<(ostream &s, const EST_Discrete &d)