Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00034 #ifndef ACADO_TOOLKIT_EXPORT_ARITHMETIC_STATEMENT_HPP
00035 #define ACADO_TOOLKIT_EXPORT_ARITHMETIC_STATEMENT_HPP
00036
00037 #include <acado/code_generation/export_statement.hpp>
00038 #include <acado/code_generation/export_variable.hpp>
00039 #include <acado/code_generation/memory_allocator.hpp>
00040
00041 BEGIN_NAMESPACE_ACADO
00042
00059 class ExportArithmeticStatement : public ExportStatement
00060 {
00061 friend class ExportVariable;
00062
00063
00064
00065
00066 public:
00067
00070 ExportArithmeticStatement( );
00071
00082 ExportArithmeticStatement( const ExportVariable& _lhs,
00083 ExportStatementOperator _op0,
00084 const ExportVariable& _rhs1,
00085 ExportStatementOperator _op1,
00086 const ExportVariable& _rhs2,
00087 ExportStatementOperator _op2 = ESO_UNDEFINED,
00088 const ExportVariable& _rhs3 = 0
00089 );
00090
00092 virtual ~ExportArithmeticStatement( );
00093
00098 virtual ExportStatement* clone( ) const;
00099
00110 virtual returnValue exportDataDeclaration( std::ostream& stream,
00111 const std::string& _realString = "real_t",
00112 const std::string& _intString = "int",
00113 int _precision = 16
00114 ) const;
00115
00126 virtual returnValue exportCode( std::ostream& stream,
00127 const std::string& _realString = "real_t",
00128 const std::string& _intString = "int",
00129 int _precision = 16
00130 ) const;
00131
00132 ExportArithmeticStatement& allocate( MemoryAllocatorPtr allocator );
00133
00134
00135
00136
00137 protected:
00138
00150 returnValue exportCodeAddSubtract( std::ostream& stream,
00151 const std::string& _sign = "+",
00152 const std::string& _realString = "real_t",
00153 const std::string& _intString = "int"
00154 ) const;
00155
00167 returnValue exportCodeMultiply( std::ostream& stream,
00168 bool transposeRhs1 = false,
00169 const std::string& _realString = "real_t",
00170 const std::string& _intString = "int"
00171 ) const;
00172
00184 returnValue exportCodeAssign( std::ostream& stream,
00185 const std::string& _op = "=",
00186 const std::string& _realString = "real_t",
00187 const std::string& _intString = "int"
00188 ) const;
00189
00190
00191 protected:
00192
00193
00194 ExportVariable lhs;
00195 ExportVariable rhs1;
00196 ExportVariable rhs2;
00197 ExportVariable rhs3;
00199 ExportStatementOperator op0;
00200 ExportStatementOperator op1;
00201 ExportStatementOperator op2;
00203 MemoryAllocatorPtr memAllocator;
00204
00205 private:
00206 std::string getAssignString( ) const;
00207
00208 uint getNumRows( ) const;
00209 uint getNumCols( ) const;
00210 };
00211
00212
00213 CLOSE_NAMESPACE_ACADO
00214
00215
00216 #endif // ACADO_TOOLKIT_EXPORT_ARITHMETIC_STATEMENT_HPP
00217
00218