当前位置: 首页>>代码示例>>C++>>正文


C++ RuntimeException函数代码示例

本文整理汇总了C++中RuntimeException函数的典型用法代码示例。如果您正苦于以下问题:C++ RuntimeException函数的具体用法?C++ RuntimeException怎么用?C++ RuntimeException使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RuntimeException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: throw

void SthenoCore::changeIIDOfService(UUIDPtr& sid, UUIDPtr& iid, UUIDPtr& newIid) throw (RuntimeException&, ServiceException&) {
    if (!isValid()) {
        throw RuntimeException(RuntimeException::INVALID_RUNTIME);
    }
    LocalServicePtr servicePtr;
    if (m_serviceMap.find(sid, servicePtr) == -1) {
        throw ServiceException(ServiceException::SERVICE_NOT_KNOWN);
    }

    servicePtr->setIID(iid, newIid);
    ServiceInstanceInfoPtr info;
    servicePtr->getInstancesOfServiceInfo(newIid, info);
    //info has the newIid
    MeshPtr meshPtr;
    try {
        getOverlay()->getMesh(meshPtr);
    } catch (OverlayException& ex) {
        throw RuntimeException(RuntimeException::INVALID_OVERLAY);
    }
    meshPtr->onServiceUpdateIID(sid, iid, newIid);
}
开发者ID:edenduthie,项目名称:rtft1,代码行数:21,代码来源:SthenoCore.cpp

示例2: IMG_Load

SDL_Surface* Art::LoadTex(const char *fileName)
{
	SDL_Surface *s = IMG_Load(fileName);
	if (!s)
	{
		char message[0xff];
		sprintf(message, "Can not load resource file %s", fileName);
		throw RuntimeException(message);
	}

	return s;
}
开发者ID:iodiot,项目名称:Amaze,代码行数:12,代码来源:art.cpp

示例3: return

/*!
  Returns the MongoDB driver associated with the TMongoQuery object.
*/
const TMongoDriver *TMongoQuery::driver() const
{
#ifdef TF_NO_DEBUG
    return (const TMongoDriver *)database.driver();
#else
    const TMongoDriver *driver = dynamic_cast<const TMongoDriver *>(database.driver());
    if (!driver) {
        throw RuntimeException("cast error", __FILE__, __LINE__);
    }
    return driver;
#endif
}
开发者ID:CasyWang,项目名称:treefrog-framework,代码行数:15,代码来源:tmongoquery.cpp

示例4: RuntimeException

void LayeredConfiguration::setRaw(const std::string& key, const std::string& value)
{
	for (ConfigList::iterator it = _configs.begin(); it != _configs.end(); ++it)
	{
		if (it->writeable)
		{
			it->pConfig->setRaw(key, value);
			return;
		}
	}
	throw RuntimeException("No writeable configuration object to store the property", key);
}
开发者ID:12307,项目名称:poco,代码行数:12,代码来源:LayeredConfiguration.cpp

示例5: RuntimeException

void executive::ReconvergenceTFSoftware::eval_Exit(
	executive::CTAContext &context, 
	const ir::PTXInstruction &instr) {
	if (stack.size() == 1 &&
		context.active.count() == context.active.size()) {
		context.executionState = CTAContext::Exit;
	}
	else {
		throw RuntimeException("not all threads hit the exit: ",
			context.PC, instr);
	}
}
开发者ID:AlexanderStohr,项目名称:gpuocelot,代码行数:12,代码来源:ReconvergenceMechanism.cpp

示例6: anyUnhandledExceptions

bool ConcurrentMergeScheduler::anyUnhandledExceptions() {
    if (!allInstances) {
        boost::throw_exception(RuntimeException(L"setTestMode() was not called"));
    }
    SyncLock instancesLock(&allInstances);
    for (Collection<ConcurrentMergeSchedulerPtr>::iterator instance = allInstances.begin(); instance != allInstances.end(); ++instance) {
        (*instance)->sync();
    }
    bool v = anyExceptions;
    anyExceptions = false;
    return v;
}
开发者ID:304471720,项目名称:LucenePlusPlus,代码行数:12,代码来源:ConcurrentMergeScheduler.cpp

示例7: AtomSpace_getAtomByHandle

int AtomSpace_getAtomByHandle( AtomSpace* this_ptr
                             , UUID handle
                             , char** type
                             , char** name
                             , UUID** out
                             , int* out_len)
{
    Handle h(handle);
    if(!h)
        throw InvalidParamException(TRACE_INFO,
            "Invalid Handler parameter.");

    const std::string &str = classserver().getTypeName(h->getType());
    (*type) = (char*) malloc(sizeof(char) * (str.length()+1));
    if(!(*type))
        throw RuntimeException(TRACE_INFO,"Failed malloc.");
    std::strcpy(*type, str.c_str());

    NodePtr ptr = NodeCast(h);
    if(ptr){//It is a node.
        const std::string &str = ptr->getName();
        (*name) = (char*) malloc(sizeof(char) * (str.length()+1));
        if(!(*name))
            throw RuntimeException(TRACE_INFO,"Failed malloc.");
        std::strcpy(*name, str.c_str());
        return 1;
    }else{//It is a link.
        LinkPtr lnk = LinkCast(h);
        if(!lnk)
            throw RuntimeException(TRACE_INFO,"Error in cast Link.");
        *out_len=lnk->getArity();
        (*out) = (UUID*) malloc(sizeof(UUID) * (*out_len));
        if(!(*out))
            throw RuntimeException(TRACE_INFO,"Failed malloc.");
        int i;
        for(i=0;i<(*out_len);i++)
            (*out)[i]=lnk->getOutgoingAtom(i).value();
        return 0;
    }
}
开发者ID:virneo,项目名称:atomspace,代码行数:40,代码来源:AtomSpace_CWrapper.cpp

示例8: RuntimeException

void Image::loadData(std::unique_ptr<util::UseQueryResults> &rs) {
    if (!rs)
        throw RuntimeException("(ImageData:LoadData) UseQueryResult was NULL");

    _image.release();
    rs->getString("Name", _name);
    rs->getString("Path", _img_path);
    _location = rs->getInt("Location");
    _docID = rs->getInt("docID");
    _imgID = rs->getInt("idImages");
    if (rs->hasField("Category"))
        _category = rs->getInt("Category");
}
开发者ID:slate6715,项目名称:GN_Utilities,代码行数:13,代码来源:Image.cpp

示例9: RuntimeException

JClass::JClass(QString clsName)
{
	JNIEnv* env = *JVM::instance();

	clsName.replace('.', '/');
	QByteArray name = clsName.toUtf8();

	jclass obj = env->FindClass(name.constData());
	if (!obj)
		throw RuntimeException(QObject::tr("Java class %1 not found or failed to load").arg(clsName));
	m_class = (jclass) env->NewGlobalRef(obj);
	env->DeleteLocalRef(obj);
}
开发者ID:ActionLuzifer,项目名称:fatrat,代码行数:13,代码来源:JClass.cpp

示例10: FreeLibrary

void Win32::unload()
{
    if(m_handle != 0)
    {
        BOOL result;
        result = FreeLibrary(m_handle);
        if(!result)
        {
            throw RuntimeException("Module unload failed.");
        }
        m_handle = 0;
    }
}
开发者ID:fw4spl-org,项目名称:fw4spl,代码行数:13,代码来源:Win32.cpp

示例11: GetCurrentInstructionPos

    void VM::ForInit(Value *var, Value *limit, Value *step)
    {
        if (var->type_ != ValueT_Number)
        {
            auto pos = GetCurrentInstructionPos();
            throw RuntimeException(pos.first, pos.second,
                                   var, "'for' init", "number");
        }

        if (limit->type_ != ValueT_Number)
        {
            auto pos = GetCurrentInstructionPos();
            throw RuntimeException(pos.first, pos.second,
                                   limit, "'for' limit", "number");
        }

        if (step->type_ != ValueT_Number)
        {
            auto pos = GetCurrentInstructionPos();
            throw RuntimeException(pos.first, pos.second,
                                   step, "'for' step", "number");
        }
    }
开发者ID:Gwill,项目名称:luna,代码行数:23,代码来源:VM.cpp

示例12: session

/*!
  \~english
  Returns the authenticity token.

  \~japanese
  HTTPリクエストの正当性を検証するためのトークンを返す
 */
QByteArray TActionController::authenticityToken() const
{
    if (Tf::app()->appSettings().value(STORE_TYPE).toString().toLower() == QLatin1String("cookie")) {
        QString key = Tf::app()->appSettings().value(CSRF_PROTECTION_KEY).toString();
        QByteArray csrfId = session().value(key).toByteArray();

        if (csrfId.isEmpty()) {
            throw RuntimeException("CSRF protectionsession value is empty", __FILE__, __LINE__);
        }
        return csrfId;
    } else {
        return QCryptographicHash::hash(session().id() + Tf::app()->appSettings().value("Session.Secret").toByteArray(), QCryptographicHash::Sha1).toHex();
    }
}
开发者ID:deniskin82,项目名称:treefrog-framework,代码行数:21,代码来源:tactioncontroller.cpp

示例13: sb_stemmer_stem

bool SnowballFilter::incrementToken() {
    if (input->incrementToken()) {
        StringUtils::toUTF8(termAtt->termBuffer().get(), termAtt->termLength(), utf8Result);
        const sb_symbol* stemmed = sb_stemmer_stem(stemmer, utf8Result->result.get(), utf8Result->length);
        if (stemmed == NULL) {
            boost::throw_exception(RuntimeException(L"exception stemming word:" + termAtt->term()));
        }
        int32_t newlen = StringUtils::toUnicode(stemmed, sb_stemmer_length(stemmer), termAtt->termBuffer());
        termAtt->setTermLength(newlen);
        return true;
    } else {
        return false;
    }
}
开发者ID:304471720,项目名称:LucenePlusPlus,代码行数:14,代码来源:SnowballFilter.cpp

示例14: switch

TActionContext *TActionContext::current()
{
    TActionContext *context = 0;

    switch ( Tf::app()->multiProcessingModule() ) {
    case TWebApplication::Thread:
        context = qobject_cast<TActionThread *>(QThread::currentThread());
        if (!context) {
            throw RuntimeException("The current thread is not TActionThread", __FILE__, __LINE__);
        }
        break;

    case TWebApplication::Prefork:
        context = TActionForkProcess::currentContext();
        if (!context) {
            throw RuntimeException("The current process is not TActionProcess", __FILE__, __LINE__);
        }

    default:
        break;
    }
    return context;
}
开发者ID:pivaldi,项目名称:TreeFrog,代码行数:23,代码来源:tactioncontext.cpp

示例15: syncLock

 void MockRAMDirectory::close()
 {
     SyncLock syncLock(this);
     if (!openFiles)
     {
         openFiles = MapStringInt::newInstance();
         openFilesDeleted = HashSet<String>::newInstance();
     }
     if (noDeleteOpenFile && !openFiles.empty())
     {
         // RuntimeException instead of IOException because RAMDirectory does not throw IOException currently
         boost::throw_exception(RuntimeException(L"MockRAMDirectory: cannot close: there are still open files"));
     }
 }
开发者ID:alesha1488,项目名称:LucenePlusPlus,代码行数:14,代码来源:MockRAMDirectory.cpp


注:本文中的RuntimeException函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。