本文整理匯總了C++中AddError函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddError函數的具體用法?C++ AddError怎麽用?C++ AddError使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AddError函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: AddError
void THISCLASS::OnStep() {
// Check input image
IplImage *inputimage = mCore->mDataStructureInput.mImage;
if (! inputimage) {
return;
}
if (inputimage->nChannels != 1) {
AddError(wxT("This component requires a grayscale input image."));
}
// Prepare the output image
PrepareOutputImage(inputimage);
// Convert
try {
switch (mBayerType) {
case 0 :
cvCvtColor(inputimage, mOutputImage, CV_BayerBG2BGR);
break;
case 1 :
cvCvtColor(inputimage, mOutputImage, CV_BayerGB2BGR);
break;
case 2 :
cvCvtColor(inputimage, mOutputImage, CV_BayerRG2BGR);
break;
case 3 :
cvCvtColor(inputimage, mOutputImage, CV_BayerGR2BGR);
break;
default :
AddError(wxT("Invalid Bayer Pattern Type"));
return;
}
} catch (...) {
AddError(wxT("Conversion from Bayer to BGR failed."));
}
// Set the output image on the color data structure
mCore->mDataStructureImageColor.mImage = mOutputImage;
// Let the Display know about our image
DisplayEditor de(&mDisplayOutput);
if (de.IsActive()) {
de.SetMainImage(mCore->mDataStructureImageColor.mImage);
}
}
示例2: lua_gettop
int LuaParser::_EventEncounter(std::string package_name, QuestEventID evt, std::string encounter_name, uint32 extra_data,
std::vector<void*> *extra_pointers) {
const char *sub_name = LuaEvents[evt];
int start = lua_gettop(L);
try {
lua_getfield(L, LUA_REGISTRYINDEX, package_name.c_str());
lua_getfield(L, -1, sub_name);
lua_createtable(L, 0, 0);
lua_pushstring(L, encounter_name.c_str());
lua_setfield(L, -2, "name");
quest_manager.StartQuest(nullptr, nullptr, nullptr);
if(lua_pcall(L, 1, 1, 0)) {
std::string error = lua_tostring(L, -1);
AddError(error);
quest_manager.EndQuest();
return 0;
}
quest_manager.EndQuest();
if(lua_isnumber(L, -1)) {
int ret = static_cast<int>(lua_tointeger(L, -1));
lua_pop(L, 2);
return ret;
}
lua_pop(L, 2);
} catch(std::exception &ex) {
std::string error = "Lua Exception: ";
error += std::string(ex.what());
AddError(error);
//Restore our stack to the best of our ability
int end = lua_gettop(L);
int n = end - start;
if(n > 0) {
lua_pop(L, n);
}
}
return 0;
}
示例3: AddError
bool TParserBase::Consume(const char* text, const char* error)
{
if (TryConsume(text))
return true;
else {
AddError(error);
return false;
}
}
示例4: AddError
void THISCLASS::OnStop() {
if (mCamera.StopImageAcquisition() != 0) {
AddError(wxT("Could not stop image acquisition."));
return;
}
if (mOutputImage) {
cvReleaseImage(&mOutputImage);
}
}
示例5: _CheckEmptyEntities
//-----------------------------------------------------------------------------
// Purpose:
// Input : pEntity -
// pList -
// Output :
//-----------------------------------------------------------------------------
static BOOL _CheckEmptyEntities(CMapEntity *pEntity, CListBox *pList)
{
if(!pEntity->IsPlaceholder() && !pEntity->GetChildCount())
{
AddError(pList, ErrorEmptyEntity, (DWORD)pEntity->GetClassName(), pEntity);
}
return(TRUE);
}
示例6: FindDuplicatePlanes
//-----------------------------------------------------------------------------
// Purpose:
// Input : pSolid -
// pList -
// Output :
//-----------------------------------------------------------------------------
static BOOL FindDuplicatePlanes(CMapSolid *pSolid, CListBox *pList)
{
if (DoesContainDuplicates(pSolid))
{
AddError(pList, ErrorDuplicatePlanes, 0, pSolid);
}
return(TRUE);
}
示例7: TEXT
void FWindowsNativeFeedbackContext::Serialize( const TCHAR* V, ELogVerbosity::Type Verbosity, const class FName& Category )
{
// if we set the color for warnings or errors, then reset at the end of the function
// note, we have to set the colors directly without using the standard SET_WARN_COLOR macro
if( Verbosity==ELogVerbosity::Error || Verbosity==ELogVerbosity::Warning )
{
if( TreatWarningsAsErrors && Verbosity==ELogVerbosity::Warning )
{
Verbosity = ELogVerbosity::Error;
}
FString Prefix;
if( Context )
{
Prefix = Context->GetContext() + TEXT(" : ");
}
FString Format = Prefix + FOutputDeviceHelper::FormatLogLine(Verbosity, Category, V);
if(Verbosity == ELogVerbosity::Error)
{
// Only store off the message if running a commandlet.
if ( IsRunningCommandlet() )
{
AddError(Format);
}
}
else
{
// Only store off the message if running a commandlet.
if ( IsRunningCommandlet() )
{
AddWarning(Format);
}
}
}
if( GLogConsole && IsRunningCommandlet() )
{
GLogConsole->Serialize( V, Verbosity, Category );
}
if( !GLog->IsRedirectingTo( this ) )
{
GLog->Serialize( V, Verbosity, Category );
}
// Buffer up the output during a slow task so that we can dump it all to the log console if the show log button is clicked
if(GIsSlowTask)
{
FScopeLock Lock(&CriticalSection);
if(hThread != NULL)
{
LogOutput += FString(V) + FString("\r\n");
SetEvent(hUpdateEvent);
}
}
}
示例8: AddError
void CSrScriptErrorView::AddErrors (CSrScriptErrorArray& Errors)
{
dword Index;
for (Index = 0; Index < Errors.GetSize(); ++Index)
{
AddError(Errors.GetAt(Index));
}
}
示例9: CANAbortCMD
void CANAbortCMD(void){
if((can_Status==CAN_Send)||(can_Status==CAN_Pending)){
Timer0_Stop();
can_queue[can_queue_tail]->cmd=CMD_ABORT;
can_cmd(can_queue[can_queue_tail]);
AddError(ERROR_CAN_SEND);
can_Status=CAN_Ready;
can_queue_tail=(can_queue_tail+1)%CAN_QUEUE_SIZE;
}
}
示例10: CANSend
void CANSend(void){
can_queue[can_queue_tail]->cmd=CMD_TX_DATA;
if(can_cmd(can_queue[can_queue_tail])!=CAN_CMD_ACCEPTED){
can_Status=CAN_Ready;
AddError(ERROR_CAN_ACCEPTED);
}else{
CANGIE|=(1<<ENERR);
Timer0_Start();
}
}
示例11: StdTitle
void SampleErrorListing::CreateListing()
{
StdTitle("Sampler Setup Errors");
SC_SetupErr sampErr;
SampVarArray currSamp;
if (currSamp.Size() < 1)
{
sampErr.SetConstantError("at least 1 variable must be sampled");
AddError(sampErr);
}
for (int i = 0; i < currSamp.Size(); i++)
if (!currSamp[i]->SampleSetupOK(sampErr))
AddError(sampErr);
//for FOSM or PEM - check to make sure all vars belong to same corr group
if (!IsMonteCarlo())
{
int uncertCorrGroup = currSamp[0]->GetCorrGroup();
if (!forceCorrelationsToZero)
{
//case where no correlations are set
if ((currSamp[0]->GetnCorrGroup(uncertCorrGroup) > 1) && (currSamp[0]->correlations.Size() == 0))
AddError("correlations not set or forced to zero");
}
for (int i = 1; i < currSamp.Size(); i++)
{
int currCorrGroup = currSamp[i]->GetCorrGroup();
if (currCorrGroup != uncertCorrGroup)
AddError("FOSM/PEM: all uncertain vars must belong to same correlation group");
if (!forceCorrelationsToZero)
{
//case where individual correlations are not set
for (int j = 0; j < currSamp[i]->correlations.Size(); j++)
{
if (RealIsNull(currSamp[i]->correlations[j].correlationValue))
AddError("correlations not set or forced to zero");
}
}
}
}
}
示例12: GetResultTypeOf
void SecondPass::outNode(StmtIfThenElse* n, bool last){
auto exprType = GetResultTypeOf(n->GetExpr());
if (exprType == nullptr)
return;
if (exprType->name != "bool"){
AddError(n->GetToken(), "Result type of if-else-condition must be 'bool' but is '%s'.", exprType->name.c_str());
}
}
示例13: StdTitle
void DataCaptureErrorListing::CreateListing()
{
StdTitle("Simulation Results Setup Errors");
SC_SetupErr dcErr;
if (dataCaptureData.IsEmpty())
AddError("no output data specified");
for (int i = 0; i < dataCaptureData.Size(); i++)
if (dataCaptureData.IsNotValid(i))
{
AddError("Null capture spec found");
}
else
{
if (!dataCaptureData.GetRef(i).SetupOK(dcErr))
{
AddError(dcErr);
}
}
if (productionRestartTimes.Size() > 0)
{
double prev = productionRestartTimes[0];
for (int i = 1; i < productionRestartTimes.Size(); i++)
{
double next = productionRestartTimes[i];
if (RealIsNull(prev) || RealIsNull(next))
{
AddError("Null production restart time found");
break;
}
if (prev >= next)
{
AddError("Production restart times must be ascending");
break;
}
}
}
}
示例14: AddError
bool LWOFile::LoadUVMap(unsigned int iChunkSize)
{
Layer *pLayer=GetLastLayer();
const char *pChunkEndPos=m_pData+iChunkSize-4;
unsigned short iDimension=0;
if(!ReadU2(iDimension))
{
return false;
}
// not 2 floats per vertex
if(iDimension!=2)
{
// just skip
m_pData+=iChunkSize-4-2;
AddError("Warning: UVMap has "+ConvertToString(iDimension)+" floats per vertex (2 expected)");
return true;
}
unsigned int iStrBytes=0;
std::string strName;
if(!ReadS0(strName,iStrBytes))
{
return false;
}
// VMAP { type[ID4], dimension[U2], name[S0],
// ( vert[VX], value[F4] # dimension )* }
UVMap *pUVMap=new UVMap();
pUVMap->m_strName=strName;
pUVMap->m_Values.resize(2*pLayer->m_iPoints);
pLayer->m_UVMaps.push_back(pUVMap);
float *pValues=&(pUVMap->m_Values[0]);
memset(pValues,0,sizeof(float)*2*pLayer->m_iPoints);
while(m_pData<pChunkEndPos)
{
unsigned int iVertexID=0;
if(!ReadVX(iVertexID)) return false;
if(iVertexID>=pLayer->m_iPoints) return false;
if(!ReadF4(pValues[iVertexID*2+0])) return false;
if(!ReadF4(pValues[iVertexID*2+1])) return false;
// flip v coordinate
pValues[iVertexID*2+1]=1-pValues[iVertexID*2+1];
}
return true;
}
示例15: check
bool FBlueprintReparentTest::RunTest(const FString& BlueprintAssetPath)
{
bool bTestFailed = false;
UBlueprint * const BlueprintTemplate = Cast<UBlueprint>(StaticLoadObject(UBlueprint::StaticClass(), NULL, *BlueprintAssetPath));
if (BlueprintTemplate != NULL)
{
// want to explicitly test switching from actors->objects, and vise versa (objects->actors),
// also could cover the case of changing non-native parents to native ones
TArray<UClass*> TestParentClasses;
if (!BlueprintTemplate->ParentClass->IsChildOf(AActor::StaticClass()))
{
TestParentClasses.Add(AActor::StaticClass());
}
else
{
// not many engine level Blueprintable classes that aren't Actors
TestParentClasses.Add(USaveGame::StaticClass());
}
TArray<FAssetData> Assets;
FBlueprintAutomationTestUtilities::GetAssetListingFromConfig(TEXT("ReparentTest.ParentsPackagePaths"), Assets, UBlueprint::StaticClass());
// additionally gather up any blueprints that we explicitly specify though the config
for (FAssetData const& AssetData : Assets)
{
UClass* AssetClass = FindObject<UClass>(ANY_PACKAGE, *AssetData.AssetClass.ToString());
TestParentClasses.Add(AssetClass);
}
for (UClass* Class : TestParentClasses)
{
UBlueprint* BlueprintObj = FBlueprintAutomationTestUtilities::DuplicateBlueprint(BlueprintTemplate);
check(BlueprintObj != NULL);
BlueprintObj->ParentClass = Class;
if (!FBlueprintAutomationTestUtilities::TestSaveBlueprint(BlueprintObj))
{
AddError(FString::Printf(TEXT("Failed to save blueprint after reparenting with %s: '%s'"), *Class->GetName(), *BlueprintAssetPath));
bTestFailed = true;
}
FBlueprintAutomationTestUtilities::UnloadBlueprint(BlueprintObj);
}
#if WITH_EDITOR
// clear undo history to ensure that the transaction buffer isn't
// holding onto any references to the blueprints we want unloaded
GEditor->Trans->Reset(NSLOCTEXT("BpAutomation", "ReparentTest", "Reparent Blueprint Test"));
#endif // #if WITH_EDITOR
// make sure the unloaded blueprints are properly flushed (for future tests)
CollectGarbage(RF_Native);
}
return !bTestFailed;
}