Allows to export code of an arbitrary function. More...
#include <export_function.hpp>
Protected Member Functions | |
returnValue | clear () |
Protected Attributes | |
std::string | description |
bool | flagPrivate |
ExportArgumentList | functionArguments |
std::vector< ExportVariable > | localVariables |
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< MemoryAllocator > | MemoryAllocatorPtr |
typedef std::shared_ptr< ExportStatement > | StatementPtr |
typedef std::vector< StatementPtr > | StatementPtrArray |
Static Public Attributes inherited from ExportStatement | |
static std::string | fcnPrefix = "acado" |
static std::string | varPrefix = "ACADO" |
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.
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.
[in] | _name | Name of the function. |
[in] | _argument1 | Calling argument no. 1. |
[in] | _argument2 | Calling argument no. 2. |
[in] | _argument3 | Calling argument no. 3. |
[in] | _argument4 | Calling argument no. 4. |
[in] | _argument5 | Calling argument no. 5. |
[in] | _argument6 | Calling argument no. 6. |
[in] | _argument7 | Calling argument no. 7. |
[in] | _argument8 | Calling argument no. 8. |
[in] | _argument9 | Calling argument no. 9. |
Definition at line 46 of file export_function.cpp.
|
virtual |
Destructor.
Definition at line 68 of file export_function.cpp.
|
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.
|
protected |
Frees internal dynamic memory to yield an empty function.
\return SUCCESSFUL_RETURN
Definition at line 340 of file export_function.cpp.
|
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.
|
virtual |
Set a documentation string.
Definition at line 375 of file export_function.cpp.
|
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.
|
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.
|
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.
|
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.
|
virtual |
Is function private?
Definition at line 389 of file export_function.cpp.
|
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.
|
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.
|
protected |
A description string.
Definition at line 285 of file export_function.hpp.
|
protected |
Private flag. In principle if this guy is true, do not export function declaration.
Definition at line 298 of file export_function.hpp.
|
protected |
List of calling arguments.
Definition at line 288 of file export_function.hpp.
|
protected |
Array of local variables.
Definition at line 296 of file export_function.hpp.
|
protected |
Memory allocator
Definition at line 294 of file export_function.hpp.
|
protected |
Name of the function.
Definition at line 283 of file export_function.hpp.
|
protected |
Flag indicating whether value shall be returned as pointer.
Definition at line 292 of file export_function.hpp.
|
protected |
Return value of the function.
Definition at line 290 of file export_function.hpp.