"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "include/ling_class/EST_Item.h" between
speech_tools-2.4-release.tar.gz and speech_tools-2.5.0-release.tar.gz

About: The speech_tools - Edinburgh Speech Tools Library (used by the Festival Speech Synthesis System).

EST_Item.h  (speech_tools-2.4-release):EST_Item.h  (speech_tools-2.5.0-release)
skipping to change at line 229 skipping to change at line 229
/** remove feature <parameter>name</parameter> */ /** remove feature <parameter>name</parameter> */
void f_remove(const EST_String &name) void f_remove(const EST_String &name)
{ features().remove(name); } { features().remove(name); }
/** find all the attributes whose values are functions, and /** find all the attributes whose values are functions, and
replace them with their evaluation. */ replace them with their evaluation. */
void evaluate_features(); void evaluate_features();
/** TRUE if feature is present, FALSE otherwise */ /** TRUE if feature is present, FALSE otherwise */
int f_present(const EST_String &name) const int f_present(const EST_String &name) const
{return features().present(name); } {
if (p_contents)
return features().present(name);
else
return FALSE; }
// Number of items (including this) until no next item. // Number of items (including this) until no next item.
int length() const; int length() const;
//@} //@}
// get contents from item // get contents from item
EST_Item_Content *contents() const { return (this == 0) ? 0 : p_contents;} EST_Item_Content *contents() const { return p_contents;}
// used by tree manipulation functions // used by tree manipulation functions
void set_contents(EST_Item_Content *li); void set_contents(EST_Item_Content *li);
// These should be deleted. // These should be deleted.
// The item's name // The item's name
const EST_String name() const const EST_String name() const
{ return (this == 0) ? EST_String::Empty : f("name",0).string(); } { return f("name",0).string(); }
// Set item's name // Set item's name
void set_name(const EST_String &name) const void set_name(const EST_String &name) const
{ if (this != 0) p_contents->set_name(name); } { p_contents->set_name(name); }
// Shouldn't normally be needed, except for iteration // Shouldn't normally be needed, except for iteration
EST_Features &features() const { return p_contents->f; } EST_Features &features() const { return p_contents->f; }
const EST_Val f(const EST_String &name) const const EST_Val f(const EST_String &name) const
{ {
EST_Val v; EST_Val v;
if (this == 0) for (v=p_contents->f.val_path(name);
{ v.type() == val_type_featfunc && featfunc(v) != NULL;
EST_error("item is null so has no %s feature",(const char *)name); v=(featfunc(v))((EST_Item *)(void *)this));
} if (v.type() == val_type_featfunc)
else EST_error("NULL %s function",(const char *)name);
{
for (v=p_contents->f.val_path(name);
v.type() == val_type_featfunc && featfunc(v) != NULL;
v=(featfunc(v))((EST_Item *)(void *)this));
if (v.type() == val_type_featfunc)
EST_error("NULL %s function",(const char *)name);
}
return v; return v;
} }
#if 0 #if 0
const EST_Val &f(const EST_String &name, const EST_Val &def) const const EST_Val &f(const EST_String &name, const EST_Val &def) const
{ {
if (this == 0) if (this == 0)
return def; return def;
else else
{ {
skipping to change at line 290 skipping to change at line 287
v=&(featfunc(*v))((EST_Item *)(void *)this)); v=&(featfunc(*v))((EST_Item *)(void *)this));
if (v->type() == val_type_featfunc) if (v->type() == val_type_featfunc)
v = &def; v = &def;
return *v; return *v;
} }
} }
#endif #endif
const EST_Val f(const EST_String &name, const EST_Val &def) const const EST_Val f(const EST_String &name, const EST_Val &def) const
{ {
if (this == 0) EST_Val v;
return def; for (v=p_contents->f.val_path(name, def);
else v.type() == val_type_featfunc && featfunc(v) != NULL;
{ v=(featfunc(v))((EST_Item *)(void *)this));
EST_Val v; if (v.type() == val_type_featfunc)
for (v=p_contents->f.val_path(name, def); v = def;
v.type() == val_type_featfunc && featfunc(v) != NULL; return v;
v=(featfunc(v))((EST_Item *)(void *)this));
if (v.type() == val_type_featfunc)
v = def;
return v;
}
} }
/**@name Cross relational access */ /**@name Cross relational access */
//@{ //@{
/// View item from another relation (const char *) method /// View item from another relation (const char *) method
EST_Item *as_relation(const char *relname) const EST_Item *as_relation(const char *relname) const
{ return (this == 0) ? 0 : p_contents->Relation(relname); } { return p_contents->Relation(relname); }
/// TRUE if this item is in named relation /// TRUE if this item is in named relation
int in_relation(const EST_String &relname) const int in_relation(const EST_String &relname) const
{ return (this == 0) ? 0 : p_contents->in_relation(relname); } { return p_contents->in_relation(relname); }
/// Access to the relation links /// Access to the relation links
EST_TKVL<EST_String, EST_Val> &relations() {return p_contents->relations;} EST_TKVL<EST_String, EST_Val> &relations() {return p_contents->relations;}
/// The relation name of this particular item /// The relation name of this particular item
const EST_String &relation_name() const; const EST_String &relation_name() const;
/// The relation of this particular item /// The relation of this particular item
EST_Relation *relation(void) const EST_Relation *relation(void) const
{ return (this == 0) ? 0 : p_relation; } { return (this == 0) ? 0 : p_relation; }
skipping to change at line 338 skipping to change at line 330
//@} //@}
// The remaining functions should not be accessed, they are should be // The remaining functions should not be accessed, they are should be
// regarded as private member functions // regarded as private member functions
// Splice together a broken list. // Splice together a broken list.
static void splice(EST_Item *a, EST_Item *b) static void splice(EST_Item *a, EST_Item *b)
{ if(a !=NULL) a->n = b; if (b != NULL) b->p=a; } { if(a !=NULL) a->n = b; if (b != NULL) b->p=a; }
// Internal traversal - nnot recommended - use relation traversal functions // Internal traversal - not recommended - use relation traversal functions
// // As these functions must be safe to NULL arguments they now (gcc6)
EST_Item *next() const { return this == 0 ? 0 : n; } // cannot refer to this, so alway require an explicit pointer to the object
// // These four are the only ones that require access to private fields
EST_Item *prev() const { return this == 0 ? 0 : p; } friend EST_Item *inext(const EST_Item *i);
// friend EST_Item *iprev(const EST_Item *i);
EST_Item *down() const { return this == 0 ? 0 : d; } friend EST_Item *idown(const EST_Item *i);
// friend EST_Item *iup(const EST_Item *i);
EST_Item *up() const { return this == 0 ? 0 : u; }
// Last item (most next) at this level
EST_Item *last() const;
// First item (most prev) at this level
EST_Item *first() const;
// Highest (most up)
EST_Item *top() const;
// Lowest (most down)
EST_Item *bottom() const;
// First item which has no down, within the descendants of this item
EST_Item *first_leaf() const;
// Next item which has no down, following above this item if necessary
EST_Item *next_leaf() const;
// Last item which has no down, following above this item if necessary
EST_Item *last_leaf() const;
// Next item in pre order (root, daughters, siblings)
EST_Item *next_item() const;
// Insert a new item after this, with li's contents // Insert a new item after this, with li's contents
EST_Item *insert_after(EST_Item *li=0); EST_Item *insert_after(EST_Item *li=0);
// Insert a new item before this, with li's contents // Insert a new item before this, with li's contents
EST_Item *insert_before(EST_Item *li=0); EST_Item *insert_before(EST_Item *li=0);
// Insert a new item below this, with li's contents (see tree methods) // Insert a new item below this, with li's contents (see tree methods)
EST_Item *insert_below(EST_Item *li=0); EST_Item *insert_below(EST_Item *li=0);
// Insert a new item above this, with li's contents (see tree methods) // Insert a new item above this, with li's contents (see tree methods)
EST_Item *insert_above(EST_Item *li=0); EST_Item *insert_above(EST_Item *li=0);
skipping to change at line 410 skipping to change at line 385
friend class ling_class_init; friend class ling_class_init;
}; };
inline int i_same_item(const EST_Item *l1,const EST_Item *l2) inline int i_same_item(const EST_Item *l1,const EST_Item *l2)
{ {
return l1->contents() && l2->contents() && return l1->contents() && l2->contents() &&
(l1->contents() == l2->contents()); (l1->contents() == l2->contents());
} }
inline EST_Item *as(const EST_Item *n,const char *relname) inline EST_Item *as(const EST_Item *n,const char *relname)
{ return n->as_relation(relname); } { if (n != 0) return n->as_relation(relname);
return 0;}
EST_Item *inext(const EST_Item *i);
EST_Item *iprev(const EST_Item *i);
EST_Item *idown(const EST_Item *i);
EST_Item *iup(const EST_Item *i);
EST_Item *last(const EST_Item *x);
EST_Item *first(const EST_Item *x);
EST_Item *top(const EST_Item *x);
EST_Item *bottom(const EST_Item *x);
EST_Item *next_item(const EST_Item *node);
EST_Item *first_leaf(const EST_Item *node);
EST_Item *next_leaf(const EST_Item *node);
EST_Item *last_leaf(const EST_Item *node);
// Relation structure functions // Relation structure functions
#include "ling_class/EST_Relation_list.h" #include "ling_class/EST_Relation_list.h"
#include "ling_class/EST_Relation_tree.h" #include "ling_class/EST_Relation_tree.h"
#include "ling_class/EST_Relation_mls.h" #include "ling_class/EST_Relation_mls.h"
inline EST_Item *next_item(const EST_Item *node)
{ return node->next_item(); }
void remove_item(EST_Item *l, const char *relname); void remove_item(EST_Item *l, const char *relname);
void copy_node_tree(EST_Item *from, EST_Item *to); void copy_node_tree(EST_Item *from, EST_Item *to);
void copy_node_tree_contents(EST_Item *from, EST_Item *to); void copy_node_tree_contents(EST_Item *from, EST_Item *to);
void evaluate(EST_Item *a,EST_Features &f); void evaluate(EST_Item *a,EST_Features &f);
#include "ling_class/EST_FeatureFunctionPackage.h" #include "ling_class/EST_FeatureFunctionPackage.h"
// Feature function support // Feature function support
 End of changes. 11 change blocks. 
59 lines changed or deleted 47 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)