Allows to export code of an arbitrary function. More...
#include <export_function.hpp>
Allows to export code of an arbitrary function.
The class ExportFunction allows to export code of an arbitrary function.
Definition at line 62 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.
ExportFunction::~ExportFunction | ( | ) | [virtual] |
Destructor.
Definition at line 68 of file export_function.cpp.
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.
[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 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.
Reimplemented from ExportStatementBlock.
Definition at line 340 of file export_function.cpp.
ExportStatement * ExportFunction::clone | ( | ) | const [virtual] |
Clone constructor (deep copy).
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.
[in] | stream | Name of file to be used to export function. |
[in] | _realString | std::string to be used to declare real variables. |
[in] | _intString | std::string to be used to declare integer variables. |
[in] | _precision | Number of digits to be used for exporting real values. |
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.
[in] | file | Name of file to be used to export function. |
[in] | _realString | std::string to be used to declare real variables. |
[in] | _intString | std::string to be used to declare integer variables. |
[in] | _precision | Number of digits to be used for exporting real values. |
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.
[in] | stream | Name of file to be used to export statement. |
[in] | _realString | std::string to be used to declare real variables. |
[in] | _intString | std::string to be used to declare integer variables. |
[in] | _precision | Number of digits to be used for exporting real values. |
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.
[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 76 of file export_function.cpp.
bool ExportFunction::isDefined | ( | ) | const [virtual] |
Returns whether function has been defined.
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).
[in] | _functionReturnValue | New return value of the function. |
[in] | _returnAsPointer | Flag indicating whether value shall be returned as pointer. |
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.
[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 101 of file export_function.cpp.
std::string ExportFunction::description [protected] |
A description string.
Definition at line 289 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 302 of file export_function.hpp.
ExportArgumentList ExportFunction::functionArguments [protected] |
List of calling arguments.
Definition at line 292 of file export_function.hpp.
std::vector< ExportVariable > ExportFunction::localVariables [protected] |
Array of local variables.
Definition at line 300 of file export_function.hpp.
MemoryAllocatorPtr ExportFunction::memAllocator [protected] |
Memory allocator
Definition at line 298 of file export_function.hpp.
std::string ExportFunction::name [protected] |
Name of the function.
Definition at line 287 of file export_function.hpp.
bool ExportFunction::returnAsPointer [protected] |
Flag indicating whether value shall be returned as pointer.
Definition at line 296 of file export_function.hpp.
ExportVariable ExportFunction::retVal [protected] |
Return value of the function.
Definition at line 294 of file export_function.hpp.