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);
96 void unref_contents();
108 static void class_init(
void);
140 {
return f(name,def).
Float();}
151 {
return f(name, def).
string();}
160 {
return f(name, def).
Int();}
172 return *feats(f(name, est_val(ff)));}
210 features().
set_path(name, est_val(ff)); }
224 { features().
remove(name); }
232 {
return features().
present(name); }
250 {
if (
this != 0) p_contents->
set_name(name); }
260 EST_error(
"item is null so has no %s feature",(
const char *)name);
265 v.
type() == val_type_featfunc && featfunc(v) != NULL;
266 v=(featfunc(v))((
EST_Item *)(
void *)
this));
267 if (v.
type() == val_type_featfunc)
268 EST_error(
"NULL %s function",(
const char *)name);
281 for (v=&(p_contents->
f.
val_path(name, def));
282 v->
type() == val_type_featfunc && featfunc(*v) != NULL;
283 v=&(featfunc(*v))((
EST_Item *)(
void *)
this));
284 if (v->
type() == val_type_featfunc)
298 for (v=p_contents->
f.
val_path(name, def);
299 v.
type() == val_type_featfunc && featfunc(v) != NULL;
300 v=(featfunc(v))((
EST_Item *)(
void *)
this));
301 if (v.
type() == val_type_featfunc)
312 {
return (
this == 0) ? 0 : p_contents->Relation(relname); }
316 {
return (
this == 0) ? 0 : p_contents->in_relation(relname); }
326 {
return (
this == 0) ? 0 : p_relation; }
330 {
return contents() && li->contents() && (contents() == li->contents()); }
339 {
if(a !=NULL) a->n = b;
if (b != NULL) b->p=a; }
343 EST_Item *next()
const {
return this == 0 ? 0 : n; }
345 EST_Item *prev()
const {
return this == 0 ? 0 : p; }
347 EST_Item *down()
const {
return this == 0 ? 0 : d; }
349 EST_Item *up()
const {
return this == 0 ? 0 : u; }
397 friend ostream& operator << (ostream &s,
const EST_Item &a);
399 {
return !i_same_item(&a,&b); }
401 {
return i_same_item(&a,&b); }
409 return l1->contents() && l2->contents() &&
410 (l1->contents() == l2->contents());
418 #include "ling_class/EST_Relation_list.h"
419 #include "ling_class/EST_Relation_tree.h"
420 #include "ling_class/EST_Relation_mls.h"
423 {
return node->next_item(); }
425 void remove_item(
EST_Item *l,
const char *relname);
433 #include "ling_class/EST_FeatureFunctionPackage.h"
438 void register_featfunc(
const EST_String &name,
const EST_Item_featfunc func);
439 const EST_Item_featfunc get_featfunc(
const EST_String &name,
int must=0);
440 EST_String get_featname(
const EST_Item_featfunc func);
442 #define EST_register_feature_functions(PACKAGE) \
444 extern void register_ ## PACKAGE ## _feature_functions(EST_FeatureFunctionPackage &p); \
445 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
void set(const EST_String &name, double fval)
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
void set(const EST_String &name, int ival)
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(const EST_String &name, float fval)
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
void set(const EST_String &name, EST_Features &f)
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
void set(const EST_String &name, const EST_String &sval)
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.
void set(const EST_String &name, const char *cval)
int f_present(const EST_String &name) const