Defines a matrix-valued variable that can be passed as argument to exported functions. More...
#include <export_argument.hpp>
Public Member Functions | |
returnValue | callByValue () |
ExportArgument () | |
ExportArgument (const std::string &_name, uint _nRows=1, uint _nCols=1, ExportType _type=REAL, ExportStruct _dataStruct=ACADO_LOCAL, bool _callByValue=false, const ExportIndex &_addressIdx=emptyConstExportIndex, const std::string &_prefix=std::string()) | |
ExportArgument (const std::string &_name, const DMatrixPtr &_data, ExportType _type=REAL, ExportStruct _dataStruct=ACADO_LOCAL, bool _callByValue=false, const ExportIndex &_addressIdx=emptyConstExportIndex, const std::string &_prefix=std::string()) | |
ExportArgument (const DMatrix &_data) | |
virtual returnValue | exportDataDeclaration (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const |
ExportArgument | getAddress (const ExportIndex &_rowIdx, const ExportIndex &_colIdx=emptyConstExportIndex) const |
const std::string | getAddressString (bool withDataStruct=true) const |
virtual uint | getDim () const |
virtual uint | getNumCols () const |
virtual uint | getNumRows () const |
bool | isCalledByValue () const |
virtual bool | isGiven () const |
ExportArgumentInternal * | operator-> () |
const ExportArgumentInternal * | operator-> () const |
Public Member Functions inherited from ExportData | |
ExportData () | |
ExportStruct | getDataStruct () const |
std::string | getDataStructString () const |
virtual std::string | getDoc () const |
std::string | getFullName () const |
std::string | getName () const |
std::string | getPrefix () const |
ExportType | getType () const |
std::string | getTypeString (const std::string &_realString="real_t", const std::string &_intString="int") const |
virtual bool | isGiven () |
ExportDataInternal * | operator-> () |
const ExportDataInternal * | operator-> () const |
returnValue | setDataStruct (ExportStruct _dataStruct) |
virtual returnValue | setDoc (const std::string &_doc) |
returnValue | setName (const std::string &_name) |
returnValue | setPrefix (const std::string &_prefix) |
returnValue | setType (ExportType _type) |
virtual | ~ExportData () |
Public Member Functions inherited from CasADi::SharedObject | |
void | assertInit () const |
Assert that it is initialized. More... | |
void | assignNode (SharedObjectNode *node) |
Assign the node to a node class pointer (or null) More... | |
void | assignNodeNoCount (SharedObjectNode *node) |
Assign the node to a node class pointer without reference counting: inproper use will cause memory leaks! More... | |
virtual bool | checkNode () const |
Assert that the node is pointing to the right type of object. More... | |
SharedObject | clone () const |
Deep copy. More... | |
const SharedObjectNode * | get () const |
Get a const pointer to the node. More... | |
SharedObjectNode * | get () |
Get a pointer to the node. More... | |
int | getCount () const |
Get the reference count. More... | |
void | init () |
Initialize the object: more documentation in the node class (SharedObjectNode and derived classes) More... | |
bool | isInit () const |
Is initialized? More... | |
bool | isNull () const |
Is a null pointer? More... | |
SharedObjectNode * | operator-> () |
Access a member function or object. More... | |
const SharedObjectNode * | operator-> () const |
Const access a member function or object. More... | |
SharedObject & | operator= (const SharedObject &ref) |
Assignment operator. More... | |
virtual void | print (std::ostream &stream=std::cout) const |
Print a destription of the object. More... | |
virtual void | repr (std::ostream &stream) const |
Print a representation of the object. More... | |
SharedObject () | |
Default constructor. More... | |
SharedObject (const SharedObject &ref) | |
Copy constructor (shallow copy) More... | |
void | swap (SharedObject &other) |
Swap content with another instance. More... | |
~SharedObject () | |
Destructor. More... | |
void | makeUnique (bool clone_members=true) |
If there are other references to the object, then make a deep copy of it and point to this new object. More... | |
void | makeUnique (std::map< SharedObjectNode *, SharedObject > &already_copied, bool clone_members=true) |
Public Member Functions inherited from CasADi::PrintableObject | |
std::string | getDescription () const |
Return a string with a destription (for SWIG) More... | |
std::string | getRepresentation () const |
Return a string with a representation (for SWIG) More... | |
Defines a matrix-valued variable that can be passed as argument to exported functions.
The class ExportArgument defines a matrix-valued variable that can be passed as argument to exported functions. By default, all entries of an arguments are undefined, but each of its component can be set to a fixed value if known beforehand.
Definition at line 61 of file export_argument.hpp.
ExportArgument::ExportArgument | ( | ) |
Default constructor.
Definition at line 47 of file export_argument.cpp.
ExportArgument::ExportArgument | ( | const std::string & | _name, |
uint | _nRows = 1 , |
||
uint | _nCols = 1 , |
||
ExportType | _type = REAL , |
||
ExportStruct | _dataStruct = ACADO_LOCAL , |
||
bool | _callByValue = false , |
||
const ExportIndex & | _addressIdx = emptyConstExportIndex , |
||
const std::string & | _prefix = std::string() |
||
) |
Constructor which takes the name, type and dimensions of the argument.
[in] | _name | Name of the argument. |
[in] | _nRows | Number of rows of the argument. |
[in] | _nCols | Number of columns of the argument. |
[in] | _type | Data type of the argument. |
[in] | _dataStruct | Global data struct to which the argument belongs to (if any). |
[in] | _callByValue | Flag indicating whether argument it to be called by value. |
[in] | _addressIdx | If an address index is specified, not the argument itself but a pointer to this address within the memory of the argument is passed. |
Definition at line 55 of file export_argument.cpp.
ExportArgument::ExportArgument | ( | const std::string & | _name, |
const DMatrixPtr & | _data, | ||
ExportType | _type = REAL , |
||
ExportStruct | _dataStruct = ACADO_LOCAL , |
||
bool | _callByValue = false , |
||
const ExportIndex & | _addressIdx = emptyConstExportIndex , |
||
const std::string & | _prefix = std::string() |
||
) |
Constructor which takes the name and type of the argument. Moreover, it initializes the argument with the dimensions and the values of the given matrix.
[in] | _name | Name of the argument. |
[in] | _data | DMatrix used for initialization. |
[in] | _type | Data type of the argument. |
[in] | _dataStruct | Global data struct to which the argument belongs to (if any). |
[in] | _callByValue | Flag indicating whether argument it to be called by value. |
[in] | _addressIdx | If an address index is specified, not the argument itself but a pointer to this address within the memory of the argument is passed. |
Definition at line 73 of file export_argument.cpp.
ExportArgument::ExportArgument | ( | const DMatrix & | _data | ) |
Definition at line 86 of file export_argument.cpp.
returnValue ExportArgument::callByValue | ( | ) |
Specifies to call argument by value.
\return SUCCESSFUL_RETURN
Definition at line 149 of file export_argument.cpp.
|
virtual |
Exports declaration of the argument into given file. Its appearance can can be adjusted by various options.
@param[in] file Name of file to be used to export declaration. @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 ExportData.
Definition at line 156 of file export_argument.cpp.
ExportArgument ExportArgument::getAddress | ( | const ExportIndex & | _rowIdx, |
const ExportIndex & | _colIdx = emptyConstExportIndex |
||
) | const |
Returns a copy of the argument with address index set to given location.
@param[in] rowIdx Row index of the adress. @param[in] colIdx Column index of the adress. \return Copy of the argument with address index set to given location
Definition at line 103 of file export_argument.cpp.
const std::string ExportArgument::getAddressString | ( | bool | withDataStruct = true | ) | const |
Returns a string containing the address of the argument to be called. If an address index has been set, the string contains a pointer to the desired location. The string also depends on whether the argument is to be called by value or not.
Definition at line 110 of file export_argument.cpp.
|
virtual |
Returns total dimension of the argument.
\return Total dimension of the argument
Reimplemented in ExportVariable.
Definition at line 129 of file export_argument.cpp.
|
virtual |
Returns number of columns of the argument.
\return Number of columns of the argument
Reimplemented in ExportVariable.
Definition at line 123 of file export_argument.cpp.
|
virtual |
Returns number of rows of the argument.
\return Number of rows of the argument
Reimplemented in ExportVariable.
Definition at line 117 of file export_argument.cpp.
bool ExportArgument::isCalledByValue | ( | ) | const |
Returns whether argument is to be called by value.
\return true iff argument is to be called by value, \n false otherwise
Definition at line 143 of file export_argument.cpp.
|
virtual |
Returns whether all components of the argument are given.
\return true iff all components of the argument have given values, \n false otherwise
Reimplemented in ExportVariable.
Definition at line 136 of file export_argument.cpp.
ExportArgumentInternal * ExportArgument::operator-> | ( | ) |
Definition at line 93 of file export_argument.cpp.
const ExportArgumentInternal * ExportArgument::operator-> | ( | ) | const |
Definition at line 98 of file export_argument.cpp.