38 #ifndef __EST_FEATURES_H__ 39 #define __EST_FEATURES_H__ 43 #include "EST_types.h" 44 #include "EST_TIterator.h" 45 #include "EST_error.h" 54 EST_Val est_val(const EST_Item_featfunc f);
66 void save_fpair(ostream &outf,
70 static EST_Val feature_default_value;
72 EST_Features(
const EST_Features &f);
85 const EST_Val &val(
const char *name)
const;
104 {
return val_path(path);}
110 {
return val_path(path, def);}
115 {
return val_path(path); }
121 {
return val_path(path,def); }
136 {
return val_path(path).
Float(); }
142 {
return val_path(path, def).
Float(); }
147 {
return val_path(path).
Int(); }
153 {
return val_path(path, def).
Int(); }
158 {
return val_path(path).
string(); }
165 {
return val_path(path, def).
string(); }
170 {
return *feats(val_path(path));}
175 EST_Features &A(
const EST_String &path, EST_Features &def)
const;
186 {
EST_Val pv(ival); set_path(name, pv);}
192 {
EST_Val pv(fval); set_path(name, pv); }
198 {
EST_Val pv((
float)dval); set_path(name, pv); }
204 {
EST_Val pv(sval); set_path(name, pv); }
210 {
EST_Val pv(cval); set_path(name, pv); }
236 { EST_Features *ff =
new EST_Features(f);
237 set_path(name, est_val(ff)); }
259 EST_Features&
operator = (
const EST_Features& a);
262 { f.
save(s);
return s; }
271 float F(
EST_Litem *p)
const {
return features->
list(p).v.Float(); }
273 int I(
EST_Litem *p)
const {
return features->
list(p).v.Int(); }
274 EST_Features &A(
EST_Litem *p) {
return *feats(features->
list(p).v); }
282 void point_to_first(
IPointer &ip)
const 283 { ip.i.begin(*features);}
284 void move_pointer_forwards(
IPointer &ip)
const 286 bool points_to_something(
const IPointer &ip)
const 287 {
return ip.i != 0; }
291 friend class EST_TIterator< EST_Features, IPointer, EST_TKVI<EST_String, EST_Val> >;
293 friend class EST_TRwIterator< EST_Features, IPointer, EST_TKVI<EST_String, EST_Val> >;
316 EST_write_status save(ostream &outf)
const;
318 EST_write_status save_sexpr(ostream &outf)
const;
324 {(void)a; (void)b;
return false;}
const char operator()(int i) const
Function style access to constant strings.
EST_write_status save(ostream &outf) const
save features in already opened ostream
void set_val(const EST_String &name, const EST_Val &sval)
const EST_String S(const EST_String &path) const
const float F(const EST_String &path) const
friend ostream & operator<<(ostream &s, const EST_String &str)
Stream output for EST_String.
const float Float(void) const
const int Int(void) const
const int I(const EST_String &path) const
EST_TList< EST_TKVI< K, V > > list
Linked list of key-val pairs. Don't use this as it will be made private in the future.
int remove_item(const K &rkey, int quiet=0)
remove key and val pair from list
const EST_String S(const EST_String &path, const EST_String &def) const
const EST_Val & f(const EST_String &path) const
int add_item(const K &rkey, const V &rval, int no_search=0)
add key-val pair to list
EST_Features & A(const EST_String &path) const
const float F(const EST_String &path, float def) const
const int length() const
number of key value pairs in list
EST_String & operator=(const char *str)
Assign C string to EST_String.
const EST_String & string(void) const
const int I(const EST_String &path, int def) const
const EST_Val & f(const EST_String &path, const EST_Val &def) const