本文整理汇总了C++中ErrorInfo::getErrorId方法的典型用法代码示例。如果您正苦于以下问题:C++ ErrorInfo::getErrorId方法的具体用法?C++ ErrorInfo::getErrorId怎么用?C++ ErrorInfo::getErrorId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorInfo
的用法示例。
在下文中一共展示了ErrorInfo::getErrorId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckError
/* Similar routine as above just with error info objects instead of err-ids.
This routine just does a hard program exit for any failure!
*/
static void CheckError(ErrorInfo const &errInfo) {
if (errInfo.getErrorId() != UIMA_ERR_NONE) {
cerr << endl << " *** ExampleApplication - Error info:" << endl
<< "Error string : "
<< AnalysisEngine::getErrorIdAsCString(errInfo.getErrorId())
<< errInfo << endl; /* (errInfo starts with a newline) */
exit((int) errInfo.getErrorId());
}
}
示例2: testCallingSequence1
void testCallingSequence1(uima::util::ConsoleUI& rclConsole, const TCHAR* cpszConfigFilename)
/* ----------------------------------------------------------------------- */
{
ErrorInfo errInfo;
uima::TextAnalysisEngine* pEngine = TextAnalysisEngine::createTextAnalysisEngine(cpszConfigFilename, errInfo);
failIfNotTrue(errInfo.getErrorId() == UIMA_ERR_NONE);
failIfNotTrue(pEngine != NULL);
CAS* cas = pEngine->newCAS();
failIfNotTrue(cas != NULL);
uima::UnicodeStringRef us(UnicodeString("a"));
// UnicodeStringRef uRef(us);
rclConsole.formatHeader(_TEXT("testing Engine CallingSequence1"));
cas->setDocumentText(us.getBuffer(), us.length());
cas->getDocumentAnnotation().setLanguage("en");
failIfNotTrue(pEngine->process(*cas) == UIMA_ERR_NONE);
failIfNotTrue(cas->reset() == UIMA_ERR_NONE);
failIfNotTrue(pEngine->destroy() == UIMA_ERR_NONE);
cas->setDocumentText(us.getBuffer(), us.length());
cas->getDocumentAnnotation().setLanguage("en");
failIfNotTrue(pEngine->process(*cas) == UIMA_ERR_ENGINE_INVALID_CALLING_SEQUENCE);
TyErrorId deInitRC = pEngine->destroy();
rclConsole.format("RC of deInit()", deInitRC);
failIfNotTrue(deInitRC == UIMA_ERR_ENGINE_INVALID_CALLING_SEQUENCE);
rclConsole.formatBool(_TEXT("testing Engine CallingSequence1 OK"),
true); //lint !e944: argument for operator '!' always evaluates to False
delete cas;
delete pEngine;
} //lint !e715: cpszConfigFilename (line 99) not referenced
示例3: testDescriptorNotFound
void testDescriptorNotFound(uima::util::ConsoleUI& rclConsole)
/* ----------------------------------------------------------------------- */
{
rclConsole.info("testDescriptorNotFound start.");
uima::TextAnalysisEngine* pEngine;
ErrorInfo errInfo;
pEngine = TextAnalysisEngine::createTextAnalysisEngine(_TEXT("DUMMY"), errInfo);
failIfNotTrue(errInfo.getErrorId() == UIMA_ERR_RESOURCE_CORRUPTED);
failIfNotTrue(pEngine == NULL);
rclConsole.info("testDescriptorNotFound finished.");
}
示例4: testMissingResMgr
void testMissingResMgr(uima::util::ConsoleUI& rclConsole)
/* ----------------------------------------------------------------------- */
{
rclConsole.info("testMissingResMgr start.");
uima::TextAnalysisEngine* pEngine;
failIfNotTrue(!ResourceManager::hasInstance());
ErrorInfo errInfo;
pEngine = TextAnalysisEngine::createTextAnalysisEngine(_TEXT("DUMMY"), errInfo);
failIfNotTrue(!ResourceManager::hasInstance());
failIfNotTrue(errInfo.getErrorId() == UIMA_ERR_ENGINE_RESMGR_NOT_INITIALIZED);
failIfNotTrue(pEngine == NULL);
rclConsole.info("testMissingResMgr finished.");
}
示例5: testCallingSequence2
void testCallingSequence2(uima::util::ConsoleUI& rclConsole, const TCHAR* cpszConfigFilename)
/* ----------------------------------------------------------------------- */
{
rclConsole.formatHeader(_TEXT("testing Engine CallingSequence2"));
{
uima::TextAnalysisEngine* pEngine = NULL;
ErrorInfo errInfo;
pEngine = TextAnalysisEngine::createTextAnalysisEngine(cpszConfigFilename, errInfo);
failIfNotTrue(errInfo.getErrorId() == UIMA_ERR_NONE);
failIfNotTrue(pEngine != NULL);
delete pEngine;
}
rclConsole.formatBool(_TEXT("testing Engine CallingSequence2 OK"),
true); //lint !e944: argument for operator '!' always evaluates to False
}
示例6: testCallingSequence3
void testCallingSequence3(uima::util::ConsoleUI& rclConsole, const TCHAR* cpszConfigFilename)
/* ----------------------------------------------------------------------- */
{
uima::TextAnalysisEngine* pEngine = NULL;
uima::Language clLanguage(MAIN_DEFAULT_LANG);
const char* clCCSID = MAIN_DEFAULT_CCSID_STR;
TyErrorId utErrorId;
UnicodeString us("a");
UnicodeStringRef uref(us);
rclConsole.formatHeader(_TEXT("testing Engine CallingSequence3"));
ErrorInfo errInfo;
pEngine = TextAnalysisEngine::createTextAnalysisEngine(cpszConfigFilename, errInfo);
failIfNotTrue(errInfo.getErrorId() == UIMA_ERR_NONE);
failIfNotTrue(pEngine != NULL);
CAS* cas = pEngine->newCAS();
failIfNotTrue(cas != NULL);
/* test for NULL ptrs */
UnicodeStringRef uref2(NULL);
cas->setDocumentText(uref2.getBuffer(), uref2.length());
cas->getDocumentAnnotation().setLanguage("en");
failIfNotTrue(pEngine->process(*cas) == UIMA_ERR_NONE);
failIfNotTrue(cas->reset() == UIMA_ERR_NONE);
/* test for subsequent processes */
cas->setDocumentText(uref2.getBuffer(), uref2.length());
cas->getDocumentAnnotation().setLanguage("en");
failIfNotTrue(pEngine->process(*cas) == UIMA_ERR_NONE);
failIfNotTrue(pEngine->process(*cas) == UIMA_ERR_NONE);
utErrorId = pEngine->destroy();
failIfNotTrue(utErrorId == UIMA_ERR_NONE);
delete cas;
delete pEngine;
rclConsole.formatBool(_TEXT("testing Engine CallingSequence3 OK"),
true); //lint !e944: argument for operator '!' always evaluates to False
}
示例7: testLoadData
bool testLoadData(uima::util::ConsoleUI& rclConsole,
const char* cpszCCSID,
const TCHAR* cpszConfigFilename,
const TCHAR* cpszLanguage,
size_t uiNumOfIterations)
/* ----------------------------------------------------------------------- */
{
uima::TextAnalysisEngine* pEngine = NULL;
///uima::CCSID clCCSID(lCCSID);
uima::Language clLanguage(cpszLanguage);
ErrorInfo errInfo;
rclConsole.formatHeader(_TEXT("testing UIMA Engine loading a document"));
/* init engine */
pEngine = TextAnalysisEngine::createTextAnalysisEngine(cpszConfigFilename, errInfo);
uimaToolHandleErrorId(rclConsole, errInfo.getErrorId(), errInfo.asString().c_str(), _TEXT("uima::Engine::init()"),
gs_lExpectedInitRc);
if (gs_lExpectedInitRc != UIMA_ERR_NONE) {
return (false);
}
failIfNotTrue(pEngine != NULL);
for (size_t ui = 0; ui < uiNumOfIterations; ui++) {
const TCHAR* cpszInpTerm = 0;
/* read in file */
if (uiNumOfIterations > 1) {
rclConsole.newline();
rclConsole.format(_TEXT("Iteration"), (unsigned long) ui);
}
if (rclConsole.hasArgString(_TEXT("inpterm"), cpszInpTerm)) {
testProcessTerm(rclConsole, *pEngine, cpszCCSID, clLanguage, cpszInpTerm);
} else {
testProcessDocu(rclConsole, *pEngine, cpszCCSID, clLanguage);
}
}
TyErrorId utErrorId = pEngine->destroy();
uimaToolHandleErrorId(rclConsole, utErrorId, pEngine->getAnnotatorContext().getLogger().getLastErrorAsCStr(),
_TEXT("uima::Engine::deInit"));
delete pEngine;
return (true);
}
示例8: testCasMultiplier
void testCasMultiplier(uima::util::ConsoleUI& rclConsole)
/* ----------------------------------------------------------------------- */
{
rclConsole.info("testCasMultiplier start.");
uima::TextAnalysisEngine* pEngine;
ErrorInfo errInfo;
UnicodeString filename("SimpleTextSegmenter.xml");
UnicodeString fn = ResourceManager::resolveFilename(filename, filename);
pEngine = TextAnalysisEngine::createTextAnalysisEngine(UnicodeStringRef(fn).asUTF8().c_str(), errInfo);
failIfNotTrue(errInfo.getErrorId() == UIMA_ERR_NONE);
failIfNotTrue(pEngine != NULL);
//test operational properties settings
failIfNotTrue(pEngine->getAnalysisEngineMetaData().getOperationalProperties()->getOutputsNewCASes() == true);
failIfNotTrue(pEngine->getAnalysisEngineMetaData().getOperationalProperties()->getModifiesCas() == false);
failIfNotTrue(
pEngine->getAnalysisEngineMetaData().getOperationalProperties()->isMultipleDeploymentAllowed() == true);
CAS* cas = pEngine->newCAS();
cas->setDocumentText(
UnicodeString("This is the first sentence. This is the second sentence. This is the third sentence."));
CASIterator iter = pEngine->processAndOutputNewCASes(*cas);
int num = 0;
while (iter.hasNext()) {
num++;
CAS& seg = iter.next();
failIfNotTrue(seg.getDocumentText().length() > 0);
pEngine->getAnnotatorContext().releaseCAS(seg);
}
failIfNotTrue(num == 3);
delete pEngine;
delete cas;
rclConsole.info("testCasMultiplier finished.");
}