本文整理汇总了C++中TypeSystem::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeSystem::getType方法的具体用法?C++ TypeSystem::getType怎么用?C++ TypeSystem::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeSystem
的用法示例。
在下文中一共展示了TypeSystem::getType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: typeSystemInit
TyErrorId typeSystemInit(TypeSystem const & crTypeSystem) {
cout << "SofaExampleAnnotator::typeSystemInit()" << endl;
// get Type and Feature objects for use in process()
annot = crTypeSystem.getType("uima.tcas.Annotation");
cross = crTypeSystem.getType("sofa.test.CrossAnnotation");
other = cross.getFeatureByBaseName("otherAnnotation");
if (!(annot.isValid() && cross.isValid() && other.isValid())) {
cout << "SofaExampleAnnotator::typeSystemInit() - Error getting Type or Feature objects" << endl;
return (TyErrorId)UIMA_ERR_RESMGR_INVALID_RESOURCE;
}
return(TyErrorId)UIMA_ERR_NONE;
}
示例2: initializeTypeSystem
/*!
* Initializes the typesystem types and features
*/
TyErrorId AnnotatorPerformanceAnnotation::initializeTypeSystem(TypeSystem const& crTypeSystem)
{
tAnnotatorPerformanceAnnotation = crTypeSystem.getType("org.gramlab.kwaga.unitex_uima.general.tcas.AnnotatorPerformanceAnnotation");
if (!tAnnotatorPerformanceAnnotation.isValid())
return (TyErrorId) UIMA_ERR_RESMGR_INVALID_RESOURCE;
fComponentName = tAnnotatorPerformanceAnnotation.getFeatureByBaseName("componentName");
fElapsedTime = tAnnotatorPerformanceAnnotation.getFeatureByBaseName("elapsedTime");
return (TyErrorId) UIMA_ERR_NONE;
}
开发者ID:Drlilou,项目名称:gramlab-unitex-cpp-uima-annotator,代码行数:14,代码来源:AnnotatorPerformanceAnnotation.cpp
示例3: initializeTypeSystem
/*!
* Initializes the typesystem types and features
*/
TyErrorId SentenceAnnotation::initializeTypeSystem(TypeSystem const& crTypeSystem)
{
if (ContextAreaAnnotation::initializeTypeSystem(crTypeSystem) != UIMA_ERR_NONE)
return (TyErrorId) UIMA_ERR_RESMGR_INVALID_RESOURCE;
tSentenceAnnotation = crTypeSystem.getType("org.gramlab.kwaga.unitex_uima.unitex.tcas.SentenceAnnotation");
if (!tSentenceAnnotation.isValid())
return (TyErrorId) UIMA_ERR_RESMGR_INVALID_RESOURCE;
fParagraph = tSentenceAnnotation.getFeatureByBaseName("paragraph");
return (TyErrorId) UIMA_ERR_NONE;
}
示例4: typeSystemInit
TyErrorId typeSystemInit(TypeSystem const & crTypeSystem) {
cout << "SofaDataAnnotator: typeSystemInit()" << endl;
annot = crTypeSystem.getType("uima.tcas.Annotation");
return(TyErrorId)UIMA_ERR_NONE;
}
示例5: lang
/*static*/
void
CapabilityContainer::initTypeOrFeatures(
TyMapLang2TypeOrFeatures & rMap, // output argument
Capability::TyVecCapabilityTofs const & vecTofs,
Capability::TyVecCapabilityLanguages const & vecLangs,
TypeSystem const & typeSystem) {
const int BUF_SIZE = 0x100;
char cBuf[BUF_SIZE];
Capability::TyVecCapabilityLanguages::const_iterator itLang;
for (itLang = vecLangs.begin(); itLang != vecLangs.end(); ++itLang) {
// convert unicode lang string to single-byte lang string
assert((*itLang).length() < BUF_SIZE);
// Note: this conversion can be used only for invariant characters
u_UCharsToChars((*itLang).getBuffer(), cBuf, (*itLang).length());
// zero terminate single-byte buffer
cBuf[(*itLang).length()] = '\0';
// Special workaround code for the new way to specify the unspecified language
if (strcasecmp(cBuf, "x-unspecified") == 0) {
strcpy(cBuf, Language::UNSPECIFIED);
}
// create a language object based on single-byte lang string
Language lang(cBuf);
if (!lang.isValid()) {
/* taph 06.02.2003: once we have more detailed information about
the origin of the error we need to replace "unknown configuration file"
with the filename of the XML file (and maybe line number?) */
UIMA_EXC_THROW_NEW(uima::CapabilityException, // exc-type
UIMA_ERR_ENGINE_LANGUAGE_INVALID, // error code
ErrorMessage(UIMA_MSG_ID_EXC_INVALID_LANGUAGE, cBuf), // error message
ErrorMessage(UIMA_MSG_ID_EXCON_CHECKING_CAPABILITY_SPEC,"unknown configuration file"), // error context message
ErrorInfo::recoverable);
}
// create a new empty vector in the map for this lang
TySetTypeOrFeatures & setTofs = rMap[lang];
// now fill the vector with tof objects created from tof strings
Capability::TyVecCapabilityTofs::const_iterator itTof;
for (itTof = vecTofs.begin(); itTof != vecTofs.end(); ++itTof) {
TypeOrFeature tof;
// the tof string may be a type...
Type t = typeSystem.getType(*itTof);
if (t.isValid()) {
tof = TypeOrFeature(t);
} else {
// or the tof string may be a feature
Feature f = typeSystem.getFeatureByFullName(*itTof);
if (f.isValid()) {
tof = TypeOrFeature(f);
} else {
/* taph 06.02.2003: once we have more detailed information about
the origin of the error we need to replace "unknown configuration file"
with the filename of the XML file (and maybe line number?) */
if (tof.isType()) {
UIMA_EXC_THROW_NEW(uima::CapabilityException, // exc-type
UIMA_ERR_INVALID_FSTYPE_OBJECT, // error code
ErrorMessage(UIMA_MSG_ID_EXC_UNKNOWN_TYPE_NAME, *itTof), // error message
ErrorMessage(UIMA_MSG_ID_EXCON_CHECKING_CAPABILITY_SPEC, "unknown configuration file"), // error context message
ErrorInfo::recoverable);
} else {
UIMA_EXC_THROW_NEW(uima::CapabilityException, // exc-type
UIMA_ERR_INVALID_FSFEATURE_OBJECT,// error code
ErrorMessage(UIMA_MSG_ID_EXC_UNKNOWN_FEATURE_NAME, *itTof), // error message
ErrorMessage(UIMA_MSG_ID_EXCON_CHECKING_CAPABILITY_SPEC, "unknown configuration file"), // error context message
ErrorInfo::recoverable);
}
}
}
assert(tof.isValid());
setTofs.insert(tof);
} // for all tof strings
} // for all lang strings
}