export_index.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 
00031 #ifndef ACADO_TOOLKIT_EXPORT_INDEX_HPP
00032 #define ACADO_TOOLKIT_EXPORT_INDEX_HPP
00033 
00034 #include <acado/code_generation/export_data.hpp>
00035 
00036 BEGIN_NAMESPACE_ACADO
00037 
00038 class ExportIndexNode;
00039 class ExportArgument;
00040 
00054 class ExportIndex : public ExportData
00055 {
00056 public:
00057 
00058         ExportIndex();
00059 
00060         ExportIndex(    const int _value );
00061 
00062         explicit ExportIndex(   const std::string& _name,
00063                                                         const std::string& _prefix = std::string()
00064                                                         );
00065 
00066         ExportIndexNode* operator->();
00067 
00068         const ExportIndexNode* operator->() const;
00069 
00070         operator ExportArgument();
00071 
00072         friend ExportIndex operator+(   const ExportIndex& _arg1,
00073                                                                         const ExportIndex& _arg2
00074                                                                         );
00075 
00076 
00077         friend ExportIndex operator-(   const ExportIndex& _arg1,
00078                                                                         const ExportIndex& _arg2
00079                                                                         );
00080 
00081 
00082         friend ExportIndex operator*(   const ExportIndex& _arg1,
00083                                                                         const ExportIndex& _arg2
00084                                                                         );
00085 
00086 
00087         friend ExportIndex operator/(   const ExportIndex& _arg1,
00088                                                                         const ExportIndex& _arg2
00089                                                                         );
00090 
00091         friend ExportIndex operator%(   const ExportIndex& _arg1,
00092                                                                         const ExportIndex& _arg2
00093                                                                         );
00094 
00095         friend std::string operator==(  const ExportIndex& _arg1,
00096                                                                         const ExportIndex& _arg2
00097                                                                         );
00098 
00099         virtual returnValue exportDataDeclaration(      std::ostream& stream,
00100                                                                                                 const std::string& _realString = "real_t",
00101                                                                                                 const std::string& _intString = "int",
00102                                                                                                 int _precision = 16
00103                                                                                                 ) const;
00104 
00109         const std::string get( ) const;
00110 
00115         int getGivenValue( ) const;
00116 
00122         bool isGiven( ) const;
00123 
00124         bool isBinary() const;
00125 
00126         bool isVariable() const;
00127 };
00128 
00129 struct ExportIndexComparator
00130 {
00131     bool operator() (const ExportIndex& val1, const ExportIndex& val2) const
00132     {
00133         int tmp = std::string( val1.getName() ).compare( std::string( val2.getName() ) );
00134 
00135         return (tmp < 0) ? true : false;
00136     }
00137 };
00138 
00139 const ExportIndex emptyConstExportIndex( int( 0 ) );
00140 const ExportIndex constExportIndexValueOne( int( 1 ) );
00141 
00142 CLOSE_NAMESPACE_ACADO
00143 
00144 #endif  // ACADO_TOOLKIT_EXPORT_INDEX_HPP


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