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
00035 #ifndef ACADO_TOOLKIT_EXPORT_FOR_LOOP_HPP
00036 #define ACADO_TOOLKIT_EXPORT_FOR_LOOP_HPP
00037
00038
00039 #include <acado/utils/acado_utils.hpp>
00040 #include <acado/code_generation/export_index.hpp>
00041 #include <acado/code_generation/export_statement_block.hpp>
00042
00043
00044 BEGIN_NAMESPACE_ACADO
00045
00046
00056 class ExportForLoop : public ExportStatementBlock
00057 {
00058
00059
00060
00061 public:
00062
00072 ExportForLoop( const ExportIndex& _loopVariable = emptyConstExportIndex,
00073 const ExportIndex& _startValue = emptyConstExportIndex,
00074 const ExportIndex& _finalValue = emptyConstExportIndex,
00075 const ExportIndex& _increment = constExportIndexValueOne,
00076 bool _doLoopUnrolling = false
00077 );
00078
00083 ExportForLoop( const ExportForLoop& arg
00084 );
00085
00088 virtual ~ExportForLoop( );
00089
00094 ExportForLoop& operator=( const ExportForLoop& arg
00095 );
00096
00101 virtual ExportStatement* clone( ) const;
00102
00111 returnValue init( const ExportIndex& _loopVariable,
00112 const ExportIndex& _startValue,
00113 const ExportIndex& _finalValue,
00114 const ExportIndex& _increment,
00115 bool _doLoopUnrolling
00116 );
00117
00118
00129 virtual returnValue exportDataDeclaration( std::ostream& stream,
00130 const std::string& _realString = "real_t",
00131 const std::string& _intString = "int",
00132 int _precision = 16
00133 ) const;
00134
00145 virtual returnValue exportCode( std::ostream& stream,
00146 const std::string& _realString = "real_t",
00147 const std::string& _intString = "int",
00148 int _precision = 16
00149 ) const;
00150
00151
00156 ExportForLoop& unrollLoop( );
00157
00162 ExportForLoop& keepLoop( );
00163
00164 ExportForLoop& allocate(MemoryAllocatorPtr allocator);
00165
00166
00167
00168
00169
00170 protected:
00171
00176 returnValue clear( );
00177
00178 private:
00179
00180 returnValue sanityCheck( void ) const;
00181
00182
00183
00184
00185 protected:
00186
00187 ExportIndex loopVariable;
00188 ExportIndex startValue;
00189 ExportIndex finalValue;
00190 ExportIndex increment;
00192 bool doLoopUnrolling;
00193 };
00194
00195
00196 CLOSE_NAMESPACE_ACADO
00197
00198
00199
00200 #endif // ACADO_TOOLKIT_EXPORT_FOR_LOOP_HPP
00201
00202
00203
00204
00205