44 #ifndef __EST_ITEM_H__ 45 #define __EST_ITEM_H__ 47 #include "EST_String.h" 48 #include "EST_Features.h" 49 #include "ling_class/EST_Item_Content.h" 52 extern val_type val_type_featfunc;
53 const EST_Item_featfunc featfunc(
const EST_Val &v);
54 EST_Val est_val(
const EST_Item_featfunc f);
95 void unref_contents();
107 static void class_init(
void);
139 {
return f(name,def).
Float();}
150 {
return f(name, def).
string();}
159 {
return f(name, def).
Int();}
171 return *feats(f(name, est_val(ff)));}
209 features().
set_path(name, est_val(ff)); }
223 { features().
remove(name); }
231 {
return features().
present(name); }
249 {
if (
this != 0) p_contents->
set_name(name); }
259 EST_error(
"item is null so has no %s feature",(
const char *)name);
264 v.
type() == val_type_featfunc && featfunc(v) != NULL;
265 v=(featfunc(v))((
EST_Item *)(
void *)
this));
266 if (v.
type() == val_type_featfunc)
267 EST_error(
"NULL %s function",(
const char *)name);
280 for (v=&(p_contents->
f.
val_path(name, def));
281 v->
type() == val_type_featfunc && featfunc(*v) != NULL;
282 v=&(featfunc(*v))((
EST_Item *)(
void *)
this));
283 if (v->
type() == val_type_featfunc)
297 for (v=p_contents->
f.
val_path(name, def);
298 v.
type() == val_type_featfunc && featfunc(v) != NULL;
299 v=(featfunc(v))((
EST_Item *)(
void *)
this));
300 if (v.
type() == val_type_featfunc)
311 {
return (
this == 0) ? 0 : p_contents->Relation(relname); }
315 {
return (
this == 0) ? 0 : p_contents->in_relation(relname); }
325 {
return (
this == 0) ? 0 : p_relation; }
329 {
return contents() && li->contents() && (contents() == li->contents()); }
338 {
if(a !=NULL) a->n = b;
if (b != NULL) b->p=a; }
342 EST_Item *next()
const {
return this == 0 ? 0 : n; }
344 EST_Item *prev()
const {
return this == 0 ? 0 : p; }
346 EST_Item *down()
const {
return this == 0 ? 0 : d; }
348 EST_Item *up()
const {
return this == 0 ? 0 : u; }
396 friend ostream& operator << (ostream &s,
const EST_Item &a);
398 {
return !i_same_item(&a,&b); }
400 {
return i_same_item(&a,&b); }
408 return l1->contents() && l2->contents() &&
409 (l1->contents() == l2->contents());
417 #include "ling_class/EST_Relation_list.h" 418 #include "ling_class/EST_Relation_tree.h" 419 #include "ling_class/EST_Relation_mls.h" 422 {
return node->next_item(); }
424 void remove_item(
EST_Item *l,
const char *relname);
432 #include "ling_class/EST_FeatureFunctionPackage.h" 437 void register_featfunc(
const EST_String &name,
const EST_Item_featfunc func);
438 const EST_Item_featfunc get_featfunc(
const EST_String &name,
int must=0);
439 EST_String get_featname(
const EST_Item_featfunc func);
441 #define EST_register_feature_functions(PACKAGE) \ 443 extern void register_ ## PACKAGE ## _feature_functions(EST_FeatureFunctionPackage &p); \ 444 EST_register_feature_function_package( #PACKAGE , register_ ## PACKAGE ## _feature_functions); \ void set_function(const EST_String &name, const EST_String &funcname)
const int I(const EST_String &name, int def) const
void set_function(const EST_String &name, const EST_String &f)
int same_item(const EST_Item *li) const
True if li is the same item ignoring its relation viewpoint.
int in_relation(const EST_String &relname) const
TRUE if this item is in named relation.
~EST_Item()
Deletes it and references to it in its contents.
const int Int(void) const
const float Float(void) const
EST_Item * as_relation(const char *relname) const
View item from another relation (const char *) method.
EST_Features f
General features for this item.
void set_path(const EST_String &name, const EST_Val &sval)
EST_Item()
Default constructor.
const val_type type(void) const
const EST_String & relation_name() const
The relation name of this particular item.
EST_TKVL< EST_String, EST_Val > & relations()
Access to the relation links.
void set_val(const EST_String &name, const EST_Val &sval)
void remove(const EST_String &name)
int present(const EST_String &name) const
const EST_Val & val_path(const EST_String &path) const
const EST_String & string(void) const
EST_Relation * relation(void) const
The relation of this particular item.
void set_name(const EST_String &s)
set name
const int I(const EST_String &name) const
EST_Features & A(const EST_String &name) const
const float F(const EST_String &name, float def) const
EST_Features & A(const EST_String &name, EST_Features &def) const
const EST_String S(const EST_String &name, const EST_String &def) const
const EST_String S(const EST_String &name) const
const float F(const EST_String &name) const
void f_remove(const EST_String &name)
static const EST_String Empty
Constant empty string.
int f_present(const EST_String &name) const