ACADO Toolkit
1.2.0beta
Toolkit for Automatic Control and Dynamic Optimization
|
Allows to export code for a block of statements. More...
#include <export_statement_block.hpp>
Public Types | |
typedef std::tr1::shared_ptr < ExportStatement > | StatementPtr |
Shared pointer to a statement. | |
typedef std::vector< StatementPtr > | StatementPtrArray |
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. | |
ExportStatementBlock & | operator= (const ExportStatementBlock &rhs) |
Assignment operator (deep copy). | |
virtual ExportStatement * | clone () 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 ExportStatement & | acquire (ExportIndex &) |
Acquire an index. | |
virtual ExportStatement & | release (const ExportIndex &) |
Release an index. | |
virtual ExportStatement & | allocate (MemoryAllocatorPtr) |
Set a memory allocator. | |
Protected Attributes | |
StatementPtrArray | statements |
Array containing all statements of the statement block. | |
Friends | |
ExportStatementBlock & | operator<< (ExportStatementBlock &_block, const ExportStatement &_statement) |
Add a statement. | |
ExportStatementBlock & | operator<< (ExportStatementBlock &_block, const String &_statement) |
Add a string. | |
ExportStatementBlock & | operator<< (ExportStatementBlock &_block, const std::string &_statement) |
Add an STL string. |
The class ExportStatementBlock allows to export code for a block of statements.
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] |
Referenced by clone().
ExportStatementBlock::ExportStatementBlock | ( | const ExportStatementBlock & | arg | ) |
[in] | arg | Right-hand side object. |
References statements.
ExportStatementBlock::~ExportStatementBlock | ( | ) | [virtual] |
References clear().
virtual ExportStatement& ExportStatement::acquire | ( | ExportIndex & | ) | [inline, virtual, inherited] |
Reimplemented in ExportFunction.
returnValue ExportStatementBlock::addComment | ( | const String & | _comment | ) |
[in] | _comment | Comment to be added. |
References addStatement().
Referenced by SIMexport::exportAcadoHeader(), SIMexport::exportEvaluation(), SIMexport::exportTest(), ForwardIRKExport::getCode(), AdjointIRKExport::getCode(), ExplicitRungeKuttaExport::getCode(), DiscreteTimeExport::getCode(), ImplicitRungeKuttaExport::getCode(), ExportGaussNewtonCN2::setupCondensing(), ExportGaussNewtonQpDunes::setupConstraintsEvaluation(), ExportGaussNewtonCondensed::setupConstraintsEvaluation(), and ExportNLPSolver::setupSimulation().
returnValue ExportStatementBlock::addComment | ( | uint | _nBlanks, |
const String & | _comment | ||
) |
[in] | _nBlanks | Number of blanks. |
[in] | _comment | Comment to be added. |
References addStatement(), and uint.
returnValue ExportStatementBlock::addDeclaration | ( | const ExportVariable & | _data, |
ExportStruct | _dataStruct = ACADO_ANY |
||
) |
[in] | _data | Variable declaration to be added. |
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().
returnValue ExportStatementBlock::addDeclaration | ( | const ExportIndex & | _data, |
ExportStruct | _dataStruct = ACADO_ANY |
||
) |
[in] | _data | Index declaration to be added. |
References ACADO_ANY, addStatement(), ExportData::getDataStruct(), and SUCCESSFUL_RETURN.
returnValue ExportStatementBlock::addDeclaration | ( | const ExportFunction & | _f | ) |
[in] | _f | function forward declaration to be added. |
References addStatement().
[in] | _f | ODE function whose forward declaration is to be added. |
References addStatement().
returnValue ExportStatementBlock::addFunction | ( | const ExportFunction & | _function | ) |
[in] | _function | Function to be added. |
References addStatement().
Referenced by ExportGaussNewtonCN2::getCode(), ExportGaussNewtonCondensed::getCode(), ExportGaussNewtonQpDunes::getCode(), ExportGaussNewtonForces::getCode(), ExportCholeskyDecomposition::getCode(), ExportGaussElim::getCode(), ExportHouseholderQR::getCode(), AdjointIRKExport::getCode(), ForwardIRKExport::getCode(), ExplicitRungeKuttaExport::getCode(), DiscreteTimeExport::getCode(), ImplicitRungeKuttaExport::getCode(), and ExportCholeskyDecomposition::getFunctionDeclarations().
returnValue ExportStatementBlock::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 |
||
) |
[in] | _fName | Name of function to be called. |
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().
returnValue ExportStatementBlock::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 |
||
) |
returnValue ExportStatementBlock::addLinebreak | ( | uint | num = 1 | ) |
[in] | num | Number of line breaks to be added. |
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().
returnValue ExportStatementBlock::addStatement | ( | const ExportStatement & | _statement | ) |
[in] | _statement | Statement to be added. |
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 | ) |
[in] | _statementString | String statement to be added. |
References addStatement().
virtual ExportStatement& ExportStatement::allocate | ( | MemoryAllocatorPtr | ) | [inline, virtual, inherited] |
Reimplemented in ExportArithmeticStatement, and ExportForLoop.
Reimplemented in ExportFunction, and ExportForLoop.
References SUCCESSFUL_RETURN.
Referenced by operator=(), and ~ExportStatementBlock().
ExportStatement * ExportStatementBlock::clone | ( | ) | const [virtual] |
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.
[in] | file | Name of file to be used to export statement block. |
[in] | _realString | String to be used to declare real variables. |
[in] | _intString | String to be used to declare integer variables. |
[in] | _precision | Number of digits to be used for exporting real values. |
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.
[in] | file | Name of file to be used to export statement block. |
[in] | _realString | String to be used to declare real variables. |
[in] | _intString | String to be used to declare integer variables. |
[in] | _precision | Number of digits to be used for exporting real values. |
Reimplemented from ExportStatement.
Reimplemented in ExportFunction, ExportForLoop, and ExportAcadoFunction.
References ACADOERROR, RET_UNABLE_TO_EXPORT_STATEMENT, statements, and SUCCESSFUL_RETURN.
uint ExportStatementBlock::getNumStatements | ( | ) | const |
References statements.
Referenced by SIMexport::exportAcadoHeader(), and ExportFunction::isDefined().
ExportStatementBlock & ExportStatementBlock::operator= | ( | const ExportStatementBlock & | rhs | ) |
[in] | arg | Right-hand side object. |
References clear(), and statements.
virtual ExportStatement& ExportStatement::release | ( | const ExportIndex & | ) | [inline, virtual, inherited] |
Reimplemented in ExportFunction.
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] |
StatementPtrArray ExportStatementBlock::statements [protected] |