本文整理汇总了C++中RUNTIME_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ RUNTIME_ERROR函数的具体用法?C++ RUNTIME_ERROR怎么用?C++ RUNTIME_ERROR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RUNTIME_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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" );
}
}
}
示例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();
}
示例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");
}
}
示例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);
}
示例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 ");
}
}
示例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");
}
}
示例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);
}
示例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);
}
示例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.");
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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");
}
}
}
示例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;
}
示例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;
}