本文整理汇总了C++中InternalError函数的典型用法代码示例。如果您正苦于以下问题:C++ InternalError函数的具体用法?C++ InternalError怎么用?C++ InternalError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InternalError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// static
void
PositionCalculationCollection::typeFromEnum(const char *post,
e_poscalc_t *type, int *flags)
{
if (post[0] == 'a')
{
*type = POS_ATOM;
*flags &= ~(POS_MASS | POS_COMPLMAX | POS_COMPLWHOLE);
return;
}
/* Process the prefix */
const char *ptr = post;
if (post[0] == 'w')
{
*flags &= ~POS_COMPLMAX;
*flags |= POS_COMPLWHOLE;
ptr = post + 6;
}
else if (post[0] == 'p')
{
*flags &= ~POS_COMPLWHOLE;
*flags |= POS_COMPLMAX;
ptr = post + 5;
}
else if (post[0] == 'd')
{
*flags &= ~(POS_COMPLMAX | POS_COMPLWHOLE);
ptr = post + 4;
}
if (ptr[0] == 'r')
{
*type = POS_RES;
}
else if (ptr[0] == 'm')
{
*type = POS_MOL;
}
else
{
GMX_THROW(InternalError("Unknown position calculation type"));
}
if (strlen(ptr) < 7)
{
GMX_THROW(InternalError("Unknown position calculation type"));
}
if (ptr[6] == 'm')
{
*flags |= POS_MASS;
}
else if (ptr[6] == 'g')
{
*flags &= ~POS_MASS;
}
else
{
GMX_THROW(InternalError("Unknown position calculation type"));
}
}
示例2: EmitVar
void EmitVar(Var * var, UInt8 format)
{
Bool non_keyword = true;
if (var != NULL) {
if (var->mode == INSTR_SRC_FILE) {
EmitStr(var->name);
} else if (var->mode == INSTR_ELEMENT) {
if (VarIsStructElement(var)) {
EmitVar(var->adr, format);
EmitStr("+");
EmitVar(var->var, format);
} else {
InternalError("don't know how to emit array element");
}
} else if (var->mode == INSTR_DEREF) {
EmitVar(var->var, format);
} else if (var->mode == INSTR_BYTE) {
InternalError("don't know how to emit byte array element");
} else if (var->name != NULL) {
// *** Module parameters (4)
// When parameter name is emmited, it is prefixed with PARAM_ prefix
if (VarIsParam(var)) {
EmitStr("PARAM_");
} else if (var->mode == INSTR_INT && var->type != NULL && var->type->variant == TYPE_INT && var->type->owner != NULL) {
EmitVarName(var->type->owner);
EmitStr("__");
} else if (var->scope != NULL && var->scope != &ROOT_PROC && var->scope != CPU->SCOPE && var->scope->name != NULL && !VarIsLabel(var)) {
EmitVarName(var->scope);
EmitStr("__");
} else {
non_keyword = true;
// For variables (excluding registers), emit extra underscore at the beginning to prevent name clash with assembler built-in keywords and register names
if (!VarIsReg(var)) {
EmitStr("_");
}
}
EmitVarName(var);
} else if (var->mode == INSTR_TEXT) {
if (format == 1) {
EmitStrConst(var->str);
} else {
EmitStr(var->str);
}
} else {
ASSERT(var->mode == INSTR_INT);
EmitBigInt(&var->n);
}
}
}
示例3: InternalError
string Z3Model::ToString() const
{
if (Ctx == nullptr || Model == nullptr) {
throw InternalError((string)"ToString() called on a null Z3Model object");
}
return string(Z3_model_to_string(Ctx, Model));
}
示例4: Node
Document::Document(xmlDocPtr doc) : Node(reinterpret_cast<xmlNodePtr>(doc))
{
if ( _xml == nullptr )
throw InternalError("Failed to create new document");
// ensure the right polymorphic type ptr is installed
_xml->_private = this;
}
示例5: xmlAddNextSibling
void Node::InsertAfter(Node *child)
{
xmlNodePtr newNode = xmlAddNextSibling(xml(), child->xml());
if ( newNode == nullptr )
throw InternalError("Unable to add child node", xmlGetLastError());
child->rebind(newNode);
}
示例6: MiscError
//
// newTypeIndex defaulted to 0 to indicate that a new type is to be enter.
//
void TypeIndexMap::Insert( const type_index oldTypeIndex,
const type_index newTypeIndex )
/********************************************************/
{
try {
if ( newTypeIndex != 0 ) {
_mappingTable[oldTypeIndex].globalIndex = newTypeIndex;
_mappingTable[oldTypeIndex].isNewType = FALSE;
} else {
// check if running out of types.
if ( _currentGlobalIndex >= 0xffff ) {
throw MiscError("fatal : running out of type indices.");
}
_mappingTable[oldTypeIndex].globalIndex = _currentGlobalIndex++;
_mappingTable[oldTypeIndex].isNewType = TRUE;
}
// testing code.
_mappingTable[oldTypeIndex].isDone = TRUE;
}
catch (...) {
cerr << "index : " << oldTypeIndex << endl;
throw InternalError("packtype.cpp : TypeIndexMap::Lookup() index range failed.");
}
}
示例7: InternalError
//-------------------------------------------------------------------------------------------------
LuaWorker::LuaWorker(IConsole *pConsole)
:QObject(NULL)
,IScriptEngine()
,ISyncContext()
,m_pConsole(pConsole)
,m_mtxTasks()
,m_luaState(NULL)
,m_pSysVar(NULL)
,m_vLuaTables()
{
ILuaTable::setSyncContext(this);
// Hier keine dynamische allokation, da diese im Hauptthread geschehen würde!
if (m_pConsole==NULL)
throw InternalError(tr("Can't create Lua worker with null console pointer"));
m_vLuaTables.push_back(new LuaTabWindow());
m_vLuaTables.push_back(new LuaTabSys());
m_vLuaTables.push_back(new LuaTabMessageBox());
m_vLuaTables.push_back(new LuaTabCanvas());
init();
initTables();
splashScreen();
}
示例8: readNextFrame
EnergyFrame
EnergyFrameReader::frame()
{
EnergyFrame energyFrame;
if (!haveProbedForNextFrame_)
{
readNextFrame();
}
if (!nextFrameExists_)
{
GMX_THROW(APIError("There is no next frame, so there should have been no attempt to use the data, e.g. by reacting to a call to readNextFrame()."));
}
// The probe filled enxframe_ with new data, so now we use that data to fill energyFrame
t_enxframe *enxframe = enxframeGuard_.get();
energyFrame.time_ = enxframe->t;
energyFrame.step_ = enxframe->step;
for (auto &index : indicesOfEnergyFields_)
{
if (index.second >= enxframe->nre)
{
GMX_THROW(InternalError(formatString("Index %d for energy %s not present in energy frame with %d energies",
index.second, index.first.c_str(), enxframe->nre)));
}
energyFrame.values_[index.first] = enxframe->ener[index.second].e;
}
// Prepare for reading future frames
haveProbedForNextFrame_ = false;
nextFrameExists_ = false;
return energyFrame;
}
示例9: InternalError
//
// GetLevelName
//
const char *GetLevelName(void)
{
if (!wad.current_level)
InternalError("GetLevelName: no current level");
return wad.current_level->name;
}
示例10: SeparateSegs
//
// SeparateSegs
//
void SeparateSegs(superblock_t *seg_list, seg_t *part,
superblock_t *lefts, superblock_t *rights,
intersection_t ** cut_list)
{
int num;
while (seg_list->segs)
{
seg_t *cur = seg_list->segs;
seg_list->segs = cur->next;
cur->block = NULL;
DivideOneSeg(cur, part, lefts, rights, cut_list);
}
// recursively handle sub-blocks
for (num=0; num < 2; num++)
{
superblock_t *A = seg_list->subs[num];
if (A)
{
SeparateSegs(A, part, lefts, rights, cut_list);
if (A->real_num + A->mini_num > 0)
InternalError("SeparateSegs: child %d not empty !", num);
FreeSuper(A);
seg_list->subs[num] = NULL;
}
}
seg_list->real_num = seg_list->mini_num = 0;
}
示例11: HLAfloat64TimeFactory
/*
* Provides a factory for the standard logical time types HLAfloat64Time
* and HLAinteger64Time. The RTI reference time library's LogicalTimeFactoryFactory
* should just forward requests to here.
*/
std::auto_ptr<LogicalTimeFactory>
HLAlogicalTimeFactoryFactory::makeLogicalTimeFactory( const std::wstring& implementationName )
{
if( implementationName.compare(L"HLAfloat64TimeFactory") == 0 )
{
return auto_ptr<LogicalTimeFactory>( new HLAfloat64TimeFactory() );
}
else if( implementationName.compare(L"HLAinteger64TimeFactory") == 0 )
{
return auto_ptr<LogicalTimeFactory>( new HLAinteger64TimeFactory() );
}
else if( implementationName.compare(L"HLAfloat64Time") == 0 )
{
return auto_ptr<LogicalTimeFactory>( new HLAfloat64TimeFactory() );
}
else if( implementationName.compare(L"HLAinteger64Time") == 0 )
{
return auto_ptr<LogicalTimeFactory>( new HLAinteger64TimeFactory() );
}
else
{
wstringstream wss;
wss << "Unknown time implementation type [" << implementationName <<
"]: Must be HLAfloat64TimeFactory or HLAinteger64TimeFactory";
throw InternalError( wss.str() );
}
}
示例12: _options
SelectionCollection::Impl::Impl(gmx_ana_poscalc_coll_t *pcc)
: _options("selection", "Common selection control"),
_debugLevel(0), _grps(NULL)
{
_sc.root = NULL;
_sc.nvars = 0;
_sc.varstrs = NULL;
_sc.top = NULL;
gmx_ana_index_clear(&_sc.gall);
_sc.pcc = pcc;
_sc.mempool = NULL;
_sc.symtab = NULL;
// TODO: This is not exception-safe if any called function throws.
if (_sc.pcc == NULL)
{
int rc = gmx_ana_poscalc_coll_create(&_sc.pcc);
if (rc != 0)
{
// TODO: A more reasonable error
GMX_THROW(InternalError("Failed to create position calculation collection"));
}
_flags.set(Impl::efOwnPositionCollection);
}
_gmx_sel_symtab_create(&_sc.symtab);
gmx_ana_selmethod_register_defaults(_sc.symtab);
}
示例13: result
void HelpWriterContext::Impl::processMarkup(const std::string &text,
WrapperInterface *wrapper) const
{
std::string result(text);
for (ReplaceList::const_iterator i = replacements_.begin();
i != replacements_.end(); ++i)
{
result = replaceAll(result, i->search, i->replace);
}
switch (state_->format_)
{
case eHelpOutputFormat_Console:
{
result = repall(result, sandrTty);
result = replaceLinks(result);
return wrapper->wrap(result);
}
case eHelpOutputFormat_Man:
{
// Needs to be done first to avoid '-' -> '\-' messing up the links.
result = replaceLinks(result);
result = repall(result, sandrMan);
return wrapper->wrap(result);
}
case eHelpOutputFormat_Html:
{
result = repall(result, sandrHtml);
result = replaceLinks(result);
return wrapper->wrap(result);
}
default:
GMX_THROW(InternalError("Invalid help output format"));
}
}
示例14: GrammarNode
GrammarFunc::GrammarFunc(const Grammar* TheGrammar,
const FuncOperatorBase* FuncOp,
const vector<GrammarNode*>& Children)
: GrammarNode(TheGrammar, FuncOp->GetEvalType()), Op(FuncOp), Children(Children)
{
// Check that all children belong to the same grammar
for (auto const& Child : Children) {
if (Child->GetGrammar() != TheGrammar) {
throw InternalError((string)"Error: Attempted to combine nodes from different grammars.\n" +
"At " + __FILE__ + ":" + to_string(__LINE__));
}
}
// Check that the types match
auto FuncType = FuncOp->GetFuncType();
const uint32 Arity = FuncOp->GetArity();
if (Children.size() != Arity) {
throw TypeException((string)"Operator \"" + FuncOp->GetName() + "\" expects " +
to_string(Arity) + " operands, but received " + to_string(Children.size()) +
" operands.");
}
for (uint32 i = 0; i < Arity; ++i) {
if (Children[i]->GetType() != FuncType->GetDomainTypes()[i]) {
throw TypeException((string)"Type mismatch in arguments to operator \"" +
FuncOp->GetName() + "\"");
}
}
}
示例15: declarationFromTypes
Node<DeclarationNode>::Link DeclarationParser::declaration(bool throwIfEmpty) {
if (accept(TT::SEMI)) {
if (throwIfEmpty) throw InternalError("Empty declaration", {METADATA_PAIRS});
else return nullptr;
}
if (accept(TT::DEFINE)) {
skip();
// Dynamic variable declaration
expect(TT::IDENTIFIER, "Unexpected token after define keyword");
return declarationFromTypes({});
} else if (accept(TT::IDENTIFIER)) {
auto ident = current().data;
skip();
// Single-type declaration
if (accept(TT::IDENTIFIER)) {
return declarationFromTypes({ident});
}
// Multi-type declaration
if (accept(",")) {
TypeList types = {ident};
do {
skip();
expect(TT::IDENTIFIER, "Expected identifier in type list");
types.insert(current().data);
skip();
} while (accept(","));
expect(TT::IDENTIFIER);
return declarationFromTypes(types);
}
}
throw Error("SyntaxError", "Invalid declaration", current().trace);
}