ACADO Toolkit  1.2.0beta
Toolkit for Automatic Control and Dynamic Optimization
Public Types | Public Member Functions | Protected Attributes | Friends

Allows to export code for a block of statements. More...

#include <export_statement_block.hpp>

Inheritance diagram for ExportStatementBlock:
Inheritance graph
[legend]

List of all members.

Public Types

typedef std::tr1::shared_ptr
< ExportStatement
StatementPtr
 Shared pointer to a statement.
typedef std::vector< StatementPtrStatementPtrArray
 A vector of shared pointer statements.
typedef std::tr1::shared_ptr
< MemoryAllocator
MemoryAllocatorPtr
 Shared pointer to a memory allocator.

Public Member Functions

 ExportStatementBlock ()
 < Default Constructor.
 ExportStatementBlock (const ExportStatementBlock &arg)
 Copy constructor (deep copy).
virtual ~ExportStatementBlock ()
 Destructor.
ExportStatementBlockoperator= (const ExportStatementBlock &rhs)
 Assignment operator (deep copy).
virtual ExportStatementclone () const
 Clone constructor (deep copy).
returnValue addStatement (const ExportStatement &_statement)
 Adds a statement to the statement block.
returnValue addStatement (const String &_statementString)
 Adds a string statement to the statement block.
returnValue addFunction (const ExportFunction &_function)
 Adds a function to the statement block.
returnValue addFunctionCall (const String &_fName, const ExportArgument &_argument1=emptyConstExportArgument, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
 Adds a function call to the statement block.
returnValue addFunctionCall (const ExportFunction &_f, const ExportArgument &_argument1=emptyConstExportArgument, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
 Adds a function call to the statement block.
returnValue addDeclaration (const ExportVariable &_data, ExportStruct _dataStruct=ACADO_ANY)
 Adds a variable declaration to the statement block.
returnValue addDeclaration (const ExportIndex &_data, ExportStruct _dataStruct=ACADO_ANY)
 Adds an index declaration to the statement block.
returnValue addDeclaration (const ExportFunction &_f)
 Adds a function forward declaration to the statement block.
returnValue addDeclaration (const ExportAcadoFunction &_f)
 Adds a forward declaration of an ODE function to the statement block.
returnValue addLinebreak (uint num=1)
 Adds a line break to the statement block.
returnValue addComment (const String &_comment)
 Adds a comment to the statement block.
returnValue addComment (uint _nBlanks, const String &_comment)
 Adds a comment preceded by a given number of blanks to the statement block.
uint getNumStatements () const
 Returns number of statement within statement block.
virtual returnValue exportDataDeclaration (FILE *file, const String &_realString="real_t", const String &_intString="int", int _precision=16) const
 Exports data declaration of the statement block into given file.
virtual returnValue exportCode (FILE *file, const String &_realString="real_t", const String &_intString="int", int _precision=16) const
 Exports source code of the statement block into given file.
returnValue clear ()
 Removes all statements to yield an empty statement block.
virtual ExportStatementacquire (ExportIndex &)
 Acquire an index.
virtual ExportStatementrelease (const ExportIndex &)
 Release an index.
virtual ExportStatementallocate (MemoryAllocatorPtr)
 Set a memory allocator.

Protected Attributes

StatementPtrArray statements
 Array containing all statements of the statement block.

Friends

ExportStatementBlockoperator<< (ExportStatementBlock &_block, const ExportStatement &_statement)
 Add a statement.
ExportStatementBlockoperator<< (ExportStatementBlock &_block, const String &_statement)
 Add a string.
ExportStatementBlockoperator<< (ExportStatementBlock &_block, const std::string &_statement)
 Add an STL string.

Detailed Description

The class ExportStatementBlock allows to export code for a block of statements.

Authors:
Hans Joachim Ferreau, Boris Houska, Milan Vukov

Member Typedef Documentation

typedef std::tr1::shared_ptr< MemoryAllocator > ExportStatement::MemoryAllocatorPtr [inherited]
typedef std::tr1::shared_ptr< ExportStatement > ExportStatement::StatementPtr [inherited]
typedef std::vector< StatementPtr > ExportStatement::StatementPtrArray [inherited]

Constructor & Destructor Documentation

Referenced by clone().

Parameters:
[in]argRight-hand side object.

References statements.

References clear().


Member Function Documentation

virtual ExportStatement& ExportStatement::acquire ( ExportIndex ) [inline, virtual, inherited]

Reimplemented in ExportFunction.

returnValue ExportStatementBlock::addComment ( uint  _nBlanks,
const String _comment 
)
Parameters:
[in]_nBlanksNumber of blanks.
[in]_commentComment to be added.
Returns:
SUCCESSFUL_RETURN

References addStatement(), and uint.

Parameters:
[in]_dataVariable declaration to be added.
Returns:
SUCCESSFUL_RETURN

References ACADO_ANY, addStatement(), ExportData::getDataStruct(), ExportVariable::getDim(), and SUCCESSFUL_RETURN.

Referenced by SIMexport::exportAcadoHeader(), ExportGaussNewtonCN2::getCode(), ExportGaussNewtonCondensed::getCode(), ExportGaussNewtonQpDunes::getCode(), ExportGaussNewtonForces::getCode(), ExportGaussElim::getCode(), AdjointIRKExport::getCode(), ForwardIRKExport::getCode(), DiscreteTimeExport::getCode(), ImplicitRungeKuttaExport::getCode(), ExportGaussNewtonCN2::getDataDeclarations(), ExportGaussNewtonCondensed::getDataDeclarations(), ExportGaussNewtonQpDunes::getDataDeclarations(), ExportGaussNewtonForces::getDataDeclarations(), ExportGaussElim::getDataDeclarations(), ForwardIRKExport::getDataDeclarations(), AdjointIRKExport::getDataDeclarations(), ExportNLPSolver::getDataDeclarations(), ExplicitRungeKuttaExport::getDataDeclarations(), DiscreteTimeExport::getDataDeclarations(), ImplicitRungeKuttaExport::getDataDeclarations(), ExportGaussNewtonCN2::getFunctionDeclarations(), ExportGaussNewtonCondensed::getFunctionDeclarations(), ExportGaussNewtonQpDunes::getFunctionDeclarations(), ExportGaussNewtonForces::getFunctionDeclarations(), ExportHouseholderQR::getFunctionDeclarations(), ExportGaussElim::getFunctionDeclarations(), AdjointIRKExport::getFunctionDeclarations(), ForwardIRKExport::getFunctionDeclarations(), ExplicitRungeKuttaExport::getFunctionDeclarations(), DiscreteTimeExport::getFunctionDeclarations(), ImplicitRungeKuttaExport::getFunctionDeclarations(), DiagonallyImplicitRKExport::prepareInputSystem(), AdjointIRKExport::prepareInputSystem(), ForwardIRKExport::prepareInputSystem(), ImplicitRungeKuttaExport::prepareInputSystem(), ImplicitRungeKuttaExport::prepareOutputEvaluation(), ForwardIRKExport::prepareOutputSystem(), AdjointIRKExport::prepareOutputSystem(), DiagonallyImplicitRKExport::prepareOutputSystem(), and ImplicitRungeKuttaExport::prepareOutputSystem().

Parameters:
[in]_dataIndex declaration to be added.
Returns:
SUCCESSFUL_RETURN

References ACADO_ANY, addStatement(), ExportData::getDataStruct(), and SUCCESSFUL_RETURN.

Parameters:
[in]_ffunction forward declaration to be added.
Returns:
SUCCESSFUL_RETURN

References addStatement().

Parameters:
[in]_fODE function whose forward declaration is to be added.
Returns:
SUCCESSFUL_RETURN

References addStatement().

Parameters:
[in]_fNameName of function to be called.
Returns:
SUCCESSFUL_RETURN

References addStatement().

Referenced by DiagonallyImplicitRKExport::evaluateMatrix(), ImplicitRungeKuttaExport::evaluateMatrix(), DiagonallyImplicitRKExport::evaluateRhsImplicitSystem(), ImplicitRungeKuttaExport::evaluateRhsImplicitSystem(), ImplicitRungeKuttaExport::generateOutput(), ExportGaussElim::getCode(), ExportHouseholderQR::getCode(), NARXExport::prepareFullRhs(), IntegratorExport::prepareFullRhs(), ImplicitRungeKuttaExport::prepareFullRhs(), ForwardIRKExport::sensitivitiesImplicitSystem(), AdjointIRKExport::sensitivitiesImplicitSystem(), DiagonallyImplicitRKExport::sensitivitiesImplicitSystem(), ForwardIRKExport::sensitivitiesOutputs(), AdjointIRKExport::sensitivitiesOutputs(), ExportGaussNewtonQpDunes::setup(), ExportGaussNewtonForces::setup(), ExplicitRungeKuttaExport::setup(), ExportNLPSolver::setupArrivalCostCalculation(), ExportNLPSolver::setupAuxiliaryFunctions(), ExportGaussNewtonCN2::setupCondensing(), ExportGaussNewtonCondensed::setupCondensing(), ExportGaussNewtonQpDunes::setupConstraintsEvaluation(), ExportGaussNewtonCondensed::setupConstraintsEvaluation(), ExportGaussNewtonQpDunes::setupEvaluation(), ExportGaussNewtonCN2::setupEvaluation(), ExportGaussNewtonForces::setupEvaluation(), ExportGaussNewtonCondensed::setupEvaluation(), ExportGaussNewtonQpDunes::setupObjectiveEvaluation(), ExportGaussNewtonForces::setupObjectiveEvaluation(), ExportGaussNewtonCN2::setupObjectiveEvaluation(), ExportGaussNewtonCondensed::setupObjectiveEvaluation(), DiagonallyImplicitRKExport::solveImplicitSystem(), ImplicitRungeKuttaExport::solveImplicitSystem(), DiagonallyImplicitRKExport::solveInputSystem(), ImplicitRungeKuttaExport::solveInputSystem(), DiagonallyImplicitRKExport::solveOutputSystem(), and ImplicitRungeKuttaExport::solveOutputSystem().

Parameters:
[in]_fFunction to be called.
Returns:
SUCCESSFUL_RETURN

References addStatement().

Parameters:
[in]numNumber of line breaks to be added.
Returns:
SUCCESSFUL_RETURN

References addStatement(), and uint.

Referenced by SIMexport::exportAcadoHeader(), OCPexport::exportAcadoHeader(), SIMexport::exportEvaluation(), SIMexport::exportMakefile(), SIMexport::exportTest(), ExportGaussNewtonCN2::getCode(), ExportGaussNewtonCondensed::getCode(), ExportGaussNewtonQpDunes::getCode(), ExportGaussNewtonForces::getCode(), ExportGaussElim::getCode(), ExportHouseholderQR::getCode(), ForwardIRKExport::getCode(), AdjointIRKExport::getCode(), DiscreteTimeExport::getCode(), ImplicitRungeKuttaExport::getCode(), NARXExport::setup(), ExplicitRungeKuttaExport::setup(), ExportGaussElim::setup(), ExportHouseholderQR::setup(), DiscreteTimeExport::setup(), ImplicitRungeKuttaExport::setup(), ExportNLPSolver::setupArrivalCostCalculation(), ExportNLPSolver::setupAuxiliaryFunctions(), ExportGaussNewtonCN2::setupCondensing(), ExportGaussNewtonCondensed::setupCondensing(), ExportGaussNewtonQpDunes::setupConstraintsEvaluation(), ExportGaussNewtonCN2::setupConstraintsEvaluation(), ExportGaussNewtonForces::setupConstraintsEvaluation(), ExportGaussNewtonCondensed::setupConstraintsEvaluation(), ExportGaussNewtonQpDunes::setupEvaluation(), ExportGaussNewtonForces::setupEvaluation(), ExportGaussNewtonCN2::setupEvaluation(), ExportGaussNewtonCondensed::setupEvaluation(), ExportGaussNewtonQpDunes::setupObjectiveEvaluation(), ExportGaussNewtonForces::setupObjectiveEvaluation(), ExportGaussNewtonCN2::setupObjectiveEvaluation(), ExportGaussNewtonCondensed::setupObjectiveEvaluation(), and ExportNLPSolver::setupSimulation().

Parameters:
[in]_statementStatement to be added.
Returns:
SUCCESSFUL_RETURN

References ExportStatement::clone(), statements, and SUCCESSFUL_RETURN.

Referenced by addComment(), addDeclaration(), addFunction(), addFunctionCall(), addLinebreak(), addStatement(), ImplicitRungeKuttaExport::evaluateDerivedPolynomial(), DiagonallyImplicitRKExport::evaluateMatrix(), ImplicitRungeKuttaExport::evaluateMatrix(), ImplicitRungeKuttaExport::evaluatePolynomial(), DiagonallyImplicitRKExport::evaluateRhsImplicitSystem(), ImplicitRungeKuttaExport::evaluateRhsImplicitSystem(), DiagonallyImplicitRKExport::evaluateStatesImplicitSystem(), ImplicitRungeKuttaExport::evaluateStatesImplicitSystem(), ImplicitRungeKuttaExport::evaluateStatesOutputSystem(), SIMexport::exportAcadoHeader(), OCPexport::exportAcadoHeader(), SIMexport::exportEvaluation(), SIMexport::exportMakefile(), SIMexport::exportTest(), ExportTemplatedFile::fillTemplate(), ImplicitRungeKuttaExport::generateOutput(), ExportGaussNewtonCN2::getCode(), ExportGaussNewtonCondensed::getCode(), ExportGaussNewtonQpDunes::getCode(), ExportGaussNewtonForces::getCode(), ExportGaussElim::getCode(), ExportHouseholderQR::getCode(), ForwardIRKExport::getCode(), AdjointIRKExport::getCode(), ExplicitRungeKuttaExport::getCode(), DiscreteTimeExport::getCode(), ImplicitRungeKuttaExport::getCode(), operator<<(), NARXExport::prepareFullRhs(), IntegratorExport::prepareFullRhs(), ImplicitRungeKuttaExport::prepareFullRhs(), NARXExport::propagateImplicitSystem(), IntegratorExport::propagateImplicitSystem(), NARXExport::propagateInputSystem(), IntegratorExport::propagateInputSystem(), ForwardIRKExport::propagateOutputs(), AdjointIRKExport::propagateOutputs(), NARXExport::propagateOutputSystem(), IntegratorExport::propagateOutputSystem(), ForwardIRKExport::sensitivitiesImplicitSystem(), AdjointIRKExport::sensitivitiesImplicitSystem(), DiagonallyImplicitRKExport::sensitivitiesImplicitSystem(), ForwardIRKExport::sensitivitiesInputSystem(), AdjointIRKExport::sensitivitiesInputSystem(), ForwardIRKExport::sensitivitiesOutputs(), AdjointIRKExport::sensitivitiesOutputs(), DiagonallyImplicitRKExport::sensitivitiesOutputSystem(), AdjointIRKExport::sensitivitiesOutputSystem(), ForwardIRKExport::sensitivitiesOutputSystem(), ExportCholeskyDecomposition::setup(), NARXExport::setup(), ExplicitRungeKuttaExport::setup(), DiscreteTimeExport::setup(), ExportNLPSolver::setupArrivalCostCalculation(), ExportNLPSolver::setupAuxiliaryFunctions(), ExportGaussNewtonCN2::setupCondensing(), ExportGaussNewtonCondensed::setupCondensing(), ExportGaussNewtonQpDunes::setupConstraintsEvaluation(), ExportGaussNewtonCN2::setupConstraintsEvaluation(), ExportGaussNewtonForces::setupConstraintsEvaluation(), ExportGaussNewtonCondensed::setupConstraintsEvaluation(), ExportGaussNewtonQpDunes::setupEvaluation(), ExportGaussNewtonCN2::setupEvaluation(), ExportGaussNewtonForces::setupEvaluation(), ExportGaussNewtonCondensed::setupEvaluation(), ExportGaussNewtonCN2::setupMultiplicationRoutines(), ExportGaussNewtonCondensed::setupMultiplicationRoutines(), ExportGaussNewtonQpDunes::setupObjectiveEvaluation(), ExportGaussNewtonCN2::setupObjectiveEvaluation(), ExportGaussNewtonForces::setupObjectiveEvaluation(), ExportGaussNewtonCondensed::setupObjectiveEvaluation(), ExportNLPSolver::setupSimulation(), DiagonallyImplicitRKExport::solveImplicitSystem(), ImplicitRungeKuttaExport::solveImplicitSystem(), DiagonallyImplicitRKExport::solveInputSystem(), ImplicitRungeKuttaExport::solveInputSystem(), DiagonallyImplicitRKExport::solveOutputSystem(), ImplicitRungeKuttaExport::solveOutputSystem(), NARXExport::updateImplicitSystem(), IntegratorExport::updateImplicitSystem(), NARXExport::updateInputSystem(), IntegratorExport::updateInputSystem(), NARXExport::updateOutputSystem(), and IntegratorExport::updateOutputSystem().

returnValue ExportStatementBlock::addStatement ( const String _statementString)
Parameters:
[in]_statementStringString statement to be added.
Returns:
SUCCESSFUL_RETURN

References addStatement().

virtual ExportStatement& ExportStatement::allocate ( MemoryAllocatorPtr  ) [inline, virtual, inherited]

Reimplemented in ExportArithmeticStatement, and ExportForLoop.

Returns:
SUCCESSFUL_RETURN

Reimplemented in ExportFunction, and ExportForLoop.

References SUCCESSFUL_RETURN.

Referenced by operator=(), and ~ExportStatementBlock().

Returns:
Pointer to cloned object.

Implements ExportStatement.

Reimplemented in ExportFunction, ExportForLoop, and ExportAcadoFunction.

References ExportStatementBlock().

returnValue ExportStatementBlock::exportCode ( FILE *  file,
const String _realString = "real_t",
const String _intString = "int",
int  _precision = 16 
) const [virtual]

Its appearance can can be adjusted by various options.

Parameters:
[in]fileName of file to be used to export statement block.
[in]_realStringString to be used to declare real variables.
[in]_intStringString to be used to declare integer variables.
[in]_precisionNumber of digits to be used for exporting real values.
Returns:
SUCCESSFUL_RETURN

Implements ExportStatement.

Reimplemented in ExportFunction, ExportAcadoFunction, and ExportForLoop.

References ACADOERROR, RET_UNABLE_TO_EXPORT_STATEMENT, statements, and SUCCESSFUL_RETURN.

returnValue ExportStatementBlock::exportDataDeclaration ( FILE *  file,
const String _realString = "real_t",
const String _intString = "int",
int  _precision = 16 
) const [virtual]

Its appearance can can be adjusted by various options.

Parameters:
[in]fileName of file to be used to export statement block.
[in]_realStringString to be used to declare real variables.
[in]_intStringString to be used to declare integer variables.
[in]_precisionNumber of digits to be used for exporting real values.
Returns:
SUCCESSFUL_RETURN

Reimplemented from ExportStatement.

Reimplemented in ExportFunction, ExportForLoop, and ExportAcadoFunction.

References ACADOERROR, RET_UNABLE_TO_EXPORT_STATEMENT, statements, and SUCCESSFUL_RETURN.

Returns:
Number of statement within statement block

References statements.

Referenced by SIMexport::exportAcadoHeader(), and ExportFunction::isDefined().

ExportStatementBlock & ExportStatementBlock::operator= ( const ExportStatementBlock rhs)
Parameters:
[in]argRight-hand side object.

References clear(), and statements.

virtual ExportStatement& ExportStatement::release ( const ExportIndex ) [inline, virtual, inherited]

Reimplemented in ExportFunction.


Friends And Related Function Documentation

ExportStatementBlock& operator<< ( ExportStatementBlock _block,
const ExportStatement _statement 
) [friend]
ExportStatementBlock& operator<< ( ExportStatementBlock _block,
const String _statement 
) [friend]
ExportStatementBlock& operator<< ( ExportStatementBlock _block,
const std::string &  _statement 
) [friend]

Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines