Allows to export code of different arithmetic statements. More...
#include <export_arithmetic_statement.hpp>
Public Member Functions | |
ExportArithmeticStatement & | allocate (MemoryAllocatorPtr allocator) |
virtual ExportStatement * | clone () 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 () |
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 |
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 "-".
Definition at line 59 of file export_arithmetic_statement.hpp.
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.
[in] | _lhs | Left-hand side expressions |
[in] | _op0 | Operator between left- and right-hand side expression. |
[in] | _rhs1 | First right-hand side expression. |
[in] | _op1 | Operator between first and second right-hand side expression. |
[in] | _rhs2 | Second right-hand side expression of arithmetic statement. |
[in] | _op2 | Operator between second and third right-hand side expression. |
[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.
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).
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.
[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. |
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.
[in] | stream | Name of file to be used to export statement. |
[in] | _sign | std::string of the operation ("+" or "-"). |
[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. |
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.
[in] | stream | Name of file to be used to export statement. |
[in] | _op | std::string of the assignment operation ("=", "+=" or "-="). |
[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. |
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.
[in] | stream | Name of file to be used to export statement. |
[in] | transposeRhs1 | Flag indicating whether rhs1 shall be transposed. |
[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. |
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.
[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 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.
friend class ExportVariable [friend] |
Definition at line 61 of file export_arithmetic_statement.hpp.
ExportVariable ExportArithmeticStatement::lhs [protected] |
Left-hand side expression of arithmetic statement.
Definition at line 194 of file export_arithmetic_statement.hpp.
Definition at line 203 of file export_arithmetic_statement.hpp.
Operator between left- and right-hand side expression of arithmetic statement.
Definition at line 199 of file export_arithmetic_statement.hpp.
Operator between first and second right-hand side expression of arithmetic statement.
Definition at line 200 of file export_arithmetic_statement.hpp.
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.