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

Allows to export code of different arithmetic statements. More...

#include <export_arithmetic_statement.hpp>

Inheritance diagram for ExportArithmeticStatement:
Inheritance graph
[legend]

Public Member Functions

ExportArithmeticStatementallocate (MemoryAllocatorPtr allocator)
 
virtual ExportStatementclone () const
 
 ExportArithmeticStatement ()
 
 ExportArithmeticStatement (const ExportVariable &_lhs, ExportStatementOperator _op0, const ExportVariable &_rhs1, ExportStatementOperator _op1, const ExportVariable &_rhs2, ExportStatementOperator _op2=ESO_UNDEFINED, const ExportVariable &_rhs3=0)
 
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 ~ExportArithmeticStatement ()
 
- 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 exportCodeAddSubtract (std::ostream &stream, const std::string &_sign="+", const std::string &_realString="real_t", const std::string &_intString="int") const
 
returnValue exportCodeAssign (std::ostream &stream, const std::string &_op="=", const std::string &_realString="real_t", const std::string &_intString="int") const
 
returnValue exportCodeMultiply (std::ostream &stream, bool transposeRhs1=false, const std::string &_realString="real_t", const std::string &_intString="int") const
 

Protected Attributes

ExportVariable lhs
 
MemoryAllocatorPtr memAllocator
 
ExportStatementOperator op0
 
ExportStatementOperator op1
 
ExportStatementOperator op2
 
ExportVariable rhs1
 
ExportVariable rhs2
 
ExportVariable rhs3
 

Private Member Functions

std::string getAssignString () const
 
uint getNumCols () const
 
uint getNumRows () const
 

Friends

class ExportVariable
 

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 different arithmetic statements.

The class ExportArithmeticStatement allows to export code of different arithmetic statements of the form:

lhs <op0> rhs1 <op1> rhs2 <op2> rhs3,

where <op0> can be "=", "+=" or "-=", <op1> can be "+", "-" or "*" and <op2> can be "+" or "-".

Author
Hans Joachim Ferreau, Boris Houska, Milan Vukov

Definition at line 59 of file export_arithmetic_statement.hpp.

Constructor & Destructor Documentation

BEGIN_NAMESPACE_ACADO ExportArithmeticStatement::ExportArithmeticStatement ( )

Default constructor.

Definition at line 46 of file export_arithmetic_statement.cpp.

ExportArithmeticStatement::ExportArithmeticStatement ( const ExportVariable _lhs,
ExportStatementOperator  _op0,
const ExportVariable _rhs1,
ExportStatementOperator  _op1,
const ExportVariable _rhs2,
ExportStatementOperator  _op2 = ESO_UNDEFINED,
const ExportVariable _rhs3 = 0 
)

Constructor which takes all expressions and operators of the arithmetic statement.

@param[in] _lhs                     Left-hand side expressions
@param[in] _op0                     Operator between left- and right-hand side expression.
@param[in] _rhs1            First right-hand side expression.
@param[in] _op1                     Operator between first and second right-hand side expression.
@param[in] _rhs2            Second right-hand side expression of arithmetic statement.
@param[in] _op2                     Operator between second and third right-hand side expression.
@param[in] _rhs3            Third right-hand side expression.

Definition at line 53 of file export_arithmetic_statement.cpp.

ExportArithmeticStatement::~ExportArithmeticStatement ( )
virtual

Destructor.

Definition at line 75 of file export_arithmetic_statement.cpp.

Member Function Documentation

ExportArithmeticStatement & ExportArithmeticStatement::allocate ( MemoryAllocatorPtr  )
virtual

Set a memory allocator.

Reimplemented from ExportStatement.

Definition at line 660 of file export_arithmetic_statement.cpp.

ExportStatement * ExportArithmeticStatement::clone ( ) const
virtual

Clone constructor (deep copy).

\return Pointer to cloned object.

Implements ExportStatement.

Definition at line 78 of file export_arithmetic_statement.cpp.

returnValue ExportArithmeticStatement::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] 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

Implements ExportStatement.

Definition at line 118 of file export_arithmetic_statement.cpp.

returnValue ExportArithmeticStatement::exportCodeAddSubtract ( std::ostream &  stream,
const std::string &  _sign = "+",
const std::string &  _realString = "real_t",
const std::string &  _intString = "int" 
) const
protected

Exports source code for an addition or subtraction to given file. Its appearance can be adjusted by various options.

@param[in] stream                   Name of file to be used to export statement.
@param[in] _sign                    std::string of the operation ("+" or "-").
@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

Definition at line 178 of file export_arithmetic_statement.cpp.

returnValue ExportArithmeticStatement::exportCodeAssign ( std::ostream &  stream,
const std::string &  _op = "=",
const std::string &  _realString = "real_t",
const std::string &  _intString = "int" 
) const
protected

Exports source code for an assignment to given file. Its appearance can be adjusted by various options.

@param[in] stream                   Name of file to be used to export statement.
@param[in] _op                              std::string of the assignment operation ("=", "+=" or "-=").
@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

Definition at line 548 of file export_arithmetic_statement.cpp.

returnValue ExportArithmeticStatement::exportCodeMultiply ( std::ostream &  stream,
bool  transposeRhs1 = false,
const std::string &  _realString = "real_t",
const std::string &  _intString = "int" 
) const
protected

Exports source code for a multiplication to given file. Its appearance can be adjusted by various options.

@param[in] stream                   Name of file to be used to export statement.
@param[in] transposeRhs1    Flag indicating whether rhs1 shall be transposed.
@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

Definition at line 288 of file export_arithmetic_statement.cpp.

returnValue ExportArithmeticStatement::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 ExportStatement.

Definition at line 108 of file export_arithmetic_statement.cpp.

std::string ExportArithmeticStatement::getAssignString ( ) const
private

Definition at line 642 of file export_arithmetic_statement.cpp.

uint ExportArithmeticStatement::getNumCols ( ) const
private

Definition at line 96 of file export_arithmetic_statement.cpp.

uint ExportArithmeticStatement::getNumRows ( ) const
private

Definition at line 84 of file export_arithmetic_statement.cpp.

Friends And Related Function Documentation

friend class ExportVariable
friend

Definition at line 61 of file export_arithmetic_statement.hpp.

Member Data Documentation

ExportVariable ExportArithmeticStatement::lhs
protected

Left-hand side expression of arithmetic statement.

Definition at line 194 of file export_arithmetic_statement.hpp.

MemoryAllocatorPtr ExportArithmeticStatement::memAllocator
protected

Definition at line 203 of file export_arithmetic_statement.hpp.

ExportStatementOperator ExportArithmeticStatement::op0
protected

Operator between left- and right-hand side expression of arithmetic statement.

Definition at line 199 of file export_arithmetic_statement.hpp.

ExportStatementOperator ExportArithmeticStatement::op1
protected

Operator between first and second right-hand side expression of arithmetic statement.

Definition at line 200 of file export_arithmetic_statement.hpp.

ExportStatementOperator ExportArithmeticStatement::op2
protected

Operator between second and third right-hand side expression of arithmetic statement.

Definition at line 201 of file export_arithmetic_statement.hpp.

ExportVariable ExportArithmeticStatement::rhs1
protected

First right-hand side expression of arithmetic statement.

Definition at line 195 of file export_arithmetic_statement.hpp.

ExportVariable ExportArithmeticStatement::rhs2
protected

Second right-hand side expression of arithmetic statement.

Definition at line 196 of file export_arithmetic_statement.hpp.

ExportVariable ExportArithmeticStatement::rhs3
protected

Third right-hand side expression of arithmetic statement.

Definition at line 197 of file export_arithmetic_statement.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