本文整理汇总了C++中Guard::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ Guard::reset方法的具体用法?C++ Guard::reset怎么用?C++ Guard::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guard
的用法示例。
在下文中一共展示了Guard::reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_args
bool handle_args (EnvT* e)
{
// handle Log options passing via Keywords
// note: undocumented keywords [xyz]type still exist and
// have priority on [xyz]log !
static int xTypeIx = e->KeywordIx( "XTYPE" );
static int yTypeIx = e->KeywordIx( "YTYPE" );
static int zTypeIx = e->KeywordIx( "ZTYPE" );
static int xLogIx = e->KeywordIx( "XLOG" );
static int yLogIx = e->KeywordIx( "YLOG" );
static int zLogIx = e->KeywordIx( "ZLOG" );
static int xTickunitsIx = e->KeywordIx( "XTICKUNITS" );
static int yTickunitsIx = e->KeywordIx( "YTICKUNITS" );
static int zTickunitsIx = e->KeywordIx( "ZTICKUNITS" );
if ( e->KeywordPresent( xTypeIx ) ) xLog = e->KeywordSet( xTypeIx ); else xLog = e->KeywordSet( xLogIx );
if ( e->KeywordPresent( yTypeIx ) ) yLog = e->KeywordSet( yTypeIx ); else yLog = e->KeywordSet( yLogIx );
if ( e->KeywordPresent( zTypeIx ) ) zLog = e->KeywordSet( zTypeIx ); else zLog = e->KeywordSet( zLogIx );
if ( xLog && e->KeywordSet( xTickunitsIx ) ) {
Message( "PLOT: LOG setting ignored for Date/Time TICKUNITS." );
xLog = FALSE;
}
if ( yLog && e->KeywordSet( yTickunitsIx ) ) {
Message( "PLOT: LOG setting ignored for Date/Time TICKUNITS." );
yLog = FALSE;
}
if ( zLog && e->KeywordSet( zTickunitsIx ) ) {
Message( "PLOT: LOG setting ignored for Date/Time TICKUNITS." );
zLog = FALSE;
}
if ( nParam ( )==1 )
{
if ( (e->GetNumericArrayParDefined ( 0 ))->Rank ( )!=2 )
e->Throw ( "Array must have 2 dimensions: "
+e->GetParString ( 0 ) );
BaseGDL* p0=e->GetNumericArrayParDefined ( 0 )->Transpose ( NULL );
zVal=static_cast<DDoubleGDL*>
( p0->Convert2 ( GDL_DOUBLE, BaseGDL::COPY ) );
p0_guard.reset ( p0 ); // delete upon exit
if ( zVal->Rank ( )!=2 )
e->Throw ( "Array must have 2 dimensions: "
+e->GetParString ( 0 ) );
xEl=zVal->Dim ( 1 );
yEl=zVal->Dim ( 0 );
xVal=new DDoubleGDL ( dimension ( xEl ), BaseGDL::INDGEN );
xval_guard.reset ( xVal ); // delete upon exit
if (xLog) xVal->Inc();
yVal=new DDoubleGDL ( dimension ( yEl ), BaseGDL::INDGEN );
yval_guard.reset ( yVal ); // delete upon exit
if (yLog) yVal->Inc();
}
else if ( nParam ( )==2||nParam ( )>3 )
{
e->Throw ( "Incorrect number of arguments." );
}
else
{
BaseGDL* p0=e->GetNumericArrayParDefined ( 0 )->Transpose ( NULL );
zVal=static_cast<DDoubleGDL*>
( p0->Convert2 ( GDL_DOUBLE, BaseGDL::COPY ) );
p0_guard.reset ( p0 ); // delete upon exit
if ( zVal->Rank ( )!=2 )
e->Throw ( "Array must have 2 dimensions: "
+e->GetParString ( 0 ) );
xVal=e->GetParAs< DDoubleGDL>( 1 );
yVal=e->GetParAs< DDoubleGDL>( 2 );
if ( xVal->Rank ( )!=1 )
e->Throw ( "Unable to handle non-vectorial array "+e->GetParString ( 1 )+" (FIXME!)" );
if ( yVal->Rank ( )!=1 )
e->Throw ( "Unable to handle non-vectorial array "+e->GetParString ( 1 )+" (FIXME!)" );
if ( xVal->Rank ( )==1 )
{
xEl=xVal->Dim ( 0 );
if ( xEl!=zVal->Dim ( 1 ) )
e->Throw ( "X, Y, or Z array dimensions are incompatible." );
}
if ( yVal->Rank ( )==1 )
{
yEl=yVal->Dim ( 0 );
if ( yEl!=zVal->Dim ( 0 ) )
e->Throw ( "X, Y, or Z array dimensions are incompatible." );
}
}
GetMinMaxVal ( xVal, &xStart, &xEnd );
//.........这里部分代码省略.........
示例2: ExecuteLine
//.........这里部分代码省略.........
// LineContinuation LC
// conactenate the strings and insert \n
// the resulting string can be fed to the lexer
// print if expr parse ok
int lCNum = 0;
for(;;)
{
lexer.Reset( new GDLLexer(executeLine, "", callStack.back()->CompileOpt()));
try {
// works, but ugly -> depends from parser detecting an error
// (which it always will due to missing END_U token in case of LC)
//lexer->Parser().SetCompileOpt(callStack.back()->CompileOpt());
lexer.Get()->Parser().interactive();
break; // no error -> everything ok
}
catch( GDLException& e)
{
int lCNew = lexer.Get()->LineContinuation();
if( lCNew == lCNum)
// throw; // no LC -> real error
{
#ifdef AUTO_PRINT_EXPR
#ifndef GDL_DEBUG
try {
// executeLine.clear(); // clear EOF (for executeLine)
// lexer.reset( new GDLLexer(executeLine, "", callStack.back()->CompileOpt()));
// lexer->Parser().expr();
executeLine.clear(); // clear EOF (for executeLine)
executeLine.str( "print," + executeLine.str()); // append new line
lexer.reset( new GDLLexer(executeLine, "", callStack.back()->CompileOpt()));
lexer->Parser().interactive();
break; // no error -> everything ok
}
catch( GDLException& e2)
#endif
#endif
{
throw e;
}
}
lCNum = lCNew; // save number to see if next line also has LC
}
// line continuation -> get next line
if( in != NULL && !in->good())
throw GDLException( "End of file encountered during line continuation.");
string cLine = (in != NULL) ? ::GetLine(in) : GetLine();
executeLine.clear(); // clear EOF (for executeLine)
executeLine.str( executeLine.str() + cLine + "\n"); // append new line
}
// lexer->Parser().interactive();
theAST = lexer.Get()->Parser().getAST();
}
catch( GDLException& e)
示例3: handle_args
bool handle_args (EnvT* e)
{
xLog=e->KeywordSet ( "XLOG" );
yLog=e->KeywordSet ( "YLOG" );
zLog=e->KeywordSet ( "ZLOG" );
if ( nParam ( )==1 )
{
if ( (e->GetNumericArrayParDefined ( 0 ))->Rank ( )!=2 )
e->Throw ( "Array must have 2 dimensions: "
+e->GetParString ( 0 ) );
BaseGDL* p0=e->GetNumericArrayParDefined ( 0 )->Transpose ( NULL );
zVal=static_cast<DDoubleGDL*>
( p0->Convert2 ( GDL_DOUBLE, BaseGDL::COPY ) );
p0_guard.reset ( p0 ); // delete upon exit
if ( zVal->Rank ( )!=2 )
e->Throw ( "Array must have 2 dimensions: "
+e->GetParString ( 0 ) );
xEl=zVal->Dim ( 1 );
yEl=zVal->Dim ( 0 );
xVal=new DDoubleGDL ( dimension ( xEl ), BaseGDL::INDGEN );
xval_guard.reset ( xVal ); // delete upon exit
if (xLog) xVal->Inc();
yVal=new DDoubleGDL ( dimension ( yEl ), BaseGDL::INDGEN );
yval_guard.reset ( yVal ); // delete upon exit
if (yLog) yVal->Inc();
}
else if ( nParam ( )==2||nParam ( )>3 )
{
e->Throw ( "Incorrect number of arguments." );
}
else
{
BaseGDL* p0=e->GetNumericArrayParDefined ( 0 )->Transpose ( NULL );
zVal=static_cast<DDoubleGDL*>
( p0->Convert2 ( GDL_DOUBLE, BaseGDL::COPY ) );
p0_guard.reset ( p0 ); // delete upon exit
if ( zVal->Rank ( )!=2 )
e->Throw ( "Array must have 2 dimensions: "
+e->GetParString ( 0 ) );
xVal=e->GetParAs< DDoubleGDL>( 1 );
yVal=e->GetParAs< DDoubleGDL>( 2 );
if ( xVal->Rank ( )!=1 )
e->Throw ( "Unable to handle non-vectorial array "+e->GetParString ( 1 )+" (FIXME!)" );
if ( yVal->Rank ( )!=1 )
e->Throw ( "Unable to handle non-vectorial array "+e->GetParString ( 1 )+" (FIXME!)" );
if ( xVal->Rank ( )==1 )
{
xEl=xVal->Dim ( 0 );
if ( xEl!=zVal->Dim ( 1 ) )
e->Throw ( "X, Y, or Z array dimensions are incompatible." );
}
if ( yVal->Rank ( )==1 )
{
yEl=yVal->Dim ( 0 );
if ( yEl!=zVal->Dim ( 0 ) )
e->Throw ( "X, Y, or Z array dimensions are incompatible." );
}
}
GetMinMaxVal ( xVal, &xStart, &xEnd );
GetMinMaxVal ( yVal, &yStart, &yEnd );
//XRANGE and YRANGE overrides all that, but Start/End should be recomputed accordingly
DDouble xAxisStart, xAxisEnd, yAxisStart, yAxisEnd;
bool setx=gdlGetDesiredAxisRange(e, "X", xAxisStart, xAxisEnd);
bool sety=gdlGetDesiredAxisRange(e, "Y", yAxisStart, yAxisEnd);
if(setx && sety)
{
xStart=xAxisStart;
xEnd=xAxisEnd;
yStart=yAxisStart;
yEnd=yAxisEnd;
}
else if (sety)
{
yStart=yAxisStart;
yEnd=yAxisEnd;
}
else if (setx)
{
xStart=xAxisStart;
xEnd=xAxisEnd;
//must compute min-max for other axis!
{
gdlDoRangeExtrema(xVal,yVal,yStart,yEnd,xStart,xEnd);
}
}
#undef UNDEF_RANGE_VALUE
// z range
//.........这里部分代码省略.........