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

Allows to export code of an arbitrary function. More...

#include <export_function.hpp>

Inheritance diagram for ExportFunction:
Inheritance graph
[legend]

Public Member Functions

virtual ExportFunctionacquire (ExportIndex &obj)
 
returnValue addArgument (const ExportArgument &_argument1, 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)
 
ExportFunctionaddIndex (const ExportIndex &_index)
 
ExportFunctionaddVariable (const ExportVariable &_var)
 
virtual ExportStatementclone () const
 
virtual ExportFunctiondoc (const std::string &_doc)
 
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
 
virtual returnValue exportForwardDeclaration (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
 
 ExportFunction (const std::string &_name="defaultFunctionName", 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)
 
std::string getName () const
 
unsigned getNumArguments () const
 
returnValue init (const std::string &_name="defaultFunctionName", 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)
 
virtual bool isDefined () const
 
virtual bool isPrivate () const
 
virtual ExportFunctionrelease (const ExportIndex &obj)
 
ExportFunctionsetName (const std::string &_name)
 
virtual ExportFunctionsetPrivate (bool _set=true)
 
ExportFunctionsetReturnValue (const ExportVariable &_functionReturnValue, bool _returnAsPointer=false)
 
ExportFunctionsetup (const std::string &_name="defaultFunctionName", 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)
 
virtual ~ExportFunction ()
 
- 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 ExportStatementallocate (MemoryAllocatorPtr)
 
 ExportStatement ()
 
 ExportStatement (const ExportStatement &arg)
 
ExportStatementoperator= (const ExportStatement &arg)
 
virtual ~ExportStatement ()
 

Protected Member Functions

returnValue clear ()
 

Protected Attributes

std::string description
 
bool flagPrivate
 
ExportArgumentList functionArguments
 
std::vector< ExportVariablelocalVariables
 
MemoryAllocatorPtr memAllocator
 
std::string name
 
bool returnAsPointer
 
ExportVariable retVal
 
- Protected Attributes inherited from ExportStatementBlock
StatementPtrArray statements
 

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 an arbitrary function.

The class ExportFunction allows to export code of an arbitrary function.

Definition at line 58 of file export_function.hpp.

Constructor & Destructor Documentation

BEGIN_NAMESPACE_ACADO ExportFunction::ExportFunction ( const std::string &  _name = "defaultFunctionName",
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 
)

Default constructor which optionally takes the name of the function as well as possible calling arguments.

Parameters
[in]_nameName of the function.
[in]_argument1Calling argument no. 1.
[in]_argument2Calling argument no. 2.
[in]_argument3Calling argument no. 3.
[in]_argument4Calling argument no. 4.
[in]_argument5Calling argument no. 5.
[in]_argument6Calling argument no. 6.
[in]_argument7Calling argument no. 7.
[in]_argument8Calling argument no. 8.
[in]_argument9Calling argument no. 9.

Definition at line 46 of file export_function.cpp.

ExportFunction::~ExportFunction ( )
virtual

Destructor.

Definition at line 68 of file export_function.cpp.

Member Function Documentation

ExportFunction & ExportFunction::acquire ( ExportIndex obj)
virtual

Acquire a local variable.

Reimplemented from ExportStatement.

Definition at line 354 of file export_function.cpp.

returnValue ExportFunction::addArgument ( const ExportArgument _argument1,
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 up to nine calling arguments to the function.

@param[in] _name            Name of the function.
@param[in] _argument1       Calling argument no. 1.
@param[in] _argument2       Calling argument no. 2.
@param[in] _argument3       Calling argument no. 3.
@param[in] _argument4       Calling argument no. 4.
@param[in] _argument5       Calling argument no. 5.
@param[in] _argument6       Calling argument no. 6.
@param[in] _argument7       Calling argument no. 7.
@param[in] _argument8       Calling argument no. 8.
@param[in] _argument9       Calling argument no. 9.

\return SUCCESSFUL_RETURN

Definition at line 123 of file export_function.cpp.

ExportFunction & ExportFunction::addIndex ( const ExportIndex _index)

Add a new index (local) index to the function

Definition at line 347 of file export_function.cpp.

ExportFunction & ExportFunction::addVariable ( const ExportVariable _var)

Add a new index (local) variable to the function.

Definition at line 368 of file export_function.cpp.

returnValue ExportFunction::clear ( )
protected

Frees internal dynamic memory to yield an empty function.

\return SUCCESSFUL_RETURN

Definition at line 340 of file export_function.cpp.

ExportStatement * ExportFunction::clone ( ) const
virtual

Clone constructor (deep copy).

\return Pointer to cloned object.

Reimplemented from ExportStatementBlock.

Reimplemented in ExportAcadoFunction.

Definition at line 71 of file export_function.cpp.

ExportFunction & ExportFunction::doc ( const std::string &  _doc)
virtual

Set a documentation string.

Definition at line 375 of file export_function.cpp.

returnValue ExportFunction::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 function into given file. Its appearance can can be adjusted by various options.

@param[in] stream                   Name of file to be used to export function.
@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.

Reimplemented in ExportAcadoFunction.

Definition at line 246 of file export_function.cpp.

returnValue ExportFunction::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 function into given file. Its appearance can can be adjusted by various options.

@param[in] file                             Name of file to be used to export function.
@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.

Reimplemented in ExportAcadoFunction.

Definition at line 171 of file export_function.cpp.

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

Exports forward declaration of the function 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 in ExportAcadoFunction.

Definition at line 181 of file export_function.cpp.

std::string ExportFunction::getName ( ) const

Returns the name of the function.

Definition at line 164 of file export_function.cpp.

unsigned ExportFunction::getNumArguments ( ) const

Return number of calling arguments of the function.

Definition at line 330 of file export_function.cpp.

returnValue ExportFunction::init ( const std::string &  _name = "defaultFunctionName",
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 
)

Initializes function with given name and possible calling arguments.

@param[in] _name            Name of the function.
@param[in] _argument1       Calling argument no. 1.
@param[in] _argument2       Calling argument no. 2.
@param[in] _argument3       Calling argument no. 3.
@param[in] _argument4       Calling argument no. 4.
@param[in] _argument5       Calling argument no. 5.
@param[in] _argument6       Calling argument no. 6.
@param[in] _argument7       Calling argument no. 7.
@param[in] _argument8       Calling argument no. 8.
@param[in] _argument9       Calling argument no. 9.

\return SUCCESSFUL_RETURN

Definition at line 76 of file export_function.cpp.

bool ExportFunction::isDefined ( ) const
virtual

Returns whether function has been defined.

\return true  iff function has been defined, \n
        false otherwise

Reimplemented in ExportAcadoFunction.

Definition at line 321 of file export_function.cpp.

bool ExportFunction::isPrivate ( ) const
virtual

Is function private?

Definition at line 389 of file export_function.cpp.

ExportFunction & ExportFunction::release ( const ExportIndex obj)
virtual

Release a local variable.

Reimplemented from ExportStatement.

Definition at line 361 of file export_function.cpp.

ExportFunction & ExportFunction::setName ( const std::string &  _name)

Sets the name of the function.

Definition at line 152 of file export_function.cpp.

ExportFunction & ExportFunction::setPrivate ( bool  _set = true)
virtual

Set the function as private. If this is true, then do not export it's declaration.

Definition at line 382 of file export_function.cpp.

ExportFunction & ExportFunction::setReturnValue ( const ExportVariable _functionReturnValue,
bool  _returnAsPointer = false 
)

Assigns a return value to the function (by default, its return value is void).

@param[in] _functionReturnValue             New return value of the function.
@param[in] _returnAsPointer                 Flag indicating whether value shall be returned as pointer.

\return SUCCESSFUL_RETURN

Definition at line 141 of file export_function.cpp.

ExportFunction & ExportFunction::setup ( const std::string &  _name = "defaultFunctionName",
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 
)

Initializes function with given name and possible calling arguments.

@param[in] _name            Name of the function.
@param[in] _argument1       Calling argument no. 1.
@param[in] _argument2       Calling argument no. 2.
@param[in] _argument3       Calling argument no. 3.
@param[in] _argument4       Calling argument no. 4.
@param[in] _argument5       Calling argument no. 5.
@param[in] _argument6       Calling argument no. 6.
@param[in] _argument7       Calling argument no. 7.
@param[in] _argument8       Calling argument no. 8.
@param[in] _argument9       Calling argument no. 9.

\return Reference to initialized object

Definition at line 101 of file export_function.cpp.

Member Data Documentation

std::string ExportFunction::description
protected

A description string.

Definition at line 285 of file export_function.hpp.

bool ExportFunction::flagPrivate
protected

Private flag. In principle if this guy is true, do not export function declaration.

Definition at line 298 of file export_function.hpp.

ExportArgumentList ExportFunction::functionArguments
protected

List of calling arguments.

Definition at line 288 of file export_function.hpp.

std::vector< ExportVariable > ExportFunction::localVariables
protected

Array of local variables.

Definition at line 296 of file export_function.hpp.

MemoryAllocatorPtr ExportFunction::memAllocator
protected

Memory allocator

Definition at line 294 of file export_function.hpp.

std::string ExportFunction::name
protected

Name of the function.

Definition at line 283 of file export_function.hpp.

bool ExportFunction::returnAsPointer
protected

Flag indicating whether value shall be returned as pointer.

Definition at line 292 of file export_function.hpp.

ExportVariable ExportFunction::retVal
protected

Return value of the function.

Definition at line 290 of file export_function.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