Overview   Class List   Class Hierarchy   Class Members   Functions & Constants   Defines   Header Files  

uima::AnnotatorContext Class Reference

List of all members.


Detailed Description

The AnnotatorContext is the interface to the configuration settings and other metadata of an AnalysisEngine.

Moreover, it gives access to the logging facility to be used by Annotators. AnnotatorContext defines various extractValue and assignValue methods. These methods are used by the application and annotators to access (or change) configuration parameter values.

Public Types

typedef std::map
< icu::UnicodeString,
AnnotatorContext * > 
TyMapDelegateAnCs
typedef std::map
< icu::UnicodeString, SofaID * > 
TyMapSofaMappings

Public Member Functions

 AnnotatorContext (void)
 AnnotatorContext (AnalysisEngineDescription *taeSpec)
 Note: This object will NOT assume memory ownership of taeSpec.
 ~AnnotatorContext (void)
const SofaIDmapToSofaID (const icu::UnicodeString &componentSofaName)
 Use this method to obtain a SofaID which is a handle to a Sofa in the CAS.
TyMapSofaMappings getSofaMappings () const
 Returns the component sofaname to absolute sofa name mapping for this context.
TyErrorId defineCASPool (size_t numInstances)
 Defines the CAS pool that this AnnotatorContext must support.
CASgetEmptyCAS ()
 Returns an empty CAS from the CASPool.
void releaseCAS (CAS &)
 Return the CAS to the pool.
void release (std::string &value) const
 Release contents of string container filled by extractValue.
void release (std::vector< std::string * > &returnValues) const
 Release contents of vector container filled by extractValue.
bool isParameterDefined (const icu::UnicodeString &paramName) const
 Returns true iff the parameter paramName is defined for this TAE specifier.
bool isParameterDefined (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName) const
 Returns true iff the parameter paramName is defined in the group groupName for this TAE specifier.
const AnalysisEngineDescriptiongetTaeSpecifier () const
 Returns this AnC's AnalysisEngineDescription.
AnnotatorContextgetDelegate (const icu::UnicodeString &key) const
 Returns NULL if no delegate for key can be found.
AnnotatorContextextractDelegate (const icu::UnicodeString &key)
 Returns NULL if no delegate for key can be found.
const TyMapDelegateAnCsgetDelegates () const
 Returns the delegates of this AnnotatorContext.
LogFacilitygetLogger () const
 returns the LogFacility to be used for logging
size_t getTraceCompId () const
const
AnalysisEngineMetaData::TyVecpFSIndexDescriptions 
getFSIndexDescriptions () const
 returns the index descriptions of this AnnotatorContext and all of its delegates
const std::set
< icu::UnicodeString > 
getGroupNamesForParameter (const icu::UnicodeString &paramName) const
TyErrorId extractValue (const icu::UnicodeString &paramName, std::string &value) const
 Return string config params as UTF-8--should be only if you know this is will work with you are dealing with single byte char set.
TyErrorId extractValue (const icu::UnicodeString &paramName, std::vector< std::string * > &returnValues) const
 returns string parameter values as UTF-8 string Caller assumes ownership of objects in the vector
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, std::string &value) const
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, std::vector< std::string * > &returnValues) const
 returns string parameter values as UTF-8 string Caller assumes ownership of objects in the vector
Getters for Configuration Parameter Values
These getters should be used as follows:

  1. If there are no groups defined, use the methods with two arguments
  2. If there is a default group defined, the methods with two arguments will lookup the value in the defailt group
  3. The methods with three arguments will return a value found in the specified group or in one of the fallback groups, as defined in the TextAnalysisEngine specifier.
If parameter name (and group name) are valid, but no value can be found, the methods return UIMA_ERR_CONFIG_NAME_VALUE_PAIR_NOT_FOUND. In this case, the value parameter passed into the method is not changed. All methods check whether type and multiplicity of the value match the definition for paramName. If not, they return an error code. In this case, the value parameter passed into the method is not changed. If the AnnotatorContext belongs to a delegate TextAnalysisEngine, these methods will search in the parent TAE first, as the parent may override values of the delegates.

TyErrorId extractValue (const icu::UnicodeString &paramName, bool &value) const
 inline AnnotatorContext::AnnotatorContext(void) {}
TyErrorId extractValue (const icu::UnicodeString &paramName, std::vector< bool > &returnValues) const
TyErrorId extractValue (const icu::UnicodeString &paramName, int &value) const
TyErrorId extractValue (const icu::UnicodeString &paramName, size_t &value) const
TyErrorId extractValue (const icu::UnicodeString &paramName, std::vector< int > &returnValues) const
TyErrorId extractValue (const icu::UnicodeString &paramName, float &value) const
TyErrorId extractValue (const icu::UnicodeString &paramName, std::vector< float > &returnValues) const
TyErrorId extractValue (const icu::UnicodeString &paramName, icu::UnicodeString &value) const
TyErrorId extractValue (const icu::UnicodeString &paramName, std::vector< icu::UnicodeString > &returnValues) const
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, bool &value) const
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, std::vector< bool > &returnValues) const
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, int &value) const
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, size_t &value) const
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, std::vector< int > &returnValues) const
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, float &value) const
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, std::vector< float > &returnValues) const
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, icu::UnicodeString &value) const
TyErrorId extractValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, std::vector< icu::UnicodeString > &returnValues) const
Setters for Configuration Parameter Values
These setters should be used as follows:

  1. If there are no groups defined, use the methods with two arguments.
  2. If there is a default group defined, the methods without the group name will try to set the value on the default group
  3. To set the values for a certain group, use the methods with group names. Note that there is no fallback strategy: if the group does not exist, the method will return an error
All methods check whether type and multiplicity of the value match the definition for paramName. If not, they return an error code. If the TyErrorId returned is not UIMA_ERR_NONE, the value of the configuration parameter will not have been changed.

TyErrorId assignValue (const icu::UnicodeString &paramName, const bool &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const std::vector< bool > &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const size_t &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const std::vector< size_t > &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const int &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const std::vector< int > &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const float &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const std::vector< float > &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const double &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const std::vector< double > &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const icu::UnicodeString &value)
TyErrorId assignValue (const icu::UnicodeString &paramName, const std::vector< icu::UnicodeString > &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const bool &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const std::vector< bool > &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const int &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const std::vector< int > &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const size_t &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const std::vector< size_t > &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const float &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const std::vector< float > &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const double &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const std::vector< double > &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const icu::UnicodeString &value)
TyErrorId assignValue (const icu::UnicodeString &groupName, const icu::UnicodeString &paramName, const std::vector< icu::UnicodeString > &value)


Member Typedef Documentation

typedef std::map< icu::UnicodeString, AnnotatorContext * > uima::AnnotatorContext::TyMapDelegateAnCs

typedef std::map< icu::UnicodeString, SofaID * > uima::AnnotatorContext::TyMapSofaMappings


Constructor & Destructor Documentation

uima::AnnotatorContext::AnnotatorContext ( void   )  [inline]

uima::AnnotatorContext::AnnotatorContext ( AnalysisEngineDescription taeSpec  ) 

Note: This object will NOT assume memory ownership of taeSpec.

It is the responsibility of the caller to delete taeSpec.

uima::AnnotatorContext::~AnnotatorContext ( void   ) 


Member Function Documentation

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
std::string &  value 
) const [inline]

Return string config params as UTF-8--should be only if you know this is will work with you are dealing with single byte char set.

References uima::NameValuePair::extractSingleByteStringValue(), UIMA_ERR_CONFIG_NAME_VALUE_PAIR_NOT_FOUND, and UIMA_ERR_NONE.

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
std::vector< std::string * > &  returnValues 
) const [inline]

returns string parameter values as UTF-8 string Caller assumes ownership of objects in the vector

References uima::NameValuePair::extractSingleByteStringValues(), UIMA_ERR_CONFIG_NAME_VALUE_PAIR_NOT_FOUND, and UIMA_ERR_NONE.

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
std::string &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
std::vector< std::string * > &  returnValues 
) const [inline]

returns string parameter values as UTF-8 string Caller assumes ownership of objects in the vector

References uima::NameValuePair::extractSingleByteStringValues(), uima::AnalysisEngineDescription::getSearchStrategy(), UIMA_ERR_CONFIG_NAME_VALUE_PAIR_NOT_FOUND, and UIMA_ERR_NONE.

const SofaID& uima::AnnotatorContext::mapToSofaID ( const icu::UnicodeString &  componentSofaName  )  [inline]

Use this method to obtain a SofaID which is a handle to a Sofa in the CAS.

This method looks up the SofaID in the Sofa name mapping provided for this AnalysisEngine. If there is no mapping for the specified Sofa name, it maps to itself. Note: This AnnotatorContext still has memory ownership of the returned object.

References uima::SofaID::getComponentSofaName(), uima::SofaID::setComponentSofaName(), and uima::SofaID::setSofaId().

TyMapSofaMappings uima::AnnotatorContext::getSofaMappings (  )  const [inline]

Returns the component sofaname to absolute sofa name mapping for this context.

Note: This AnnotatorContext still has memory ownership of the returned object.

TyErrorId uima::AnnotatorContext::defineCASPool ( size_t  numInstances  ) 

Defines the CAS pool that this AnnotatorContext must support.

This method must be called before AnnotatorContext#getEmptyCAS() may be called. A CASPool is defined by the framework when the components getCASInstancesRequired() returns a value greater than 0,

CAS& uima::AnnotatorContext::getEmptyCAS (  ) 

Returns an empty CAS from the CASPool.

This AnnotatorContext retains ownership of the CAS instance. To return the CAS to the pool, call releaseCAS.

void uima::AnnotatorContext::releaseCAS ( CAS  ) 

Return the CAS to the pool.

This will first call CAS.reset().

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
bool &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
std::vector< bool > &  returnValues 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
int &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
size_t &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
std::vector< int > &  returnValues 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
float &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
std::vector< float > &  returnValues 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
icu::UnicodeString &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  paramName,
std::vector< icu::UnicodeString > &  returnValues 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
bool &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
std::vector< bool > &  returnValues 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
int &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
size_t &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
std::vector< int > &  returnValues 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
float &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
std::vector< float > &  returnValues 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
icu::UnicodeString &  value 
) const [inline]

TyErrorId uima::AnnotatorContext::extractValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
std::vector< icu::UnicodeString > &  returnValues 
) const [inline]

void uima::AnnotatorContext::release ( std::string &  value  )  const

Release contents of string container filled by extractValue.

Useful when caller and callee use different heaps, e.g. when debug code uses a release library.

void uima::AnnotatorContext::release ( std::vector< std::string * > &  returnValues  )  const

Release contents of vector container filled by extractValue.

Useful when caller and callee use different heaps, e.g. when debug code uses a release library.

bool uima::AnnotatorContext::isParameterDefined ( const icu::UnicodeString &  paramName  )  const

Returns true iff the parameter paramName is defined for this TAE specifier.

bool uima::AnnotatorContext::isParameterDefined ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName 
) const

Returns true iff the parameter paramName is defined in the group groupName for this TAE specifier.

const AnalysisEngineDescription& uima::AnnotatorContext::getTaeSpecifier (  )  const [inline]

Returns this AnC's AnalysisEngineDescription.

References EXISTS.

AnnotatorContext* uima::AnnotatorContext::getDelegate ( const icu::UnicodeString &  key  )  const

Returns NULL if no delegate for key can be found.

Note: This AnnotatorContext still has memory ownership of the returned object.

AnnotatorContext* uima::AnnotatorContext::extractDelegate ( const icu::UnicodeString &  key  ) 

Returns NULL if no delegate for key can be found.

NOTE: This AnnotatorContext will transfer memory ownership of the returned object to the caller. The returned object is removed from the list of delegate AnnotatorContexts

const TyMapDelegateAnCs& uima::AnnotatorContext::getDelegates (  )  const [inline]

Returns the delegates of this AnnotatorContext.

Each delegate is mapped to a unique key. Note: This AnnotatorContext still has memory ownership of the returned objects.

LogFacility& uima::AnnotatorContext::getLogger (  )  const [inline]

returns the LogFacility to be used for logging

References EXISTS.

size_t uima::AnnotatorContext::getTraceCompId (  )  const [inline]

const AnalysisEngineMetaData::TyVecpFSIndexDescriptions uima::AnnotatorContext::getFSIndexDescriptions (  )  const

returns the index descriptions of this AnnotatorContext and all of its delegates

const std::set<icu::UnicodeString> uima::AnnotatorContext::getGroupNamesForParameter ( const icu::UnicodeString &  paramName  )  const

Returns:
A set containing the names of all groups that define paramName. This includes the groups in this AnC and all its parents. Calls to extractValue for each of these group names will succeed (albeit it is not guarenteed that each call will return a value). If the AnC doesn't contain groups, but defines the parameter, a special group name will be returned that can be used in the calls to extractValue. In this case, no group names of any parents will be included in the result, as extractValue on this AnC with these group names would fail.

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const bool &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const std::vector< bool > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const size_t &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const std::vector< size_t > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const int &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const std::vector< int > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const float &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const std::vector< float > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const double &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const std::vector< double > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const icu::UnicodeString &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  paramName,
const std::vector< icu::UnicodeString > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const bool &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const std::vector< bool > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const int &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const std::vector< int > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const size_t &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const std::vector< size_t > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const float &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const std::vector< float > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const double &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const std::vector< double > &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const icu::UnicodeString &  value 
)

TyErrorId uima::AnnotatorContext::assignValue ( const icu::UnicodeString &  groupName,
const icu::UnicodeString &  paramName,
const std::vector< icu::UnicodeString > &  value 
)


The documentation for this class was generated from the following file:

Generated on Mon Oct 1 11:15:07 2012 for UIMACPP API by  doxygen 1.5.6