export_argument.cpp
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 #include <acado/code_generation/export_index.hpp>
00035 #include <acado/code_generation/export_argument.hpp>
00036 #include <acado/code_generation/export_argument_internal.hpp>
00037 
00038 
00039 BEGIN_NAMESPACE_ACADO
00040 
00041 static const double undefinedEntry = 1073741824.03125; // = 2^30 + 2^-5
00042 
00043 //
00044 // PUBLIC MEMBER FUNCTIONS:
00045 //
00046 
00047 ExportArgument::ExportArgument( )
00048 {
00049         DMatrix m(0, 0);
00050         assignNode(new ExportArgumentInternal(
00051                                 "defaultArgumentName", DMatrixPtr(new DMatrix( m )), REAL, ACADO_LOCAL, false, 0, ""));
00052 }
00053 
00054 
00055 ExportArgument::ExportArgument( const std::string& _name,
00056                                                                 uint _nRows,
00057                                                                 uint _nCols,
00058                                                                 ExportType _type,
00059                                                                 ExportStruct _dataStruct,
00060                                                                 bool _callItByValue,
00061                                                                 const ExportIndex& _addressIdx,
00062                                                                 const std::string& _prefix
00063                                                                 )
00064 {
00065         DMatrix m(_nRows, _nCols);
00066         m.setAll( undefinedEntry );
00067 
00068         assignNode(new ExportArgumentInternal(
00069                         _name, DMatrixPtr(new DMatrix( m )), _type, _dataStruct, _callItByValue, _addressIdx, _prefix));
00070 }
00071 
00072 
00073 ExportArgument::ExportArgument( const std::string& _name,
00074                                                                 const DMatrixPtr& _data,
00075                                                                 ExportType _type,
00076                                                                 ExportStruct _dataStruct,
00077                                                                 bool _callItByValue,
00078                                                                 const ExportIndex& _addressIdx,
00079                                                                 const std::string& _prefix
00080                                                                 )
00081 {
00082         assignNode(new ExportArgumentInternal(
00083                         _name, _data, _type, _dataStruct, _callItByValue, _addressIdx, _prefix));
00084 }
00085 
00086 ExportArgument::ExportArgument( const DMatrix& _data
00087                                                                 )
00088 {
00089         assignNode(new ExportArgumentInternal(
00090                         "defaultArgumentName", DMatrixPtr(new DMatrix( _data )), REAL, ACADO_LOCAL, false, 0, ""));
00091 }
00092 
00093 ExportArgumentInternal* ExportArgument::operator->()
00094 {
00095         return (ExportArgumentInternal*)(ExportData::operator->());
00096 }
00097 
00098 const ExportArgumentInternal* ExportArgument::operator->() const
00099 {
00100         return (const ExportArgumentInternal*)(ExportData::operator->());
00101 }
00102 
00103 ExportArgument ExportArgument::getAddress(      const ExportIndex& _rowIdx,
00104                                                                                         const ExportIndex& _colIdx
00105                                                                                         ) const
00106 {
00107         return (*this)->getAddress(_rowIdx, _colIdx);
00108 }
00109 
00110 const std::string ExportArgument::getAddressString(     bool withDataStruct
00111                                                                                                         ) const
00112 {
00113         return (*this)->getAddressString( withDataStruct );
00114 }
00115 
00116 
00117 uint ExportArgument::getNumRows( ) const
00118 {
00119         return (*this)->getNumRows();
00120 }
00121 
00122 
00123 uint ExportArgument::getNumCols( ) const
00124 {
00125         return (*this)->getNumCols();
00126 }
00127 
00128 
00129 uint ExportArgument::getDim( ) const
00130 {
00131         return (*this)->getDim();
00132 }
00133 
00134 
00135 
00136 bool ExportArgument::isGiven( ) const
00137 {
00138         return (*this)->isGiven();
00139 }
00140 
00141 
00142 
00143 bool ExportArgument::isCalledByValue( ) const
00144 {
00145         return (*this)->isCalledByValue();
00146 }
00147 
00148 
00149 returnValue ExportArgument::callByValue( )
00150 {
00151         return (*this)->callByValue();
00152 }
00153 
00154 
00155 
00156 returnValue ExportArgument::exportDataDeclaration(      std::ostream& stream,
00157                                                                                                         const std::string& _realString,
00158                                                                                                         const std::string& _intString,
00159                                                                                                         int _precision
00160                                                                                                         ) const
00161 {
00162         return (*this)->exportDataDeclaration(stream, _realString, _intString, _precision);
00163 }
00164 
00165 CLOSE_NAMESPACE_ACADO
00166 
00167 // end of file.


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