40#include "ling_class/EST_Item.h"
41#include "ling_class/EST_FeatureFunctionPackage.h"
42#include "EST_FeatureFunctionContext.h"
44#include "ling_class_init.h"
46void EST_FeatureFunctionContext::class_init(
void)
48 ling_class_init::use();
55const EST_String EST_FeatureFunctionContext::separator =
"+";
57EST_FeatureFunctionContext::EST_FeatureFunctionContext(
void)
62EST_FeatureFunctionContext::~EST_FeatureFunctionContext(
void)
66 for(p.begin(packages); p; ++p)
79 for(p.begin(packages); p; ++p)
82 if (package->name() == name)
88EST_String EST_FeatureFunctionContext::get_featfunc_name(
const EST_Item_featfunc func,
int &found)
const
94 for(p.begin(packages); p; ++p)
98 EST_String name = package->lookup(func, found);
111void EST_FeatureFunctionContext::clear_cache(
void)
116void EST_FeatureFunctionContext::add_package(
const EST_String name)
119 EST_error(
"Attempt to add package '%s' to global list",
126 EST_error(
"package '%s' not loaded",
130 packages.prepend(package);
142bool EST_FeatureFunctionContext::package_included(
const EST_String name)
const
144 return get_package(name) != NULL;
147const EST_Item_featfunc EST_FeatureFunctionContext::get_featfunc(
const EST_String name,
154 return cache.
val(name);
156 if ((pos= name.
search(separator, len, 0))>=0)
158 const EST_Item_featfunc func2 =
171 for(p.begin(packages); p; ++p)
181 cache.add_item(name, ent.func);
187 EST_error(
"No feature function '%s'", (
const char *)name);
192const EST_Item_featfunc EST_FeatureFunctionContext::get_featfunc(
const EST_String pname,
201 package->lookup(name, found);
207 EST_error(
"No feature function '%s'", (
const char *)name);
215template <> EST_Item_featfunc
220#if defined(INSTANTIATE_TEMPLATES)
222#include "../base_class/EST_THash.cc"
224Instantiate_TStringHash(EST_Item_featfunc)
226#include "../base_class/EST_TList.cc"
EST_String before(int pos, int len=0) const
Part before position.
static EST_String cat(const EST_String s1, const EST_String s2=Empty, const EST_String s3=Empty, const EST_String s4=Empty, const EST_String s5=Empty, const EST_String s6=Empty, const EST_String s7=Empty, const EST_String s8=Empty, const EST_String s9=Empty)
int search(const char *s, int len, int &mlen, int pos=0) const
Find a substring.
int length(void) const
Length of string ({not} length of underlying chunk)
EST_String after(int pos, int len=1) const
Part after pos+len.
V & val(const K &key, int &found) const
int add_item(const K &key, const V &value, int no_search=0)
Add an entry to the table.
int present(const K &key) const
Does the key have an entry?
void clear(void)
Empty the table.
void prepend(const T &item)
add item onto start of list