export_index.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
31 #ifndef ACADO_TOOLKIT_EXPORT_INDEX_HPP
32 #define ACADO_TOOLKIT_EXPORT_INDEX_HPP
33 
35 
37 
38 class ExportIndexNode;
39 class ExportArgument;
40 
54 class ExportIndex : public ExportData
55 {
56 public:
57 
58  ExportIndex();
59 
60  ExportIndex( const int _value );
61 
62  explicit ExportIndex( const std::string& _name,
63  const std::string& _prefix = std::string()
64  );
65 
67 
68  const ExportIndexNode* operator->() const;
69 
70  operator ExportArgument();
71 
72  friend ExportIndex operator+( const ExportIndex& _arg1,
73  const ExportIndex& _arg2
74  );
75 
76 
77  friend ExportIndex operator-( const ExportIndex& _arg1,
78  const ExportIndex& _arg2
79  );
80 
81 
82  friend ExportIndex operator*( const ExportIndex& _arg1,
83  const ExportIndex& _arg2
84  );
85 
86 
87  friend ExportIndex operator/( const ExportIndex& _arg1,
88  const ExportIndex& _arg2
89  );
90 
91  friend ExportIndex operator%( const ExportIndex& _arg1,
92  const ExportIndex& _arg2
93  );
94 
95  friend std::string operator==( const ExportIndex& _arg1,
96  const ExportIndex& _arg2
97  );
98 
99  virtual returnValue exportDataDeclaration( std::ostream& stream,
100  const std::string& _realString = "real_t",
101  const std::string& _intString = "int",
102  int _precision = 16
103  ) const;
104 
109  const std::string get( ) const;
110 
115  int getGivenValue( ) const;
116 
122  bool isGiven( ) const;
123 
124  bool isBinary() const;
125 
126  bool isVariable() const;
127 };
128 
130 {
131  bool operator() (const ExportIndex& val1, const ExportIndex& val2) const
132  {
133  int tmp = std::string( val1.getName() ).compare( std::string( val2.getName() ) );
134 
135  return (tmp < 0) ? true : false;
136  }
137 };
138 
139 const ExportIndex emptyConstExportIndex( int( 0 ) );
140 const ExportIndex constExportIndexValueOne( int( 1 ) );
141 
143 
144 #endif // ACADO_TOOLKIT_EXPORT_INDEX_HPP
Allows to pass back messages to the calling function.
friend ExportIndex operator*(const ExportIndex &_arg1, const ExportIndex &_arg2)
#define CLOSE_NAMESPACE_ACADO
friend ExportIndex operator+(const ExportIndex &_arg1, const ExportIndex &_arg2)
Defines a scalar-valued index variable to be used for exporting code.
const ExportIndex emptyConstExportIndex(int(0))
Defines a matrix-valued variable that can be passed as argument to exported functions.
ExportIndexNode * operator->()
virtual returnValue exportDataDeclaration(std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
bool isVariable() const
friend ExportIndex operator-(const ExportIndex &_arg1, const ExportIndex &_arg2)
bool isBinary() const
friend std::string operator==(const ExportIndex &_arg1, const ExportIndex &_arg2)
friend ExportIndex operator%(const ExportIndex &_arg1, const ExportIndex &_arg2)
int getGivenValue() const
const ExportIndex constExportIndexValueOne(int(1))
bool isGiven() const
#define BEGIN_NAMESPACE_ACADO
Abstract base class to define variables to be used for exporting code.
Definition: export_data.hpp:55
friend ExportIndex operator/(const ExportIndex &_arg1, const ExportIndex &_arg2)
std::string getName() const
Definition: export_data.cpp:86


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:34