40#include "EST_Features.h"
41#include "ling_class/EST_Item.h"
43#include "EST_String.h"
49EST_Val EST_Features::feature_default_value(
"0");
53EST_Features::EST_Features()
61 *features = *
f.features;
64EST_Features::~EST_Features()
79 for (p=features->
list.head(); p; p=p->next())
81 if (features->
list(p).k == name)
82 return features->
list(p).v;
93 for (p=features->
list.head(); p; p=p->next())
95 if (features->
list(p).k == name)
96 return features->
list(p).v;
99 EST_error(
"{FND} Feature %s not defined\n", name);
100 return feature_default_value;
107 if (strchr(name,
'.') == NULL)
114 if (v.
type() == val_type_feats)
115 return feats(v)->val_path(nname.
after(
"."), d);
125 if (strchr(name,
'.') == NULL)
132 if (v.
type() == val_type_feats)
133 return feats(v)->val_path(nname.
after(
"."));
135 EST_error(
"Feature %s not feature valued\n", (
const char *)fname);
136 return feature_default_value;
144 return *feats(
val(path,est_val(ff)));
149 if (strchr(name,
'.') == NULL)
150 return features->
present(name);
155 if (v.
type() == val_type_feats)
156 return feats(v)->present(nname.
after(
"."));
168 if (strchr(name,
'.') == NULL)
177 if (v.
type() == val_type_feats)
178 feats(v)->set_path(nname.
after(
"."),sval);
180 EST_error(
"Feature %s not feature valued\n",
181 (
const char *)fname);
194 *features = *x.features;
202 for(p.
begin(from); p; ++p)
210 return "<<Features>>";
213#if defined(INSTANTIATE_TEMPLATES)
EST_Features & A(const EST_String &path) const
void set(const EST_String &name, int ival)
EST_Features & operator=(const EST_Features &a)
const EST_Val & val(const char *name) const
void set_path(const EST_String &name, const EST_Val &sval)
void set_val(const EST_String &name, const EST_Val &sval)
const EST_Val & f(const EST_String &path) const
int present(const EST_String &name) const
const EST_Val & val_path(const EST_String &path) const
EST_String before(int pos, int len=0) const
Part before position.
EST_String after(int pos, int len=1) const
Part after pos+len.
void begin(const Container &over)
Set the iterator ready to run over this container.
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.
const int present(const K &rkey) const
Returns true if key is present.
const val_type type(void) const