Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members

Allows to export code of a for-loop. More...

#include <export_for_loop.hpp>

Inheritance diagram for ExportForLoop:
Inheritance graph
[legend]

Public Member Functions

ExportForLoopallocate (MemoryAllocatorPtr allocator)
 
virtual ExportStatementclone () const
 
virtual returnValue exportCode (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
 
virtual returnValue exportDataDeclaration (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
 
 ExportForLoop (const ExportIndex &_loopVariable=emptyConstExportIndex, const ExportIndex &_startValue=emptyConstExportIndex, const ExportIndex &_finalValue=emptyConstExportIndex, const ExportIndex &_increment=constExportIndexValueOne, bool _doLoopUnrolling=false)
 
 ExportForLoop (const ExportForLoop &arg)
 
returnValue init (const ExportIndex &_loopVariable, const ExportIndex &_startValue, const ExportIndex &_finalValue, const ExportIndex &_increment, bool _doLoopUnrolling)
 
ExportForLoopkeepLoop ()
 
ExportForLoopoperator= (const ExportForLoop &arg)
 
ExportForLoopunrollLoop ()
 
virtual ~ExportForLoop ()
 
- Public Member Functions inherited from ExportStatementBlock
returnValue addComment (const std::string &_comment)
 
returnValue addComment (uint _nBlanks, const std::string &_comment)
 
returnValue addDeclaration (const ExportVariable &_data, ExportStruct _dataStruct=ACADO_ANY)
 
returnValue addDeclaration (const ExportIndex &_data, ExportStruct _dataStruct=ACADO_ANY)
 
returnValue addDeclaration (const ExportFunction &_f)
 
returnValue addDeclaration (const ExportAcadoFunction &_f)
 
returnValue addFunction (const ExportFunction &_function)
 
returnValue addFunctionCall (const std::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)
 
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)
 
returnValue addLinebreak (uint num=1)
 
returnValue addStatement (const ExportStatement &_statement)
 
returnValue addStatement (const std::string &_statementString)
 
returnValue clear ()
 
 ExportStatementBlock ()
 
 ExportStatementBlock (const ExportStatementBlock &arg)
 
uint getNumStatements () const
 
ExportStatementBlockoperator= (const ExportStatementBlock &rhs)
 
virtual ~ExportStatementBlock ()
 
- Public Member Functions inherited from ExportStatement
virtual ExportStatementacquire (ExportIndex &)
 
 ExportStatement ()
 
 ExportStatement (const ExportStatement &arg)
 
ExportStatementoperator= (const ExportStatement &arg)
 
virtual ExportStatementrelease (const ExportIndex &)
 
virtual ~ExportStatement ()
 

Protected Member Functions

returnValue clear ()
 

Protected Attributes

bool doLoopUnrolling
 
ExportIndex finalValue
 
ExportIndex increment
 
ExportIndex loopVariable
 
ExportIndex startValue
 
- Protected Attributes inherited from ExportStatementBlock
StatementPtrArray statements
 

Private Member Functions

returnValue sanityCheck (void) const
 

Additional Inherited Members

- Public Types inherited from ExportStatement
typedef std::shared_ptr< MemoryAllocatorMemoryAllocatorPtr
 
typedef std::shared_ptr< ExportStatementStatementPtr
 
typedef std::vector< StatementPtrStatementPtrArray
 
- Static Public Attributes inherited from ExportStatement
static std::string fcnPrefix = "acado"
 
static std::string varPrefix = "ACADO"
 

Detailed Description

Allows to export code of a for-loop.

The class ExportForLoop allows to export code of a for-loop.

Author
Hans Joachim Ferreau, Boris Houska, Milan Vukov

Definition at line 56 of file export_for_loop.hpp.

Constructor & Destructor Documentation

ExportForLoop::ExportForLoop ( const ExportIndex _loopVariable = emptyConstExportIndex,
const ExportIndex _startValue = emptyConstExportIndex,
const ExportIndex _finalValue = emptyConstExportIndex,
const ExportIndex _increment = constExportIndexValueOne,
bool  _doLoopUnrolling = false 
)

Default constructor which optionally takes the name of the loop variable as well as other loop settings.

Parameters
[in]_loopVariableName of the loop variable.
[in]_startValueStart value of the loop counter.
[in]_finalValueFinal value of the loop counter.
[in]_incrementIncrement of the loop counter.
[in]_doLoopUnrollingFlag indicating whether loop shall be unrolled.

Definition at line 46 of file export_for_loop.cpp.

ExportForLoop::ExportForLoop ( const ExportForLoop arg)

Copy constructor (deep copy).

@param[in] arg      Right-hand side object.

Definition at line 62 of file export_for_loop.cpp.

ExportForLoop::~ExportForLoop ( )
virtual

Destructor.

Definition at line 72 of file export_for_loop.cpp.

Member Function Documentation

ExportForLoop & ExportForLoop::allocate ( MemoryAllocatorPtr  )
virtual

Set a memory allocator.

Reimplemented from ExportStatement.

Definition at line 197 of file export_for_loop.cpp.

returnValue ExportForLoop::clear ( )
protected

Frees internal dynamic memory to yield an empty for-loop.

\return SUCCESSFUL_RETURN

Definition at line 215 of file export_for_loop.cpp.

ExportStatement * ExportForLoop::clone ( ) const
virtual

Clone constructor (deep copy).

\return Pointer to cloned object.

Reimplemented from ExportStatementBlock.

Definition at line 90 of file export_for_loop.cpp.

returnValue ExportForLoop::exportCode ( std::ostream &  stream,
const std::string &  _realString = "real_t",
const std::string &  _intString = "int",
int  _precision = 16 
) const
virtual

Exports source code of the statement into given file. Its appearance can can be adjusted by various options.

@param[in] file                             Name of file to be used to export statement.
@param[in] _realString              std::string to be used to declare real variables.
@param[in] _intString               std::string to be used to declare integer variables.
@param[in] _precision               Number of digits to be used for exporting real values.

\return SUCCESSFUL_RETURN

Reimplemented from ExportStatementBlock.

Definition at line 127 of file export_for_loop.cpp.

returnValue ExportForLoop::exportDataDeclaration ( std::ostream &  stream,
const std::string &  _realString = "real_t",
const std::string &  _intString = "int",
int  _precision = 16 
) const
virtual

Exports data declaration of the statement into given file. Its appearance can can be adjusted by various options.

@param[in] stream                   Name of file to be used to export statement.
@param[in] _realString              std::string to be used to declare real variables.
@param[in] _intString               std::string to be used to declare integer variables.
@param[in] _precision               Number of digits to be used for exporting real values.

\return SUCCESSFUL_RETURN

Reimplemented from ExportStatementBlock.

Definition at line 117 of file export_for_loop.cpp.

returnValue ExportForLoop::init ( const ExportIndex _loopVariable,
const ExportIndex _startValue,
const ExportIndex _finalValue,
const ExportIndex _increment,
bool  _doLoopUnrolling 
)

Initializes for-loop with given loop settings.

@param[in] _loopVariable            Name of the loop variable.
@param[in] _startValue                      Start value of the loop counter.
@param[in] _finalValue                      Final value of the loop counter.
@param[in] _increment                       Increment of the loop counter.
@param[in] _doLoopUnrolling         Flag indicating whether loop shall be unrolled.

Definition at line 96 of file export_for_loop.cpp.

ExportForLoop & ExportForLoop::keepLoop ( )

Specifies not to unroll for-loop.

\return Loop-unrolled copy of for-loop object

Definition at line 191 of file export_for_loop.cpp.

ExportForLoop & ExportForLoop::operator= ( const ExportForLoop arg)

Assignment operator (deep copy).

@param[in] arg      Right-hand side object.

Definition at line 78 of file export_for_loop.cpp.

returnValue ExportForLoop::sanityCheck ( void  ) const
private

Definition at line 223 of file export_for_loop.cpp.

ExportForLoop & ExportForLoop::unrollLoop ( )

Specifies to unroll for-loop.

\return Reference to for-loop object

Definition at line 184 of file export_for_loop.cpp.

Member Data Documentation

bool ExportForLoop::doLoopUnrolling
protected

Flag indicating whether loop shall be unrolled when exporting the code.

Definition at line 192 of file export_for_loop.hpp.

ExportIndex ExportForLoop::finalValue
protected

Final value of the loop counter.

Definition at line 189 of file export_for_loop.hpp.

ExportIndex ExportForLoop::increment
protected

Increment of the loop counter.

Definition at line 190 of file export_for_loop.hpp.

ExportIndex ExportForLoop::loopVariable
protected

Loop variable.

Definition at line 187 of file export_for_loop.hpp.

ExportIndex ExportForLoop::startValue
protected

Start value of the loop counter.

Definition at line 188 of file export_for_loop.hpp.


The documentation for this class was generated from the following files:


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:23