export_argument_list.cpp
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 
26 
34 
35 
36 
38 
39 
40 //
41 // PUBLIC MEMBER FUNCTIONS:
42 //
43 
45 {
46  doIncludeType( );
47 }
48 
49 
51  const ExportArgument& _argument2,
52  const ExportArgument& _argument3,
53  const ExportArgument& _argument4,
54  const ExportArgument& _argument5,
55  const ExportArgument& _argument6,
56  const ExportArgument& _argument7,
57  const ExportArgument& _argument8,
58  const ExportArgument& _argument9
59  )
60 {
61  addArgument( _argument1,_argument2,_argument3,
62  _argument4,_argument5,_argument6,
63  _argument7,_argument8,_argument9 );
64 }
65 
66 
68 {
69  arguments = arg.arguments;
70 
72 }
73 
74 
76 {
77  clear( );
78 }
79 
80 
82 {
83  if ( this != &arg )
84  {
85  clear( );
86 
87  arguments = arg.arguments;
88 
90  }
91 
92  return *this;
93 }
94 
95 
96 
98  const ExportArgument& _argument2,
99  const ExportArgument& _argument3,
100  const ExportArgument& _argument4,
101  const ExportArgument& _argument5,
102  const ExportArgument& _argument6,
103  const ExportArgument& _argument7,
104  const ExportArgument& _argument8,
105  const ExportArgument& _argument9
106  )
107 {
108  addSingleArgument( _argument1 );
109  addSingleArgument( _argument2 );
110  addSingleArgument( _argument3 );
111  addSingleArgument( _argument4 );
112  addSingleArgument( _argument5 );
113  addSingleArgument( _argument6 );
114  addSingleArgument( _argument7 );
115  addSingleArgument( _argument8 );
116  addSingleArgument( _argument9 );
117 
118  return SUCCESSFUL_RETURN;
119 }
120 
121 
123 {
124  return arguments.size();
125 }
126 
127 
128 
130  const std::string& _realString,
131  const std::string& _intString,
132  int _precision
133  ) const
134 {
135  bool started = false;
136  for (unsigned i = 0; i < arguments.size(); ++i)
137  {
138  // Allow only undefined arguments and defined integer scalars
139  if ( arguments[ i ].isGiven( ) == true &&
140  (arguments[ i ].getDim() > 1 || arguments[ i ].getType() != INT) &&
141  arguments[ i ].getType() != STATIC_CONST_INT &&
142  arguments[ i ].getType() != STATIC_CONST_REAL
143  )
144  continue;
145 
146  if (i > 0 && started == true)
147  stream << ", ";
148 
149  if ( includeType == true )
150  {
151  if ( arguments[ i ].isCalledByValue( ) == true )
152  stream << arguments[ i ].getTypeString(_realString, _intString) << " ";
153  else
154  stream << arguments[ i ].getTypeString(_realString, _intString) << "* const ";
155  }
156 
157  if ( includeType == false )
158  stream << arguments[ i ].getAddressString( );
159  else
160  stream << arguments[ i ].getAddressString( false );
161 
162  started = true;
163  }
164 
165  return SUCCESSFUL_RETURN;
166 }
167 
168 
169 
171 {
172  doIncludeType( );
173 
174  return SUCCESSFUL_RETURN;
175 }
176 
177 
178 
180 {
181  includeType = true;
182  return SUCCESSFUL_RETURN;
183 }
184 
185 
187 {
188  includeType = false;
189  return SUCCESSFUL_RETURN;
190 }
191 
192 
193 
194 //
195 // PROTECTED MEMBER FUNCTIONS:
196 //
197 
199  )
200 {
201  if ( _argument.isNull() )
202  return SUCCESSFUL_RETURN;
203  if (_argument.getDim() == 0)
204  return SUCCESSFUL_RETURN;
205 
206  arguments.push_back( _argument );
207 
208  return SUCCESSFUL_RETURN;
209 }
210 
211 const std::vector< ExportArgument >& ExportArgumentList::get() const
212 {
213  return arguments;
214 }
215 
216 
218 
219 // end of file.
virtual uint getDim() const
returnValue addSingleArgument(const ExportArgument &_argument)
ExportArgumentList & operator=(const ExportArgumentList &rhs)
Allows to pass back messages to the calling function.
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
#define CLOSE_NAMESPACE_ACADO
Defines a matrix-valued variable that can be passed as argument to exported functions.
std::vector< ExportArgument > arguments
Allows to store a list of calling arguments of an ExportFunction.
const std::vector< ExportArgument > & get() const
virtual returnValue exportCode(std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
bool isNull() const
Is a null pointer?
#define BEGIN_NAMESPACE_ACADO
returnValue addArgument(const ExportArgument &_argument1, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)


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