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


C++ THROWERROR函数代码示例

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


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

示例1: THROWERROR

/*
 *	s e t u p C o n s t r a i n t
 */
returnValue Constraints::setupConstraint(	int _number, SubjectToStatus _status
											)
{
	/* consistency check */
	if ( ( _number < 0 ) || ( _number >= getNC( ) ) )
		return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
	
	/* Add constraint index to respective index list. */
	switch ( _status )
	{
		case ST_INACTIVE:
			if ( this->addIndex( this->getInactive( ),_number,_status ) != SUCCESSFUL_RETURN )
				return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
			break;

		case ST_LOWER:
			if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN )
				return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
			break;

		case ST_UPPER:
			if ( this->addIndex( this->getActive( ),_number,_status ) != SUCCESSFUL_RETURN )
				return THROWERROR( RET_SETUP_CONSTRAINT_FAILED );
			break;

		default:
			return THROWERROR( RET_INVALID_ARGUMENTS );
	}

	return SUCCESSFUL_RETURN;
}
开发者ID:Brazilian-Institute-of-Robotics,项目名称:control-uwv_model_pred_control,代码行数:34,代码来源:Constraints.cpp

示例2: THROWERROR

/*
 *	s e t C y c l i n g S t a t u s
 */
returnValue CyclingManager::setCyclingStatus(	int number,
												BooleanType isBound, CyclingStatus _status
												)
{
	if ( isBound == BT_TRUE )
	{
		/* Set cycling status of a bound. */
		if ( ( number >= 0 ) && ( number < nV ) )
		{
			status[number] = _status;
			return SUCCESSFUL_RETURN;
		}
		else
			return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
	}
	else
	{
		/* Set cycling status of a constraint. */
		if ( ( number >= 0 ) && ( number < nC ) )
		{
			status[nV+number] = _status;
			return SUCCESSFUL_RETURN;
		}
		else
			return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );
	}
}
开发者ID:rtkg,项目名称:acado,代码行数:30,代码来源:CyclingManager.cpp

示例3: THROWERROR

/*
 *	s e t u p B o u n d
 */
returnValue Bounds::setupBound(	int number, SubjectToStatus _status
								)
{
	/* consistency check */
	if ( ( number < 0 ) || ( number >= n ) )
		return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );

	/* Add bound index to respective index list. */
	switch ( _status )
	{
		case ST_INACTIVE:
			if ( this->addIndex( this->getFree( ),number,_status ) != SUCCESSFUL_RETURN )
				return THROWERROR( RET_SETUP_BOUND_FAILED );
			break;

		case ST_LOWER:
			if ( this->addIndex( this->getFixed( ),number,_status ) != SUCCESSFUL_RETURN )
				return THROWERROR( RET_SETUP_BOUND_FAILED );
			break;

		case ST_UPPER:
			if ( this->addIndex( this->getFixed( ),number,_status ) != SUCCESSFUL_RETURN )
				return THROWERROR( RET_SETUP_BOUND_FAILED );
			break;

		default:
			return THROWERROR( RET_INVALID_ARGUMENTS );
	}

	return SUCCESSFUL_RETURN;
}
开发者ID:dkouzoup,项目名称:BC-RTI,代码行数:34,代码来源:Bounds.cpp

示例4: THROWERROR

/*
 *  a d d I n d e x
 */
returnValue SubjectTo::addIndex(    Indexlist* const indexlist,
                                    int_t newnumber, SubjectToStatus newstatus
                                    )
{
    if ( status != 0 )
    {
        /* consistency check */
        if ( status[newnumber] == newstatus )
            return THROWERROR( RET_INDEX_ALREADY_OF_DESIRED_STATUS );

        status[newnumber] = newstatus;
    }
    else
        return THROWERROR( RET_ADDINDEX_FAILED );

    if ( indexlist != 0 )
    {
        if ( indexlist->addNumber( newnumber ) == RET_INDEXLIST_EXCEEDS_MAX_LENGTH )
            return THROWERROR( RET_ADDINDEX_FAILED );
    }
    else
        return THROWERROR( RET_INVALID_ARGUMENTS );

    return SUCCESSFUL_RETURN;
}
开发者ID:RobotXiaoFeng,项目名称:casadi,代码行数:28,代码来源:SubjectTo.cpp

示例5: TS_OpenFile

v8Function TS_OpenFile(V8ARGS){
	if(args.Length()<1){
        THROWERROR("[scriptfs] TS_OpenFile Error: Called with no arguments.");
    }
    CHECK_ARG_STR(0);

    BEGIN_OBJECT_WRAP_CODE

    v8::String::Utf8Value str(args[0]);
    const char *filename = *str;

	T5_file *file = T5_OpenFile(filename);
	if(file==NULL){
        T5_close(file);
        FILE *newfile;
        newfile = fopen(filename, "w");
        if(newfile==NULL){
            THROWERROR((((string)"[scriptfs] TS_OpenFile Error: Could not create file ")+string(filename)+((string)".")).c_str());
        }
        fclose(newfile);
        T5_file *file = T5_OpenFile(filename);
	}

    END_OBJECT_WRAP_CODE(ScriptFile, file);
}
开发者ID:carriercomm,项目名称:TurboSphere,代码行数:25,代码来源:scriptfs.cpp

示例6: readOqpDimensions

BEGIN_NAMESPACE_QPOASES


/*
 *	r e a d O q p D i m e n s i o n s
 */
returnValue readOqpDimensions(	const char* path,
								int_t& nQP, int_t& nV, int_t& nC, int_t& nEC
								)
{
	/* 1) Setup file name where dimensions are stored. */
	char filename[MAX_STRING_LENGTH];
	snprintf( filename,MAX_STRING_LENGTH,"%sdims.oqp",path );

	/* 2) Load dimensions from file. */
	int_t dims[4];
	if ( readFromFile( dims,4,filename ) != SUCCESSFUL_RETURN )
		return THROWERROR( RET_UNABLE_TO_READ_FILE );

	nQP = dims[0];
	nV  = dims[1];
	nC  = dims[2];
	nEC = dims[3];


	/* consistency check */
	if ( ( nQP <= 0 ) || ( nV <= 0 ) || ( nC < 0 ) || ( nEC < 0 ) )
		return THROWERROR( RET_FILEDATA_INCONSISTENT );

	return SUCCESSFUL_RETURN;
}
开发者ID:RobotXiaoFeng,项目名称:acado,代码行数:31,代码来源:OQPinterface.cpp

示例7: THROWERROR

/*
 *	m o v e I n a c t i v e T o A c t i v e
 */
returnValue Constraints::moveInactiveToActive(	int_t number, SubjectToStatus _status
												)
{
	/* consistency check */
	if ( ( number < 0 ) || ( number >= n ) )
		return THROWERROR( RET_INDEX_OUT_OF_BOUNDS );

	/* Move index from indexlist of inactive constraints to that of active ones. */
	if ( this->removeIndex( this->getInactive( ),number ) != SUCCESSFUL_RETURN )
		return THROWERROR( RET_MOVING_BOUND_FAILED );

	if ( this->addIndex( this->getActive( ),number,_status ) != SUCCESSFUL_RETURN )
		return THROWERROR( RET_MOVING_BOUND_FAILED );

	return SUCCESSFUL_RETURN;
}
开发者ID:robotology-dependencies,项目名称:qpOASES,代码行数:19,代码来源:Constraints.cpp

示例8: myPrintf

/*
 *	m y P r i n t f
 */
returnValue myPrintf( const char* s )
{
	#ifndef __SUPPRESSANYOUTPUT__


		if ( s == 0 )
			return RET_INVALID_ARGUMENTS;

		#ifdef __MATLAB__
			mexPrintf( s );
		#else
			#ifdef __SCILAB__
				sciprint( s );
			#else
				FILE* outputfile = getGlobalMessageHandler( )->getOutputFile( );
				if ( outputfile == 0 )
					return THROWERROR( RET_NO_GLOBAL_MESSAGE_OUTPUTFILE );
				fprintf( outputfile, "%s", s );
			#endif /* __SCILAB__ */
		#endif /* __MATLAB__ */

	#endif /* __SUPPRESSANYOUTPUT__ */

	return SUCCESSFUL_RETURN;
}
开发者ID:robotology-dependencies,项目名称:qpOASES,代码行数:28,代码来源:Utils.cpp

示例9: getNV

/*
 *	s e t u p N e w A u x i l i a r y Q P
 */
returnValue SQProblem::setupNewAuxiliaryQP(	const real_t* const H_new, const real_t* const A_new,
											const real_t *lb_new, const real_t *ub_new, const real_t *lbA_new, const real_t *ubA_new
											)
{
	int_t nV = getNV( );
	int_t nC = getNC( );

	DenseMatrix *dA = 0;
	SymDenseMat *sH = 0;

	if ( A_new != 0 )
	{
		dA = new DenseMatrix(nC, nV, nV, (real_t*) A_new);
	}
	else
	{
		if ( nC > 0 )
			return THROWERROR( RET_INVALID_ARGUMENTS );
	}

	if ( H_new != 0 )
		sH = new SymDenseMat(nV, nV, nV, (real_t*) H_new);

	returnValue returnvalue = setupNewAuxiliaryQP( sH,dA, lb_new,ub_new,lbA_new,ubA_new );

	if ( H_new != 0 )
		freeHessian = BT_TRUE;
	freeConstraintMatrix = BT_TRUE;

	return returnvalue;
}
开发者ID:robotology-dependencies,项目名称:qpOASES,代码行数:34,代码来源:SQProblem.cpp

示例10: THROWERROR

/*
 *	i n i t
 */
returnValue Flipper::init(	int _nV,
							int _nC
							)
{
	if ( ( _nV < 0 ) || ( _nC < 0 ) )
		return THROWERROR( RET_INVALID_ARGUMENTS );

	clear( );

	nV = _nV;
	nC = _nC;

	/*if ( nV > 0 )
	{
		R = new real_t[nV*nV];
	
		if ( nC > 0 )
		{
			Q = new real_t[nV*nV];
			T = new real_t[getDimT()];
		}
	}*/

	return SUCCESSFUL_RETURN;
}
开发者ID:BrechtBa,项目名称:casadi,代码行数:28,代码来源:Flipper.cpp

示例11: getStatus

/*
 * h o t s t a r t
 */
returnValue SQProblem::hotstart(	SymmetricMatrix *H_new, const real_t* const g_new, Matrix *A_new,
									const real_t* const lb_new, const real_t* const ub_new,
									const real_t* const lbA_new, const real_t* const ubA_new,
									int_t& nWSR, real_t* const cputime,
									const Bounds* const guessedBounds, const Constraints* const guessedConstraints
									)
{
	if ( ( getStatus( ) == QPS_NOTINITIALISED )       ||
		 ( getStatus( ) == QPS_PREPARINGAUXILIARYQP ) ||
		 ( getStatus( ) == QPS_PERFORMINGHOMOTOPY )   )
	{
		return THROWERROR( RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED );
	}


	real_t starttime = 0.0;
	real_t auxTime = 0.0;

    if ( cputime != 0 )
        starttime = getCPUtime( );


	/* I) UPDATE QP MATRICES AND VECTORS */
	if ( setupNewAuxiliaryQP( H_new,A_new,lb_new,ub_new,lbA_new,ubA_new ) != SUCCESSFUL_RETURN )
		return THROWERROR( RET_SETUP_AUXILIARYQP_FAILED );


	/* II) PERFORM USUAL HOMOTOPY */

	/* Allow only remaining CPU time for usual hotstart. */
	if ( cputime != 0 )
	{
		auxTime = getCPUtime( ) - starttime;
		*cputime -= auxTime;
	}

	returnValue returnvalue = QProblem::hotstart(	g_new,lb_new,ub_new,lbA_new,ubA_new,
													nWSR,cputime,
													guessedBounds,guessedConstraints
													);
	
	if ( cputime != 0 )
		*cputime += auxTime;

	return returnvalue;
}
开发者ID:robotology-dependencies,项目名称:qpOASES,代码行数:49,代码来源:SQProblem.cpp

示例12: THROWERROR

/*
 *	g e t N u m b e r A r r a y
 */
returnValue Indexlist::getNumberArray( int** const numberarray ) const
{
	if (numberarray == 0)
		return THROWERROR( RET_INVALID_ARGUMENTS );

	*numberarray = number;

	return SUCCESSFUL_RETURN;
}
开发者ID:BrechtBa,项目名称:casadi,代码行数:12,代码来源:Indexlist.cpp

示例13: TS_RemoveFile

v8Function TS_RemoveFile(V8ARGS){
	if(args.Length()<1){
        THROWERROR("[scriptfs] TS_RemoveFile Error: Called with no arguments.");
    }
    CHECK_ARG_STR(0);
	v8::String::Utf8Value str(args[0]);
    string filename = (*str);
	if(remove((string(GetDirs()->save)+filename).c_str()) != 0 ){
		THROWERROR_REFERENCE((string("TS_RemoveFile Error: No such file as ")+(string(GetDirs()->save)+filename)).c_str());
	}
	return v8::Undefined();
}
开发者ID:carriercomm,项目名称:TurboSphere,代码行数:12,代码来源:scriptfs.cpp

示例14: getStatus

/*
 *	h o t s t a r t
 */
returnValue SQProblem::hotstart(	const real_t* const H_new, const real_t* const g_new, const real_t* const A_new,
									const real_t* const lb_new, const real_t* const ub_new,
									const real_t* const lbA_new, const real_t* const ubA_new,
									int& nWSR, real_t* const cputime )
{
	if ( ( getStatus( ) == QPS_NOTINITIALISED )       ||
		 ( getStatus( ) == QPS_PREPARINGAUXILIARYQP ) ||
		 ( getStatus( ) == QPS_PERFORMINGHOMOTOPY )   )
	{
		return THROWERROR( RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED );
	}

	/* start runtime measurement */
	real_t starttime = 0.0;
    if ( cputime != 0 )
        starttime = getCPUtime( );


	/* I) UPDATE QP MATRICES AND VECTORS */
	if ( setupAuxiliaryQP( H_new,A_new,lb_new,ub_new,lbA_new,ubA_new ) != SUCCESSFUL_RETURN )
		return THROWERROR( RET_SETUP_AUXILIARYQP_FAILED );


	/* II) PERFORM USUAL HOMOTOPY */

	/* Allow only remaining CPU time for usual hotstart. */
	if ( cputime != 0 )
		*cputime -= getCPUtime( ) - starttime;

	returnValue returnvalue = QProblem::hotstart( g_new,lb_new,ub_new,lbA_new,ubA_new, nWSR,cputime );


	/* stop runtime measurement */
	if ( cputime != 0 )
		*cputime = getCPUtime( ) - starttime;

	return returnvalue;
}
开发者ID:bmagyar,项目名称:OpenSoT,代码行数:41,代码来源:SQProblem.cpp

示例15: myPrintf

/*
 *	m y P r i n t f
 */
returnValue myPrintf( const char* s )
{
	#ifdef __MATLAB__
	mexPrintf( s );
	#else
	FILE* outputfile = getGlobalMessageHandler( )->getOutputFile( );
	if ( outputfile == 0 )
		return THROWERROR( RET_NO_GLOBAL_MESSAGE_OUTPUTFILE );

	fprintf( outputfile, "%s", s );
	#endif

	return SUCCESSFUL_RETURN;
}
开发者ID:kaihumuc,项目名称:toro_dhri_tum,代码行数:17,代码来源:Utils.cpp


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