export_arithmetic_statement.hpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
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     // PUBLIC MEMBER FUNCTIONS:
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     // PROTECTED MEMBER FUNCTIONS:
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                 // Refactor this guys as shared pointers
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 // end of file.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:37:01