export_argument.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 
27 
37 
38 
40 
41 static const double undefinedEntry = 1073741824.03125; // = 2^30 + 2^-5
42 
43 //
44 // PUBLIC MEMBER FUNCTIONS:
45 //
46 
48 {
49  DMatrix m(0, 0);
51  "defaultArgumentName", DMatrixPtr(new DMatrix( m )), REAL, ACADO_LOCAL, false, 0, ""));
52 }
53 
54 
55 ExportArgument::ExportArgument( const std::string& _name,
56  uint _nRows,
57  uint _nCols,
58  ExportType _type,
59  ExportStruct _dataStruct,
60  bool _callItByValue,
61  const ExportIndex& _addressIdx,
62  const std::string& _prefix
63  )
64 {
65  DMatrix m(_nRows, _nCols);
67 
69  _name, DMatrixPtr(new DMatrix( m )), _type, _dataStruct, _callItByValue, _addressIdx, _prefix));
70 }
71 
72 
73 ExportArgument::ExportArgument( const std::string& _name,
74  const DMatrixPtr& _data,
75  ExportType _type,
76  ExportStruct _dataStruct,
77  bool _callItByValue,
78  const ExportIndex& _addressIdx,
79  const std::string& _prefix
80  )
81 {
83  _name, _data, _type, _dataStruct, _callItByValue, _addressIdx, _prefix));
84 }
85 
87  )
88 {
90  "defaultArgumentName", DMatrixPtr(new DMatrix( _data )), REAL, ACADO_LOCAL, false, 0, ""));
91 }
92 
94 {
96 }
97 
99 {
101 }
102 
104  const ExportIndex& _colIdx
105  ) const
106 {
107  return (*this)->getAddress(_rowIdx, _colIdx);
108 }
109 
110 const std::string ExportArgument::getAddressString( bool withDataStruct
111  ) const
112 {
113  return (*this)->getAddressString( withDataStruct );
114 }
115 
116 
118 {
119  return (*this)->getNumRows();
120 }
121 
122 
124 {
125  return (*this)->getNumCols();
126 }
127 
128 
130 {
131  return (*this)->getDim();
132 }
133 
134 
135 
137 {
138  return (*this)->isGiven();
139 }
140 
141 
142 
144 {
145  return (*this)->isCalledByValue();
146 }
147 
148 
150 {
151  return (*this)->callByValue();
152 }
153 
154 
155 
157  const std::string& _realString,
158  const std::string& _intString,
159  int _precision
160  ) const
161 {
162  return (*this)->exportDataDeclaration(stream, _realString, _intString, _precision);
163 }
164 
166 
167 // end of file.
void assignNode(SharedObjectNode *node)
Assign the node to a node class pointer (or null)
ExportArgument getAddress(const ExportIndex &rowIdx, const ExportIndex &colIdx=emptyConstExportIndex) const
virtual uint getDim() const
Allows to pass back messages to the calling function.
std::shared_ptr< GenericMatrix< double > > DMatrixPtr
Definition: matrix.hpp:463
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
void setAll(const T &_value)
Definition: matrix.hpp:141
virtual uint getNumCols() const
#define CLOSE_NAMESPACE_ACADO
GenericMatrix< double > DMatrix
Definition: matrix.hpp:457
Defines a scalar-valued index variable to be used for exporting code.
Defines a matrix-valued variable that can be passed as argument to exported functions.
bool isCalledByValue() const
static BEGIN_NAMESPACE_ACADO const double undefinedEntry
ExportStruct
virtual returnValue exportDataDeclaration(std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
ExportArgumentInternal * operator->()
Defines a matrix-valued variable that can be passed as argument to exported functions.
ExportType
virtual bool isGiven() const
returnValue callByValue()
ExportDataInternal * operator->()
Definition: export_data.cpp:51
#define BEGIN_NAMESPACE_ACADO
ExportArgument getAddress(const ExportIndex &_rowIdx, const ExportIndex &_colIdx=emptyConstExportIndex) const
virtual uint getNumRows() const
const std::string getAddressString(bool withDataStruct=true) const


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