• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RUNTIME_ERROR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GLES2_ERROR_CHECK_UNHANDLED

void Program::link()
{
    GLES2_ERROR_CHECK_UNHANDLED();
    glLinkProgram( this->id );
    GLES2_ERROR_CHECK("glLinkProgram");

    int isLinked;
    glGetProgramiv( this->id, GL_LINK_STATUS, &isLinked );
    if( !isLinked )
    {
        GLint infoLen = 0;
        glGetProgramiv( this->id, GL_INFO_LOG_LENGTH, &infoLen );

        if( infoLen > 1 )
        {
            std::unique_ptr< GLchar[] > infoLog( new GLchar[infoLen] );
            glGetProgramInfoLog( this->id, infoLen, NULL, infoLog.get() );
            GLES2_ERROR_CHECK("glGetProgramInfoLog");
            std::string log( infoLog.get(), infoLen-1 );
            glDeleteProgram( this->id );
            throw RUNTIME_ERROR
            (
                "Error linking shader program:\n"
                "----------------\n"
                +log+"\n"
                "----------------\n"
            );
        }
        else
        {
            glDeleteProgram( this->id );
            throw RUNTIME_ERROR( "Error linking shader program! (no log generated)\n" );
        }
    }
}
开发者ID:zwostein,项目名称:glesPond,代码行数:35,代码来源:Program.cpp


示例2: RUNTIME_ERROR

void PEX::Time::serialize(NetData& netData_) {
	if (version != VERSION_NUMBER) {
		logger.fatal("Unexpected %d", version);
		RUNTIME_ERROR();
	}

	netData_.clear();

	netData_.put16(version);
	netData_.put16((quint16)operation);

	switch(operation) {
	case Operation::REQUEST:
		value.request.serialize(netData_);
		break;
	case Operation::RESPONSE:
		value.response.serialize(netData_);
		break;
	default:
		logger.fatal("Unexpected %d", (quint16)operation);
		RUNTIME_ERROR();
		break;
	}

	netData_.rewind();
}
开发者ID:yokwe,项目名称:mesa-emulator,代码行数:26,代码来源:Time.cpp


示例3: RUNTIME_ERROR

void AudioFileSndfile::write(const void* buffer, unsigned frames)
{
    if (!_handle || (_mode != ModeWrite && _mode != ModeReadWrite)) {
        RUNTIME_ERROR("Attempt to write file not opened for writing.");
    }

    flushChunks();
    sf_count_t count;

    switch (_info.sampleType) {
    case Sound::Type::Float32:
    case Sound::Type::Int24E:
        count = sf_writef_float(_handle.get(), static_cast<const Sound::Float32*>(buffer), frames);
        break;
    case Sound::Type::Float64:
        count = sf_writef_double(_handle.get(), static_cast<const Sound::Float64*>(buffer), frames);
        break;
    case Sound::Type::Int8:
        count = sf_write_raw(_handle.get(), buffer, frames * _info.channels);
        break;
    case Sound::Type::Int16:
        count = sf_writef_short(_handle.get(), static_cast<const Sound::Int16*>(buffer), frames);
        break;
    case Sound::Type::Int32:
        count = sf_writef_int(_handle.get(), static_cast<const Sound::Int32*>(buffer), frames);
        break;
    case Sound::Type::Int64:
    case Sound::Type::Precise:
    case Sound::Type::Count:
        RUNTIME_ERROR("Writing for this sample format is not supported");
    }
}
开发者ID:aasfalcon,项目名称:wexplorer,代码行数:32,代码来源:audiofilesndfile.cpp


示例4: name

void CActionRequest::GetServerNameAndIP(const CSmallString& addr)
{
    addrinfo       *p_addrinfo;
    int            nerr;
    // get hostname and IP
    if( (nerr = getaddrinfo(addr,NULL,NULL,&p_addrinfo)) != 0 ) {
        CSmallString error;
        error << "unable to decode server name (" <<  gai_strerror(nerr) << ")";
        RUNTIME_ERROR(error);
    }

    // get server name
    char s_name[MAX_NET_NAME];
    memset(s_name,0,MAX_NET_NAME);

    if( (nerr = getnameinfo(p_addrinfo->ai_addr,p_addrinfo->ai_addrlen,s_name,MAX_NET_NAME-1,NULL,0,0)) != 0 ) {
        CSmallString error;
        error << "unable to get server name (" <<  gai_strerror(nerr) << ")";
        freeaddrinfo(p_addrinfo);
        RUNTIME_ERROR(error);
    }
    Name = s_name;

    // get server IP
    if( (nerr = getnameinfo(p_addrinfo->ai_addr,p_addrinfo->ai_addrlen,s_name,MAX_NET_NAME-1,NULL,0,NI_NUMERICHOST)) != 0 ) {
        CSmallString error;
        error << "unable to get server IP (" <<  gai_strerror(nerr) << ")";
        freeaddrinfo(p_addrinfo);
        RUNTIME_ERROR(error);
    }
    IP = s_name;

    freeaddrinfo(p_addrinfo);
}
开发者ID:kulhanek,项目名称:netlib,代码行数:34,代码来源:ActionRequest.cpp


示例5: dataspace

void HDF5IO::saveMatrix(const std::string& GroupName, const std::string& Name,
    const ComplexMatrixType& M)
{
  try{
    H5::CompType ComplexDataType = this->openCompType("complex");
    hsize_t Dims[2] = {hsize_t(M.rows()),hsize_t(M.cols())};
    H5::DataSpace dataspace(2,Dims);
    H5::Group FG = getGroup( GroupName );
    try{
      H5::Exception::dontPrint();
      H5::DataSet dset = FG.openDataSet(Name.c_str());
      // dset.extend( Dims );not working
      dset.write(M.data(), ComplexDataType);
    } catch ( const H5::GroupIException not_found_error ){
      H5::DataSet dset = FG.createDataSet(Name.c_str(), ComplexDataType, dataspace);
      dset.write(M.data(), ComplexDataType);
    } catch ( const H5::DataSetIException error ){
      error.printError();
      RUNTIME_ERROR("HDF5IO::saveComplexMatrix at ");
    }
    FG.close();
  } catch( const H5::Exception error ){
    error.printError();
    RUNTIME_ERROR("HDF5IO::saveComplexMatrix at ");
  }
}
开发者ID:chengyanlai,项目名称:ExactDiagonalization,代码行数:26,代码来源:hdf5io.cpp


示例6: INVALID_ARGUMENT

void CClient::ExecuteCommand(CClientCommand* p_command,bool async)
{
    if( p_command == NULL ){
        INVALID_ARGUMENT("p_command is NULL");
    }

    bool is_in_list;

    CommandListMutex.Lock();
        is_in_list = Commands.IsInList(p_command);
    CommandListMutex.Unlock();

    if( is_in_list == true ) {
        LOGIC_ERROR("command is already in command queue");
    }

    if( p_command->Client != this ) {
        LOGIC_ERROR("wrong side");
    }

    // add AUTH element -----------------------------
    CXMLElement* p_cele = p_command->GetCommandElementByPath("AUTH",true);
    p_cele->SetAttribute("password",ActionRequest.GetPassword());
    p_cele->SetAttribute("protocol",ActionRequest.GetProtocolName());

    // now start thread -----------------------------
    CommandListMutex.Lock();
        try {
            NumOfExecutedCommands++;
            Commands.InsertToEnd(p_command);
        } catch(...) {
            CommandListMutex.Unlock();
            throw;
        }
    CommandListMutex.Unlock();

    // start command processing
    if( p_command->StartThread() == false ) {
        CommandListMutex.Lock();
            Commands.Remove(p_command);
        CommandListMutex.Unlock();
        RUNTIME_ERROR("unable to start command thread");
    }

    if( async == true ) return;  // return immediatelly

    // wait until command thread is terminated
    p_command->WaitForThread();

    // ExecutedCommand is now NULL !!!
    if( p_command->GetStatus() != ECS_FINISHED ) {
        RUNTIME_ERROR("command was not completed");
    }
    if( p_command->GetMainReturnValue() == false ) {
        RUNTIME_ERROR("server did not process command successfully");
    }
}
开发者ID:kulhanek,项目名称:netlib,代码行数:57,代码来源:Client.cpp


示例7: switch

 uint32_t& Parameter::operator[](int index)
 {
     switch(_type) {
         case ptUINT32_VECTOR_3:
         case ptUINT32_VECTOR_5:
             if((index<0) || (index>=(int)_v32v.size())) throw RUNTIME_ERROR("Bad index.");
             break;
         default:
             throw RUNTIME_ERROR("Invalid type");
     }
     return _v32v.at(index);
 }
开发者ID:nagyistoce,项目名称:thetagram,代码行数:12,代码来源:ptpip_packets.cpp


示例8: is_gstate

static void is_gstate(struct global_state *gstate)
{
  /* Could use lots more checks on gstate... */
  TYPEIS(gstate, type_vector);
  if (vector_len(gstate) != 8)
    RUNTIME_ERROR(error_bad_type);
}
开发者ID:saurabhd14,项目名称:tinyos-1.x,代码行数:7,代码来源:support.c


示例9: RUNTIME_ERROR

 void GUID::assign(const char* v)
 {
     // "8423BB09-13CB-4CEF-8D24-D38A647FBBD3"
     if(sscanf(v, "%08x-%04x-%04x-%04x-%12llx", &v1, &v2, &v3, &v4, &v5)!=5) {
         throw RUNTIME_ERROR("Bad string for GUID.");
     }
 }
开发者ID:nagyistoce,项目名称:thetagram,代码行数:7,代码来源:ptpip_packets.cpp


示例10: file

void CActionRequest::ReadServerKey(const CSmallString& name)
{
    CPrmFile ctrl_file;

    // process control file ----------------------------------
    if( ctrl_file.Read(name) == false ) {
        CSmallString error;
        error << "unable to open server key file (" << strerror(errno) << ")";
        RUNTIME_ERROR(error);
    }

    if( ctrl_file.OpenSection("server-key") == false ) {
        CSmallString error;
        error << "unable to open [server-key] section";
        LOGIC_ERROR(error);
    }

    // all items are optional
    ctrl_file.GetStringByKey("name",Name);
    GetServerNameAndIP(Name);

    ctrl_file.GetIntegerByKey("port",Port);
    ctrl_file.GetStringByKey("password",Password);

    if( ctrl_file.CountULines() > 0 ) {
        CSmallString error;
        error << "unprocessed items in server key file";
        LOGIC_ERROR(error);
    }
}
开发者ID:kulhanek,项目名称:netlib,代码行数:30,代码来源:ActionRequest.cpp


示例11: RUNTIME_ERROR

quint8 NetData::get8(quint32 at) {
	if (limit < (at + SIZE_8)) {
		logger.fatal("%s  limit = %d  at = %d  SIZE = %d", __FUNCTION__, limit, at, SIZE_8);
		RUNTIME_ERROR();
	}
	return get8_(data + at);
}
开发者ID:yokwe,项目名称:mesa-emulator,代码行数:7,代码来源:NetData.cpp


示例12: impl_tasklet_setup

static int
impl_tasklet_setup(PyTaskletObject *task, PyObject *args, PyObject *kwds)
{
    PyThreadState *ts = PyThreadState_GET();
    PyFrameObject *frame;
    PyObject *func;

    assert(PyTasklet_Check(task));
    if (ts->st.main == NULL) return PyTasklet_Setup_M(task, args, kwds);

    func = task->tempval;
    if (func == NULL)
        RUNTIME_ERROR("the tasklet was not bound to a function", -1);
    if ((frame = (PyFrameObject *)
                 slp_cframe_newfunc(func, args, kwds, 0)) == NULL) {
        return -1;
    }
    if (bind_tasklet_to_frame(task, frame)) {
        Py_DECREF(frame);
        return -1;
    }
    TASKLET_SETVAL(task, Py_None);
    Py_INCREF(task);
    slp_current_insert(task);
    return 0;
}
开发者ID:newerthcom,项目名称:savagerebirth,代码行数:26,代码来源:taskletobject.c


示例13: func_name

const SpObject *SpVM::eval(const SpExpr *expr, SpEnv *env) {
   // check whether this expression is an atom or a function call
   if (expr->head()->type() == TOKEN_FUNCTION_CALL) {
      // this is a function call expression
      std::string func_name(expr->head()->value());

      // we find the function associated with this name in the given environment
      const SpObject *obj = resolve(func_name, env);
      if (obj == NULL || obj->type() != T_FUNCTION) RUNTIME_ERROR_F("'%s' is not a function", func_name.c_str());

      // now call the function
      return call_function(func_name, 
         static_cast<const SpFunction *>(obj->self()), expr, env);
   } else {
      // evaluate this atom
      std::string val = expr->head()->value();
      switch (expr->head()->type()) {
         case TOKEN_NAME: {
            const SpObject *obj = resolve(val, env); 
            if (obj == NULL)
               RUNTIME_ERROR_F("Undeclared variable '%s'", val.c_str());
            return obj->shallow_copy();
         }
         case TOKEN_NUMERIC:
            return new SpIntValue(atoi(val.c_str()));
         case TOKEN_CLOSURE:
            // the closure expression is stored in the first argument of the
            // object expression
            return new SpRefObject(new SpClosure(ArgList(), NULL, *expr->cbegin()));
         default:
            RUNTIME_ERROR("Unsupported operation");
      }
   }
}
开发者ID:evilncrazy,项目名称:spooner,代码行数:34,代码来源:vm.cpp


示例14: GLES2_ERROR_CHECK_UNHANDLED

FrameBuffer2D::FrameBuffer2D( unsigned int width, unsigned int height, GLint internalFormat )
{
	GLES2_ERROR_CHECK_UNHANDLED();

	this->texture = new Texture2D( width, height, internalFormat, GL_NEAREST, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE );

	glGenFramebuffers( 1, &this->id );
	GLES2_ERROR_CHECK("glGenFramebuffers");

	glBindFramebuffer( GL_FRAMEBUFFER, this->id );
	GLES2_ERROR_CHECK("glBindFramebuffer");

	glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, this->texture->getID(), 0 );
	GLES2_ERROR_CHECK("glFramebufferTexture2D");
	if( glCheckFramebufferStatus( GL_FRAMEBUFFER ) != GL_FRAMEBUFFER_COMPLETE )
		throw RUNTIME_ERROR( "Framebuffer is not complete!" );

	GLfloat oldClearColor[4];
	glGetFloatv( GL_COLOR_CLEAR_VALUE, oldClearColor );
	glClearColor( 0.5f, 0.5f, 0.5f, 0.5f );
	glClear( GL_COLOR_BUFFER_BIT );
	glClearColor( oldClearColor[0], oldClearColor[1], oldClearColor[2], oldClearColor[3] );
	GLES2_ERROR_CHECK("glClearColor");

	glBindFramebuffer( GL_FRAMEBUFFER, 0 );
	GLES2_ERROR_CHECK("glBindFramebuffer");

	this->width = width;
	this->height = height;
}
开发者ID:zwostein,项目名称:glesPond,代码行数:30,代码来源:FrameBuffer2D.cpp


示例15: tasklet_reduce

static PyObject *
tasklet_reduce(PyTaskletObject * t)
{
    PyObject *tup = NULL, *lis = NULL;
    PyFrameObject *f;
    PyThreadState *ts = PyThreadState_GET();

    if (t == ts->st.current)
        RUNTIME_ERROR("You cannot __reduce__ the tasklet which is"
                      " current.", NULL);
    lis = PyList_New(0);
    if (lis == NULL) goto err_exit;
    f = t->f.frame;
    while (f != NULL) {
        if (PyList_Append(lis, (PyObject *) f)) goto err_exit;
        f = f->f_back;
    }
    if (PyList_Reverse(lis)) goto err_exit;
    assert(t->cstate != NULL);
    tup = Py_BuildValue("(O()(" TASKLET_TUPLEFMT "))",
                        t->ob_type,
                        t->flags,
                        t->tempval,
                        t->cstate->nesting_level,
                        lis
                        );
err_exit:
    Py_XDECREF(lis);
    return tup;
}
开发者ID:newerthcom,项目名称:savagerebirth,代码行数:30,代码来源:taskletobject.c


示例16: NxVec3

//
//	EPhysXPhysEngine::BuildConvexMesh
//
NxConvexMesh *ESciVis::BuildConvexMesh( const IPxTriMesh input_mesh )
{
	//IPxTriMesh	mesh	=	input_mesh->Clone();
	//mesh->SetFormat( GE_MESH_POSITION );
	//mesh->MergeVertices();				//This command causes convex cook crash

	NxConvexMeshDesc	convex_mesh_desc;

	NxArray<NxVec3>	verts;
	
	for (uint i=0; i<input_mesh->GetVertexNum(); i++) {
		EVertex v;
		v = input_mesh->GetVertex(i);
		verts.push_back( NxVec3(v.position.x, v.position.y, v.position.z) );
	}

    convex_mesh_desc.numVertices		= input_mesh->GetVertexNum();
    convex_mesh_desc.pointStrideBytes	= sizeof(NxVec3);
    convex_mesh_desc.points				= &verts[0];
	convex_mesh_desc.flags				= NX_CF_COMPUTE_CONVEX;
	
	ASSERT( convex_mesh_desc.isValid() );

	MemoryWriteBuffer	buf;	
	bool r = nx_cook->NxCookConvexMesh(convex_mesh_desc, buf);
	
	if (!r) {
		RUNTIME_ERROR("mesh contains to many vertices");
	}

	return nx->createConvexMesh(MemoryReadBuffer(buf.data));
}
开发者ID:Jacobi20,项目名称:nano-vis,代码行数:35,代码来源:sci_phys.cpp


示例17: DEFINE_TO_PTP_CASE

    void Variant::to_ptp(string& ret)
    {
#define DEFINE_TO_PTP_CASE(_T_) case _T_::SYM: { u._##_T_->to_ptp(ret); } break
        switch(_sym) {
            DEFINE_TO_PTP_CASE(INT8);
            DEFINE_TO_PTP_CASE(INT16);
            DEFINE_TO_PTP_CASE(INT32);
            DEFINE_TO_PTP_CASE(INT64);
            DEFINE_TO_PTP_CASE(INT128);
            DEFINE_TO_PTP_CASE(UINT16);
            DEFINE_TO_PTP_CASE(UINT32);
            DEFINE_TO_PTP_CASE(UINT64);
            DEFINE_TO_PTP_CASE(UINT128);
            DEFINE_TO_PTP_CASE(AINT16);
            DEFINE_TO_PTP_CASE(AINT32);
            DEFINE_TO_PTP_CASE(AINT64);
            DEFINE_TO_PTP_CASE(AINT128);
            DEFINE_TO_PTP_CASE(AUINT16);
            DEFINE_TO_PTP_CASE(AUINT32);
            DEFINE_TO_PTP_CASE(AUINT64);
            DEFINE_TO_PTP_CASE(AUINT128);
            case DeviceInfo_t::SYM:
            case ObjectInfo_t::SYM:
            case StorageInfo_t::SYM:
            case Binary_t::SYM:
                throw STANDARD_ERROR("Not supported.");
                break;
            default:
                if(u._void!=NULL) throw RUNTIME_ERROR("Invalid _sym.");
                break;
        }
#undef DEFINE_TO_PTP_CASE
    }
开发者ID:nagyistoce,项目名称:thetagram,代码行数:33,代码来源:variant.cpp


示例18: IsLedOutOfBounds

static bool IsLedOutOfBounds(int ledNumber) {
    if ((ledNumber < FIRST_LED) || (ledNumber > LAST_LED)) {
        RUNTIME_ERROR("LED Driver: out-of-bounds LED", ledNumber);
        return true;
    }
    return false;
}
开发者ID:xueliu,项目名称:LedDriver,代码行数:7,代码来源:LedDriver.c


示例19: RUNTIME_ERROR

void CMTDHistory::SetCoordinate(unsigned int id,
                                const CSmallString& name,
                                const CSmallString& type,
                                double min_value,double max_value,unsigned int nbins)
{
    if( Sizes == NULL ){
        RUNTIME_ERROR("Sizes is NULL");
    }
    if( id < 0 || id >= NCoords ){
        INVALID_ARGUMENT("id out-of-range");
    }

    if( nbins <= 0 ){
        INVALID_ARGUMENT("nbins <= 0");
    }
    if( max_value < min_value ){
        INVALID_ARGUMENT("max_value < min_value");
    }

    if(Buffers.NumOfMembers() > 0) {
        // it was already finalized - destroy data
        Deallocate();
    }

    Sizes[id].Type = type;
    Sizes[id].Name = name;

    Sizes[id].MinValue = min_value;
    Sizes[id].MaxValue = max_value;

    Sizes[id].NBins = nbins;
    Sizes[id].BinWidth = (Sizes[id].MaxValue - Sizes[id].MinValue)/Sizes[id].NBins;
    Sizes[id].Width = Sizes[id].MaxValue - Sizes[id].MinValue;
}
开发者ID:kulhanek,项目名称:pmflib,代码行数:34,代码来源:MTDHistory.cpp


示例20: openCompType

void HDF5IO::saveStdVector(const std::string& GroupName, const std::string& Name,
    const std::vector<std::complex<double> >& V)
{
  try{
    H5::CompType ComplexDataType = openCompType("complex");
    hsize_t Dim[1] = {hsize_t(V.size())};
    H5::DataSpace dataspace(1,Dim);
    H5::Group FG = getGroup( GroupName.c_str() );
    try{
      H5::Exception::dontPrint();
      H5::DataSet dataset = FG.openDataSet(Name.c_str());
      dataset.write(V.data(), ComplexDataType, dataspace);
    } catch( const H5::GroupIException not_found_error ){
      H5::DataSet dataset = FG.createDataSet(Name.c_str(), ComplexDataType,
        dataspace);
      dataset.write(V.data(), ComplexDataType);
    } catch( const H5::FileIException error){
      error.printError();
    } catch( const H5::DataSetIException error){
      error.printError();
    }
    FG.close();
  } catch( const H5::Exception err ){
    err.printError();
    RUNTIME_ERROR("HDF5IO::saveComplexStdVector. ");
  }
}
开发者ID:chengyanlai,项目名称:ExactDiagonalization,代码行数:27,代码来源:hdf5io.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ RUN_ALL_TESTS函数代码示例发布时间:2022-05-30
下一篇:
C++ RUNTIME_CLASS函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap