Line data Source code
1 : /*
2 : * Copyright (c) 2010-2015: G-CSC, Goethe University Frankfurt
3 : * Author: Sebastian Reiter, Andreas Vogel
4 : *
5 : * This file is part of UG4.
6 : *
7 : * UG4 is free software: you can redistribute it and/or modify it under the
8 : * terms of the GNU Lesser General Public License version 3 (as published by the
9 : * Free Software Foundation) with the following additional attribution
10 : * requirements (according to LGPL/GPL v3 §7):
11 : *
12 : * (1) The following notice must be displayed in the Appropriate Legal Notices
13 : * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14 : *
15 : * (2) The following notice must be displayed at a prominent place in the
16 : * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17 : *
18 : * (3) The following bibliography is recommended for citation and must be
19 : * preserved in all covered files:
20 : * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21 : * parallel geometric multigrid solver on hierarchically distributed grids.
22 : * Computing and visualization in science 16, 4 (2013), 151-164"
23 : * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24 : * flexible software system for simulating pde based models on high performance
25 : * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26 : *
27 : * This program is distributed in the hope that it will be useful,
28 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 : * GNU Lesser General Public License for more details.
31 : */
32 :
33 : #include <cstring>
34 : #include "class_name_provider.h"
35 : #include "function_traits.h"
36 : #include "common/common.h"
37 : #include "common/util/smart_pointer.h"
38 : #include "common/util/variant.h"
39 : #ifdef UG_FOR_LUA
40 : #include "bindings/lua/lua_function_handle.h"
41 : #endif
42 :
43 : #ifndef __H__UG_BRIDGE__PARAMETER_STACK__
44 : #define __H__UG_BRIDGE__PARAMETER_STACK__
45 :
46 : #include <iostream>
47 : #define untested() ( std::cerr << "@@#\n@@@:"<< __FILE__ << ":"<< __LINE__ \
48 : <<":" << __func__ << "\n" )
49 :
50 : namespace ug
51 : {
52 : namespace bridge
53 : {
54 :
55 : /// \addtogroup registry
56 : /// \{
57 :
58 : /// a stack holding parameter infos about a parameter stack
59 : /**
60 : * This class is used to store type informations about the entries in a parameter
61 : * list.
62 : *
63 : * Note that the maximal number of parameters is specified by the constant
64 : * PARAMETER_STACK_MAX_SIZE. Please note, that this value should not be
65 : * unnecessarily high. The appropriate choice is UG_REGISTRY_MAX_NUM_ARGS,
66 : * since the template-method-wrappers can't take any more parameters.
67 : *
68 : * Supported types are bool, integer, number, const char*, std::string,
69 : * reference, pointer and smart-pointer. References and pointers are stored in
70 : * a void*. The user is responsible to associate the correct types.
71 : */
72 : class ParameterInfo
73 : {
74 : protected:
75 : /// maximal number of parameter in a parameter list
76 : static const int PARAMETER_STACK_MAX_SIZE = UG_REGISTRY_MAX_NUM_ARGS;
77 :
78 : /// help function to compute correct parameter index
79 0 : static inline int ARRAY_INDEX_TO_STACK_INDEX(int index, int stackSize)
80 : {
81 : int nIndex = index;
82 0 : if(nIndex < 0)
83 0 : nIndex = stackSize + nIndex;
84 :
85 0 : if(nIndex < 0 || nIndex >= stackSize)
86 0 : UG_THROW("Invalid index "<<nIndex<<" used in Parameter Stack.");
87 :
88 0 : return nIndex;
89 : }
90 :
91 : public:
92 : /// default constructor
93 172876 : ParameterInfo() : m_numEntries(0) {}
94 :
95 : ////////////////////////////////
96 : // info
97 : ////////////////////////////////
98 :
99 : /// returns number of parameters in the param stack
100 3588 : inline int size() const {return m_numEntries;}
101 :
102 : /// returns if index is a std::vector
103 : inline bool is_vector(int index) const{
104 0 : index = ARRAY_INDEX_TO_STACK_INDEX(index, m_numEntries);
105 0 : return m_vEntryType[index].bVector;
106 : }
107 :
108 : /// returns ParameterType enum of data type for a stack entry
109 : Variant::Type type(int index) const{
110 0 : index = ARRAY_INDEX_TO_STACK_INDEX(index, m_numEntries);
111 0 : return m_vEntryType[index].type;
112 : }
113 :
114 : /// returns the class name node for an element in the param stack
115 0 : const ClassNameNode* class_name_node(int index) const{
116 0 : index = ARRAY_INDEX_TO_STACK_INDEX(index, m_numEntries);
117 0 : if(m_vEntryType[index].pClassNameNode == NULL)
118 0 : UG_THROW("ClassNameNode missing in Parameter stack.");
119 0 : return m_vEntryType[index].pClassNameNode;
120 : }
121 :
122 : /// returns the class name for an element in the param stack
123 : const char* class_name(int index) const{
124 0 : return class_name_node(index)->name().c_str();
125 : }
126 :
127 : /// returns true if a parameter of the stack has been named by user
128 : bool parameter_named(int index) const{
129 0 : return class_name_node(index)->named();
130 : }
131 :
132 : ///////////////////////////////////////////////////////////////////////
133 : // push_type
134 : ///////////////////////////////////////////////////////////////////////
135 : protected:
136 : template <typename TType, typename TNode>
137 : inline void _push_type(){
138 9916 : m_vEntryType[m_numEntries].type = Variant::type<TType>();
139 9916 : m_vEntryType[m_numEntries].pClassNameNode = &ClassNameProvider<TNode>::class_name_node();
140 9916 : m_vEntryType[m_numEntries].bVector = false;
141 7691 : ++m_numEntries;
142 : }
143 :
144 : template <typename TNative>
145 : inline void _push_type(){_push_type<TNative,TNative>();}
146 :
147 : template <typename TType, typename TNode>
148 : inline void _push_vector_type(){
149 380 : m_vEntryType[m_numEntries].type = Variant::type<TType>();
150 380 : m_vEntryType[m_numEntries].pClassNameNode = &ClassNameProvider<TNode>::class_name_node();
151 380 : m_vEntryType[m_numEntries].bVector = true;
152 276 : ++m_numEntries;
153 : }
154 :
155 : template <typename TNative>
156 : inline void _push_vector_type(){_push_vector_type<TNative,TNative>();}
157 :
158 : template <typename T>
159 : struct PushType{
160 : static void push(ParameterInfo* This){
161 : T::___UG_REGISTRY_ERROR___FUNCTION_OR_METHOD_PARAMETERS_RESTRICTED_to__NATIVE_TYPES__or__POINTER_resp_SMARTPOINTER_to_registered_types____();
162 : }
163 : };
164 :
165 : public:
166 : /// pushes a type to the parameter stack
167 : template <typename T>
168 : inline void push_type(){PushType<T>::push(this);}
169 :
170 : protected:
171 : /// structure to store a data entry with additional information
172 : struct EntryType{
173 165132 : EntryType() :
174 165132 : type(Variant::VT_INVALID), pClassNameNode(NULL), bVector(false)
175 : {}
176 : Variant::Type type; //< enum ParameterTypes indicating stored type
177 : const ClassNameNode* pClassNameNode; //< class name for user defined data
178 : bool bVector; //< boolean if vector data
179 : };
180 :
181 : // This array is of fixed size, since we want to introduce a minimal
182 : // overhead during argument assignment.
183 : EntryType m_vEntryType[PARAMETER_STACK_MAX_SIZE];
184 :
185 : /// number of currently stored entries
186 : int m_numEntries;
187 : };
188 :
189 : // implementation native types
190 : template <> struct ParameterInfo::PushType<bool> {static void push(ParameterInfo* This){This->_push_type<bool>();}};
191 : template <> struct ParameterInfo::PushType<int> {static void push(ParameterInfo* This){This->_push_type<int>();}};
192 : template <> struct ParameterInfo::PushType<size_t> {static void push(ParameterInfo* This){This->_push_type<size_t>();}};
193 : template <> struct ParameterInfo::PushType<float> {static void push(ParameterInfo* This){This->_push_type<float>();}};
194 : template <> struct ParameterInfo::PushType<double> {static void push(ParameterInfo* This){This->_push_type<double>();}};
195 : template <> struct ParameterInfo::PushType<const char*> {static void push(ParameterInfo* This){This->_push_type<const char*>();}};
196 : template <> struct ParameterInfo::PushType<std::string> {static void push(ParameterInfo* This){This->_push_type<std::string>();}};
197 : template <> struct ParameterInfo::PushType<const std::string&> {static void push(ParameterInfo* This){This->_push_type<std::string>();}};
198 : #ifdef UG_FOR_LUA
199 : template <> struct ParameterInfo::PushType<LuaFunctionHandle> {static void push(ParameterInfo* This){This->_push_type<LuaFunctionHandle>();}};
200 : template <> struct ParameterInfo::PushType<LuaTableHandle> {static void push(ParameterInfo* This){ This->_push_type<LuaTableHandle>();}};
201 : #endif
202 :
203 : // implementation pointers and references to registered types
204 : template <typename TClass> struct ParameterInfo::PushType<TClass*> {static void push(ParameterInfo* This){This->_push_type<void*, TClass>();}};
205 : template <typename TClass> struct ParameterInfo::PushType<const TClass*> {static void push(ParameterInfo* This){This->_push_type<const void*, TClass>();}};
206 : template <typename TClass> struct ParameterInfo::PushType<TClass&> {static void push(ParameterInfo* This){This->_push_type<void*, TClass>();}};
207 : template <typename TClass> struct ParameterInfo::PushType<const TClass&> {static void push(ParameterInfo* This){This->_push_type<const void*, TClass>();}};
208 : template <typename TClass> struct ParameterInfo::PushType<SmartPtr<TClass> > {static void push(ParameterInfo* This){This->_push_type<SmartPtr<void>, TClass>();}};
209 : template <typename TClass> struct ParameterInfo::PushType<ConstSmartPtr<TClass> > {static void push(ParameterInfo* This){This->_push_type<ConstSmartPtr<void>, TClass>();}};
210 :
211 : // implementation for std::vector, std::vector& and const std::vector& (native types)
212 : template <> struct ParameterInfo::PushType<std::vector<bool> > {static void push(ParameterInfo* This){This->_push_vector_type<bool>();}};
213 : template <> struct ParameterInfo::PushType<std::vector<int> > {static void push(ParameterInfo* This){This->_push_vector_type<int>();}};
214 : template <> struct ParameterInfo::PushType<std::vector<size_t> > {static void push(ParameterInfo* This){This->_push_vector_type<size_t>();}};
215 : template <> struct ParameterInfo::PushType<std::vector<float> > {static void push(ParameterInfo* This){This->_push_vector_type<float>();}};
216 : template <> struct ParameterInfo::PushType<std::vector<double> > {static void push(ParameterInfo* This){This->_push_vector_type<double>();}};
217 : template <> struct ParameterInfo::PushType<std::vector<const char*> > {static void push(ParameterInfo* This){This->_push_vector_type<const char*>();}};
218 : template <> struct ParameterInfo::PushType<std::vector<std::string> > {static void push(ParameterInfo* This){This->_push_vector_type<std::string>();}};
219 :
220 : /* Note: we do not support non-const references, since the bindings do not support the back-copy into the the binded language
221 : template <> struct ParameterInfo::PushType<std::vector<bool>&> {static void push(ParameterInfo* This){This->_push_vector_type<bool>();}};
222 : template <> struct ParameterInfo::PushType<std::vector<int>&> {static void push(ParameterInfo* This){This->_push_vector_type<int>();}};
223 : template <> struct ParameterInfo::PushType<std::vector<size_t>&> {static void push(ParameterInfo* This){This->_push_vector_type<size_t>();}};
224 : template <> struct ParameterInfo::PushType<std::vector<float>&> {static void push(ParameterInfo* This){This->_push_vector_type<float>();}};
225 : template <> struct ParameterInfo::PushType<std::vector<double>&> {static void push(ParameterInfo* This){This->_push_vector_type<double>();}};
226 : template <> struct ParameterInfo::PushType<std::vector<const char*>&> {static void push(ParameterInfo* This){This->_push_vector_type<const char*>();}};
227 : template <> struct ParameterInfo::PushType<std::vector<std::string>&> {static void push(ParameterInfo* This){This->_push_vector_type<std::string>();}};
228 : */
229 :
230 : template <> struct ParameterInfo::PushType<const std::vector<bool>&> {static void push(ParameterInfo* This){This->_push_vector_type<bool>();}};
231 : template <> struct ParameterInfo::PushType<const std::vector<int>&> {static void push(ParameterInfo* This){This->_push_vector_type<int>();}};
232 : template <> struct ParameterInfo::PushType<const std::vector<size_t>&> {static void push(ParameterInfo* This){This->_push_vector_type<size_t>();}};
233 : template <> struct ParameterInfo::PushType<const std::vector<float>&> {static void push(ParameterInfo* This){This->_push_vector_type<float>();}};
234 : template <> struct ParameterInfo::PushType<const std::vector<double>&> {static void push(ParameterInfo* This){This->_push_vector_type<double>();}};
235 : template <> struct ParameterInfo::PushType<const std::vector<const char*>&> {static void push(ParameterInfo* This){This->_push_vector_type<const char*>();}};
236 : template <> struct ParameterInfo::PushType<const std::vector<std::string>&> {static void push(ParameterInfo* This){This->_push_vector_type<std::string>();}};
237 :
238 : // implementation for std::vector, std::vector& and const std::vector& (registered types)
239 : template <typename TClass> struct ParameterInfo::PushType<std::vector<TClass*> > {static void push(ParameterInfo* This){This->_push_vector_type<void*, TClass>();}};
240 : //template <typename TClass> struct ParameterInfo::PushType<std::vector<TClass*>& > {static void push(ParameterInfo* This){This->_push_vector_type<void*, TClass>();}};
241 : template <typename TClass> struct ParameterInfo::PushType<const std::vector<TClass*>&> {static void push(ParameterInfo* This){This->_push_vector_type<void*, TClass>();}};
242 :
243 : template <typename TClass> struct ParameterInfo::PushType<std::vector<const TClass*> > {static void push(ParameterInfo* This){This->_push_vector_type<const void*, TClass>();}};
244 : //template <typename TClass> struct ParameterInfo::PushType<std::vector<const TClass*>& > {static void push(ParameterInfo* This){This->_push_vector_type<const void*, TClass>();}};
245 : template <typename TClass> struct ParameterInfo::PushType<const std::vector<const TClass*>&> {static void push(ParameterInfo* This){This->_push_vector_type<const void*, TClass>();}};
246 :
247 : template <typename TClass> struct ParameterInfo::PushType<std::vector<SmartPtr<TClass> > > {static void push(ParameterInfo* This){This->_push_vector_type<SmartPtr<void>, TClass>();}};
248 : //template <typename TClass> struct ParameterInfo::PushType<std::vector<SmartPtr<TClass> >& > {static void push(ParameterInfo* This){This->_push_vector_type<SmartPtr<void>, TClass>();}};
249 : template <typename TClass> struct ParameterInfo::PushType<const std::vector<SmartPtr<TClass> >&> {static void push(ParameterInfo* This){This->_push_vector_type<SmartPtr<void>, TClass>();}};
250 :
251 : template <typename TClass> struct ParameterInfo::PushType<std::vector<ConstSmartPtr<TClass> > > {static void push(ParameterInfo* This){This->_push_vector_type<ConstSmartPtr<void>, TClass>();}};
252 : //template <typename TClass> struct ParameterInfo::PushType<std::vector<ConstSmartPtr<TClass> >& > {static void push(ParameterInfo* This){This->_push_vector_type<ConstSmartPtr<void>, TClass>();}};
253 : template <typename TClass> struct ParameterInfo::PushType<const std::vector<ConstSmartPtr<TClass> >&> {static void push(ParameterInfo* This){This->_push_vector_type<ConstSmartPtr<void>, TClass>();}};
254 :
255 :
256 : ////////////////////////////////////////////////////////////////////////
257 : /// A stack that can hold values together with their type-id.
258 : /**
259 : * This class is mainly used as an intermediate parameter storage during
260 : * calls to ugbridge methods. Its focus is on being lightweight and fast.
261 : *
262 : * Use push() to add new parameters to the stack.
263 : * Use to() to retrieve a value.
264 : * Use set() to set a value in an existing entry.
265 : *
266 : * Indices start with 0. Negative indices can be used to start indexing from
267 : * the top of the stack.
268 : */
269 : class ParameterStack : public ParameterInfo
270 : {
271 :
272 : ///////////////////////////////////////////////////////////////////////
273 : // push
274 : ///////////////////////////////////////////////////////////////////////
275 : protected:
276 : /**
277 : * pushes a native type or a ptr/smartptr to a registered type to
278 : * the stack. The value is stored in a Variant (thus, ptr are stored
279 : * as void*, const void*, SmartPtr<void>, ConstSmartPtr<void>)
280 : *
281 : * @param val the parameter to push
282 : */
283 : template <typename T>
284 0 : inline void _push_native(const T& val){
285 : this->push_type<T>();
286 0 : m_vEntry[m_numEntries-1] = Variant(val);
287 0 : }
288 :
289 : template <typename TPtr, typename TType>
290 0 : inline void _push_pointer(TPtr val){
291 : this->push_type<TType>();
292 0 : m_vEntry[m_numEntries-1] = Variant(val);
293 0 : }
294 :
295 : /**
296 : * pushes a native type to a ptr/smartptr. In order to keep track of the
297 : * concrete type of the object, the classNameNode is stored as well
298 : *
299 : * @param val the value to push
300 : * @param classNameNode the values classNameNode
301 : * \tparam void-ptr-type (one of void*, const void*, SmartPtr<void>, ConstSmartPtr<void>)
302 : */
303 : template <typename T>
304 0 : inline void _push_void_pointer(T val, const ClassNameNode* classNameNode){
305 0 : m_vEntry[m_numEntries] = Variant(val);
306 0 : m_vEntryType[m_numEntries].type = Variant::type<T>();
307 0 : m_vEntryType[m_numEntries].pClassNameNode = classNameNode;
308 0 : m_vEntryType[m_numEntries].bVector = false;
309 0 : ++m_numEntries;
310 0 : }
311 :
312 : /**
313 : * pushes an std::vector to the stack, holding native type entries.
314 : *
315 : * @param spVec a smart-ptr to the std::vector
316 : */
317 : template<class T>
318 0 : inline void _push_vector(SmartPtr<std::vector<T> > spVec)
319 : {
320 : this->push_type<std::vector<T> >();
321 : SmartPtr<void> sp = spVec;
322 0 : m_vEntry[m_numEntries-1] = Variant(sp);
323 0 : }
324 :
325 : /**
326 : * pushes an std::vector to the stack, holding ptr/smartptr to
327 : * user-defined (registered) type. Ptrs are casted to void, and in order
328 : * to get the concrete type (for casting back), the ClassNameNode is
329 : * stored.
330 : *
331 : * @param spVec a smart-ptr to the std::vector
332 : * \tparam void-ptr-type (one of void*, const void*, SmartPtr<void>, ConstSmartPtr<void>)
333 : */
334 : template <typename TVoid>
335 0 : inline void _push_void_pointer_vector(SmartPtr<std::vector<std::pair<TVoid, const ClassNameNode*> > > spVec,
336 : const ClassNameNode* baseNameNode = NULL){
337 : SmartPtr<void> sp = spVec;
338 0 : m_vEntry[m_numEntries] = Variant(sp);
339 0 : m_vEntryType[m_numEntries].type = Variant::type<TVoid>();
340 0 : m_vEntryType[m_numEntries].pClassNameNode = baseNameNode;
341 0 : m_vEntryType[m_numEntries].bVector = true;
342 0 : ++m_numEntries;
343 0 : }
344 :
345 : /**
346 : * pushes an std::vector to the stack, holding ptr/smartptr to
347 : * user-defined (registered) type. Ptrs are casted to void, and in order
348 : * to get the concrete type (for casting back), the ClassNameNode is
349 : * stored.
350 : *
351 : * @param spVec a smart-ptr to the std::vector
352 : */
353 : template <typename TVoid, typename TPtr, typename TNode>
354 0 : inline void _push_pointer_vector(const std::vector<TPtr>& vec){
355 : SmartPtr<std::vector<std::pair<TVoid, const ClassNameNode*> > > spVec
356 0 : = SmartPtr<std::vector<std::pair<TVoid, const ClassNameNode*> > >(new std::vector<std::pair<TVoid, const ClassNameNode*> >());
357 :
358 0 : for(size_t i = 0; i < vec.size(); ++i){
359 0 : spVec->push_back(std::pair<TVoid, const ClassNameNode*>(vec[i], &ClassNameProvider<TNode>::class_name_node()));
360 : }
361 0 : _push_void_pointer_vector(spVec, &ClassNameProvider<TNode>::class_name_node());
362 0 : }
363 :
364 : public:
365 : /// push user defined classes casted to void
366 : /// \{
367 0 : inline void push(void* ptr, const ClassNameNode* classNameNode){_push_void_pointer<void*>(ptr, classNameNode);}
368 0 : inline void push(const void* ptr, const ClassNameNode* classNameNode){_push_void_pointer<const void*>(ptr, classNameNode);}
369 0 : inline void push(SmartPtr<void> ptr, const ClassNameNode* classNameNode){_push_void_pointer<SmartPtr<void> >(ptr, classNameNode);}
370 0 : inline void push(ConstSmartPtr<void> ptr, const ClassNameNode* classNameNode){_push_void_pointer<ConstSmartPtr<void> >(ptr, classNameNode);}
371 : /// \}
372 :
373 : /// push array type
374 : /// \{
375 0 : inline void push(SmartPtr<std::vector<std::pair<void*, const ClassNameNode*> > > spVec){_push_void_pointer_vector<void*>(spVec);}
376 0 : inline void push(SmartPtr<std::vector<std::pair<const void*, const ClassNameNode*> > > spVec){_push_void_pointer_vector<const void*>(spVec);}
377 0 : inline void push(SmartPtr<std::vector<std::pair<SmartPtr<void>, const ClassNameNode*> > > spVec){_push_void_pointer_vector<SmartPtr<void> >(spVec);}
378 0 : inline void push(SmartPtr<std::vector<std::pair<ConstSmartPtr<void>, const ClassNameNode*> > > spVec){_push_void_pointer_vector<ConstSmartPtr<void> >(spVec);}
379 : /// \}
380 :
381 : /// push native array type
382 : /// \{
383 0 : inline void push(SmartPtr<std::vector<bool> > spVec){_push_vector<bool>(spVec);}
384 0 : inline void push(SmartPtr<std::vector<size_t> > spVec){_push_vector<size_t>(spVec);}
385 0 : inline void push(SmartPtr<std::vector<int> > spVec){_push_vector<int>(spVec);}
386 0 : inline void push(SmartPtr<std::vector<float> > spVec){_push_vector<float>(spVec);}
387 0 : inline void push(SmartPtr<std::vector<double> > spVec){_push_vector<double>(spVec);}
388 0 : inline void push(SmartPtr<std::vector<const char*> > spVec){_push_vector<const char*>(spVec);}
389 0 : inline void push(SmartPtr<std::vector<std::string> > spVec){_push_vector<std::string>(spVec);}
390 : /// \}
391 :
392 : protected:
393 : template <typename T>
394 : struct PushType{
395 : static void push(ParameterStack* This, T data){
396 : T::___UG_REGISTRY_ERROR___FUNCTION_OR_METHOD_PARAMETERS_RESTRICTED_to__NATIVE_TYPES__or__POINTER_resp_SMARTPOINTER_to_registered_types____();
397 : }};
398 :
399 : public:
400 : /// return element in param stack casted to type
401 : template <typename T>
402 0 : inline void push(T data) {PushType<T>::push(this, data);}
403 :
404 : ///////////////////////////////////////////////////////////////////////
405 : // to
406 : ///////////////////////////////////////////////////////////////////////
407 : protected:
408 : /// return element in param stack casted to native type
409 : template <typename T>
410 0 : inline T _to_native(int index) const{
411 0 : index = ARRAY_INDEX_TO_STACK_INDEX(index, m_numEntries);
412 0 : return m_vEntry[index].to<T>();
413 : }
414 :
415 : /// returns element in param stack casted to pointer type
416 : /**
417 : * returns the element at index in the stack casted to a pointer type
418 : *
419 : * @param index the stack index
420 : * @return the casted pointer
421 : * \tparam TPtr concrete pointer type
422 : * \tparam TVoid ptr-type (one of void*, const void*, SmartPtr<void>, ConstSmartPtr<void>)
423 : */
424 : template <typename T, typename TPtr, typename TVoid>
425 0 : inline TPtr _to_pointer(int index) const{
426 0 : index = ARRAY_INDEX_TO_STACK_INDEX(index, m_numEntries);
427 0 : const ClassNameNode* pClassNameNode = m_vEntryType[index].pClassNameNode;
428 0 : TPtr ptr = ClassCastProvider::cast_to<T>(m_vEntry[index].to<TVoid>(), pClassNameNode);
429 0 : return ptr;
430 : }
431 :
432 : /// return element in param stack casted to native type vector
433 : template <typename T>
434 0 : inline std::vector<T>& _to_native_vector(int index) const{
435 0 : index = ARRAY_INDEX_TO_STACK_INDEX(index, m_numEntries);
436 0 : SmartPtr<void> smartPtr = m_vEntry[index].to<SmartPtr<void> >();
437 : SmartPtr<std::vector<T> > spVec = smartPtr.cast_reinterpret<std::vector<T>, FreeDelete>();
438 0 : if(spVec.invalid()) UG_THROW("Cannot cast back to std::vector<T> for native type.");
439 0 : return *spVec;
440 : }
441 :
442 : /// return element in param stack casted to native type vector
443 : template <typename T, typename TPtr, typename TVoid>
444 0 : inline std::vector<TPtr>& _to_pointer_vector(int index) const{
445 0 : index = ARRAY_INDEX_TO_STACK_INDEX(index, m_numEntries);
446 0 : SmartPtr<void> smartPtr = m_vEntry[index].to<SmartPtr<void> >();
447 : SmartPtr<std::vector<std::pair<TVoid, const ClassNameNode*> > > spVec = smartPtr.cast_reinterpret<std::vector<std::pair<TVoid, const ClassNameNode*> > , FreeDelete>();
448 0 : if(spVec.invalid()) UG_THROW("Cannot cast back to std::vector<T> for native type.");
449 :
450 0 : SmartPtr<std::vector<TPtr> > sp = SmartPtr<std::vector<TPtr> >(new std::vector<TPtr>());
451 :
452 0 : for(size_t i = 0; i < spVec->size(); ++i){
453 0 : sp->push_back(ClassCastProvider::cast_to<T>((*spVec)[i].first, (*spVec)[i].second));
454 : }
455 :
456 0 : const_cast<std::vector<SmartPtr<void> >*>(&m_vStoredSmartPtr)->push_back(sp);
457 0 : return *sp;
458 : }
459 : std::vector<SmartPtr<void> > m_vStoredSmartPtr;
460 :
461 : /// return element in param stack casted to native type vector
462 : template <typename TPtr>
463 0 : inline SmartPtr<std::vector<std::pair<TPtr, const ClassNameNode*> > > _to_void_pointer_vector(int index) const{
464 0 : index = ARRAY_INDEX_TO_STACK_INDEX(index, m_numEntries);
465 0 : SmartPtr<void> smartPtr = m_vEntry[index].to<SmartPtr<void> >();
466 : SmartPtr<std::vector<std::pair<TPtr, const ClassNameNode*> > > spVec = smartPtr.cast_reinterpret<std::vector<std::pair<TPtr, const ClassNameNode*> > , FreeDelete>();
467 0 : if(spVec.invalid()) UG_THROW("Cannot cast back to std::vector<T> for native type.");
468 :
469 0 : return spVec;
470 : }
471 :
472 : template <typename T>
473 : struct ToType{
474 : static T to(const ParameterStack* This, int index){
475 : return T::___UG_REGISTRY_ERROR___FUNCTION_OR_METHOD_PARAMETERS_RESTRICTED_to__NATIVE_TYPES__or__POINTER_resp_SMARTPOINTER_to_registered_types____();
476 : }};
477 :
478 : public:
479 : /// return element in param stack casted to type
480 : template <typename T>
481 0 : inline T to(int index) const {return ToType<T>::to(this, index);}
482 :
483 : /// return element in param stack as plain variant
484 : const Variant& get(int index) const {return m_vEntry[index];}
485 :
486 : private:
487 : /// fixed size array storing the data for a stack entry
488 : Variant m_vEntry[PARAMETER_STACK_MAX_SIZE];
489 : };
490 :
491 : ////////////////////////////////////////////////////////////////////////////////
492 : // PushType
493 : ////////////////////////////////////////////////////////////////////////////////
494 :
495 : // convert to native types
496 0 : template <> struct ParameterStack::PushType<bool> {static void push(ParameterStack* This, bool data) {This->_push_native<bool>(data);}};
497 0 : template <> struct ParameterStack::PushType<int> {static void push(ParameterStack* This, int data) {This->_push_native<int>(data);}};
498 0 : template <> struct ParameterStack::PushType<size_t> {static void push(ParameterStack* This, size_t data) {This->_push_native<size_t>(data);}};
499 0 : template <> struct ParameterStack::PushType<float> {static void push(ParameterStack* This, float data) {This->_push_native<float>(data);}};
500 0 : template <> struct ParameterStack::PushType<double> {static void push(ParameterStack* This, double data) {This->_push_native<double>(data);}};
501 0 : template <> struct ParameterStack::PushType<const char*> {static void push(ParameterStack* This, const char* data) {This->_push_native<const char*>(data);}};
502 0 : template <> struct ParameterStack::PushType<std::string> {static void push(ParameterStack* This, std::string data){This->_push_native<std::string>(data);}};
503 0 : template <> struct ParameterStack::PushType<const std::string&> {static void push(ParameterStack* This, const std::string& data){This->_push_native<std::string>(data);}};
504 : #ifdef UG_FOR_LUA
505 0 : template <> struct ParameterStack::PushType<LuaFunctionHandle> {static void push(ParameterStack* This, LuaFunctionHandle data) {This->_push_native<LuaFunctionHandle>(data);}};
506 0 : template <> struct ParameterStack::PushType<LuaTableHandle> {static void push(ParameterStack* This, LuaTableHandle data) {This->_push_native<LuaTableHandle>(data);}};
507 : #endif
508 :
509 : // convert pointers to native types
510 : template <> struct ParameterStack::PushType<std::vector<bool> > {static void push(ParameterStack* This, const std::vector<bool>& spVec) {This->push(SmartPtr<std::vector<bool> >(new std::vector<bool>(spVec)));}};
511 0 : template <> struct ParameterStack::PushType<std::vector<int> > {static void push(ParameterStack* This, const std::vector<int>& spVec) {This->push(SmartPtr<std::vector<int> >(new std::vector<int>(spVec)));}};
512 : template <> struct ParameterStack::PushType<std::vector<size_t> > {static void push(ParameterStack* This, const std::vector<size_t>& spVec) {This->push(SmartPtr<std::vector<size_t> >(new std::vector<size_t>(spVec)));}};
513 : template <> struct ParameterStack::PushType<std::vector<float> > {static void push(ParameterStack* This, const std::vector<float>& spVec) {This->push(SmartPtr<std::vector<float> >(new std::vector<float>(spVec)));}};
514 0 : template <> struct ParameterStack::PushType<std::vector<double> > {static void push(ParameterStack* This, const std::vector<double>& spVec) {This->push(SmartPtr<std::vector<double> >(new std::vector<double>(spVec)));}};
515 : template <> struct ParameterStack::PushType<std::vector<const char*> > {static void push(ParameterStack* This, const std::vector<const char*>& spVec) {This->push(SmartPtr<std::vector<const char*> >(new std::vector<const char*>(spVec)));}};
516 0 : template <> struct ParameterStack::PushType<std::vector<std::string> > {static void push(ParameterStack* This, const std::vector<std::string>& spVec) {This->push(SmartPtr<std::vector<std::string> >(new std::vector<std::string>(spVec)));}};
517 :
518 : /* Note: we do not support non-const references, since the bindings do not support the back-copy into the the binded language
519 : template <> struct ParameterStack::PushType<std::vector<bool>& > {static void push(ParameterStack* This, const std::vector<bool>& spVec) {This->push(SmartPtr<std::vector<bool> >(new std::vector<bool>(spVec)));}};
520 : template <> struct ParameterStack::PushType<std::vector<int>& > {static void push(ParameterStack* This, const std::vector<int>& spVec) {This->push(SmartPtr<std::vector<int> >(new std::vector<int>(spVec)));}};
521 : template <> struct ParameterStack::PushType<std::vector<size_t>& > {static void push(ParameterStack* This, const std::vector<size_t>& spVec) {This->push(SmartPtr<std::vector<size_t> >(new std::vector<size_t>(spVec)));}};
522 : template <> struct ParameterStack::PushType<std::vector<float>& > {static void push(ParameterStack* This, const std::vector<float>& spVec) {This->push(SmartPtr<std::vector<float> >(new std::vector<float>(spVec)));}};
523 : template <> struct ParameterStack::PushType<std::vector<double>& > {static void push(ParameterStack* This, const std::vector<double>& spVec) {This->push(SmartPtr<std::vector<double> >(new std::vector<double>(spVec)));}};
524 : template <> struct ParameterStack::PushType<std::vector<const char*>& > {static void push(ParameterStack* This, const std::vector<const char*>& spVec) {This->push(SmartPtr<std::vector<const char*> >(new std::vector<const char*>(spVec)));}};
525 : template <> struct ParameterStack::PushType<std::vector<std::string>& > {static void push(ParameterStack* This, const std::vector<std::string>& spVec) {This->push(SmartPtr<std::vector<std::string> >(new std::vector<std::string>(spVec)));}};
526 : */
527 :
528 : template <> struct ParameterStack::PushType<const std::vector<bool>& > {static void push(ParameterStack* This, const std::vector<bool>& spVec) {This->push(SmartPtr<std::vector<bool> >(new std::vector<bool>(spVec)));}};
529 0 : template <> struct ParameterStack::PushType<const std::vector<int>& > {static void push(ParameterStack* This, const std::vector<int>& spVec) {This->push(SmartPtr<std::vector<int> >(new std::vector<int>(spVec)));}};
530 : template <> struct ParameterStack::PushType<const std::vector<size_t>& > {static void push(ParameterStack* This, const std::vector<size_t>& spVec) {This->push(SmartPtr<std::vector<size_t> >(new std::vector<size_t>(spVec)));}};
531 : template <> struct ParameterStack::PushType<const std::vector<float>& > {static void push(ParameterStack* This, const std::vector<float>& spVec) {This->push(SmartPtr<std::vector<float> >(new std::vector<float>(spVec)));}};
532 0 : template <> struct ParameterStack::PushType<const std::vector<double>& > {static void push(ParameterStack* This, const std::vector<double>& spVec) {This->push(SmartPtr<std::vector<double> >(new std::vector<double>(spVec)));}};
533 : template <> struct ParameterStack::PushType<const std::vector<const char*>& > {static void push(ParameterStack* This, const std::vector<const char*>& spVec) {This->push(SmartPtr<std::vector<const char*> >(new std::vector<const char*>(spVec)));}};
534 0 : template <> struct ParameterStack::PushType<const std::vector<std::string>& > {static void push(ParameterStack* This, const std::vector<std::string>& spVec) {This->push(SmartPtr<std::vector<std::string> >(new std::vector<std::string>(spVec)));}};
535 :
536 : // convert push concrete pointer types
537 0 : template <class T> struct ParameterStack::PushType<T*> {static void push(ParameterStack* This, T* data) {This->_push_pointer<void*, T*>(data);}};
538 : template <class T> struct ParameterStack::PushType<T&> {static void push(ParameterStack* This, T& data) {PushType<T*>::push(This, &data);}};
539 0 : template <class T> struct ParameterStack::PushType<const T*> {static void push(ParameterStack* This, const T* data) {This->_push_pointer<const void*, const T*>(data);}};
540 : template <class T> struct ParameterStack::PushType<const T&> {static void push(ParameterStack* This, const T& data) {PushType<const T*>::push(This, &data);}};
541 0 : template <class T> struct ParameterStack::PushType<SmartPtr<T> > {static void push(ParameterStack* This, SmartPtr<T> data) {This->_push_pointer<SmartPtr<void> , SmartPtr<T> >(data);}};
542 0 : template <class T> struct ParameterStack::PushType<ConstSmartPtr<T> > {static void push(ParameterStack* This, ConstSmartPtr<T> data) {This->_push_pointer<ConstSmartPtr<void>, ConstSmartPtr<T> >(data);}};
543 :
544 : // convert to std::vector, std::vector& and const std::vector& (registered types)
545 0 : template<class T> struct ParameterStack::PushType<std::vector<T*> > {static void push(ParameterStack* This, const std::vector<T*>& data) {This->_push_pointer_vector<void*, T*, T>(data);}};
546 : //template<class T> struct ParameterStack::PushType<std::vector<T*>& > {static void push(ParameterStack* This, const std::vector<T*>& data) {This->_push_pointer_vector<void*, T*, T>(data);}};
547 0 : template<class T> struct ParameterStack::PushType<const std::vector<T*>&> {static void push(ParameterStack* This, const std::vector<T*>& data) {This->_push_pointer_vector<void*, T*, T>(data);}};
548 :
549 0 : template<class T> struct ParameterStack::PushType<std::vector<const T*> > {static void push(ParameterStack* This, const std::vector<const T*>& data) {This->_push_pointer_vector<const void*, const T*, T>(data);}};
550 : //template<class T> struct ParameterStack::PushType<std::vector<const T*>& > {static void push(ParameterStack* This, const std::vector<const T*>& data) {This->_push_pointer_vector<const void*, const T*, T>(data);}};
551 0 : template<class T> struct ParameterStack::PushType<const std::vector<const T*>&> {static void push(ParameterStack* This, const std::vector<const T*>& data) {This->_push_pointer_vector<const void*, const T*, T>(data);}};
552 :
553 0 : template<class T> struct ParameterStack::PushType<std::vector<SmartPtr<T> > > {static void push(ParameterStack* This, const std::vector<SmartPtr<T> >& data) {This->_push_pointer_vector<SmartPtr<void>, SmartPtr<T>, T>(data);}};
554 : //template<class T> struct ParameterStack::PushType<std::vector<SmartPtr<T> >& > {static void push(ParameterStack* This, const std::vector<SmartPtr<T> >& data) {This->_push_pointer_vector<SmartPtr<void>, SmartPtr<T>, T>(data);}};
555 0 : template<class T> struct ParameterStack::PushType<const std::vector<SmartPtr<T> >&> {static void push(ParameterStack* This, const std::vector<SmartPtr<T> >& data) {This->_push_pointer_vector<SmartPtr<void>, SmartPtr<T>, T>(data);}};
556 :
557 0 : template<class T> struct ParameterStack::PushType<std::vector<ConstSmartPtr<T> > > {static void push(ParameterStack* This, const std::vector<ConstSmartPtr<T> >& data) {This->_push_pointer_vector<ConstSmartPtr<void>, ConstSmartPtr<T>, T>(data);}};
558 : //template<class T> struct ParameterStack::PushType<std::vector<ConstSmartPtr<T> >& > {static void push(ParameterStack* This, const std::vector<ConstSmartPtr<T> >& data) {This->_push_pointer_vector<ConstSmartPtr<void>, ConstSmartPtr<T>, T>(data);}};
559 0 : template<class T> struct ParameterStack::PushType<const std::vector<ConstSmartPtr<T> >&>{static void push(ParameterStack* This, const std::vector<ConstSmartPtr<T> >& data) {This->_push_pointer_vector<ConstSmartPtr<void>, ConstSmartPtr<T>, T>(data);}};
560 :
561 :
562 : ////////////////////////////////////////////////////////////////////////////////
563 : // ToType
564 : ////////////////////////////////////////////////////////////////////////////////
565 :
566 : // convert to native types
567 : template <> struct ParameterStack::ToType<bool> {static bool to(const ParameterStack* This, int index) {return This->_to_native<bool>(index);}};
568 : template <> struct ParameterStack::ToType<int> {static int to(const ParameterStack* This, int index) {return This->_to_native<int>(index);}};
569 : template <> struct ParameterStack::ToType<size_t> {static size_t to(const ParameterStack* This, int index) {return This->_to_native<size_t>(index);}};
570 : template <> struct ParameterStack::ToType<float> {static float to(const ParameterStack* This, int index) {return This->_to_native<float>(index);}};
571 : template <> struct ParameterStack::ToType<double> {static double to(const ParameterStack* This, int index) {return This->_to_native<double>(index);}};
572 : template <> struct ParameterStack::ToType<const char*> {static const char* to(const ParameterStack* This, int index) {return This->_to_native<const char*>(index);}};
573 : template <> struct ParameterStack::ToType<std::string> {static std::string to(const ParameterStack* This, int index) {return This->_to_native<std::string>(index);}};
574 : template <> struct ParameterStack::ToType<const std::string&>{static const std::string& to(const ParameterStack* This, int index) {return This->_to_native<const std::string&>(index);}};
575 : #ifdef UG_FOR_LUA
576 0 : template <> struct ParameterStack::ToType<LuaFunctionHandle> {static LuaFunctionHandle to(const ParameterStack* This, int index) {return This->_to_native<LuaFunctionHandle>(index);}};
577 : template <> struct ParameterStack::ToType<LuaTableHandle> {static LuaTableHandle to(const ParameterStack* This, int index) {return This->_to_native<LuaTableHandle>(index);}};
578 : #endif
579 :
580 : // convert to void types
581 : template <> struct ParameterStack::ToType<void*> {static void* to(const ParameterStack* This, int index) {return This->_to_native<void*>(index);}};
582 : template <> struct ParameterStack::ToType<const void*> {static const void* to(const ParameterStack* This, int index) {return This->_to_native<const void*>(index);}};
583 : template <> struct ParameterStack::ToType<SmartPtr<void> > {static SmartPtr<void> to(const ParameterStack* This, int index) {return This->_to_native<SmartPtr<void> >(index);}};
584 : template <> struct ParameterStack::ToType<ConstSmartPtr<void> > {static ConstSmartPtr<void> to(const ParameterStack* This, int index) {return This->_to_native<ConstSmartPtr<void> >(index);}};
585 :
586 : // convert to concrete pointer types
587 0 : template <class T> struct ParameterStack::ToType<T*> {static T* to(const ParameterStack* This, int index){return This->_to_pointer<T, T*, void*>(index);}};
588 : template <class T> struct ParameterStack::ToType<T&> {static T& to(const ParameterStack* This, int index){return *ToType<T*>::to(This, index);}};
589 0 : template <class T> struct ParameterStack::ToType<const T*> {static const T* to(const ParameterStack* This, int index){return This->_to_pointer<T, const T*, const void*>(index);}};
590 : template <class T> struct ParameterStack::ToType<const T&> {static const T& to(const ParameterStack* This, int index){return *ToType<const T*>::to(This, index);}};
591 0 : template <class T> struct ParameterStack::ToType<SmartPtr<T> > {static SmartPtr<T> to(const ParameterStack* This, int index){return This->_to_pointer<T, SmartPtr<T>, SmartPtr<void> >(index);}};
592 0 : template <class T> struct ParameterStack::ToType<ConstSmartPtr<T> > {static ConstSmartPtr<T> to(const ParameterStack* This, int index){return This->_to_pointer<T, ConstSmartPtr<T>, ConstSmartPtr<void> >(index);}};
593 :
594 : // convert to std::vector, std::vector& and const std::vector& (native types)
595 0 : template<> struct ParameterStack::ToType<std::vector<bool> > {static std::vector<bool> to(const ParameterStack* This, int index) {return This->_to_native_vector<bool>(index);}};
596 0 : template<> struct ParameterStack::ToType<std::vector<int> > {static std::vector<int> to(const ParameterStack* This, int index) {return This->_to_native_vector<int>(index);}};
597 0 : template<> struct ParameterStack::ToType<std::vector<size_t> > {static std::vector<size_t> to(const ParameterStack* This, int index) {return This->_to_native_vector<size_t>(index);}};
598 0 : template<> struct ParameterStack::ToType<std::vector<float> > {static std::vector<float> to(const ParameterStack* This, int index) {return This->_to_native_vector<float>(index);}};
599 0 : template<> struct ParameterStack::ToType<std::vector<double> > {static std::vector<double> to(const ParameterStack* This, int index) {return This->_to_native_vector<double>(index);}};
600 0 : template<> struct ParameterStack::ToType<std::vector<const char*> > {static std::vector<const char*> to(const ParameterStack* This, int index) {return This->_to_native_vector<const char*>(index);}};
601 0 : template<> struct ParameterStack::ToType<std::vector<std::string> > {static std::vector<std::string> to(const ParameterStack* This, int index) {return This->_to_native_vector<std::string>(index);}};
602 :
603 : /* Note: we do not support non-const references, since the bindings do not support the back-copy into the the binded language
604 : template<> struct ParameterStack::ToType<std::vector<bool>&> {static std::vector<bool>& to(const ParameterStack* This, int index) {return This->_to_native_vector<bool>(index);}};
605 : template<> struct ParameterStack::ToType<std::vector<int>&> {static std::vector<int>& to(const ParameterStack* This, int index) {return This->_to_native_vector<int>(index);}};
606 : template<> struct ParameterStack::ToType<std::vector<size_t>&> {static std::vector<size_t>& to(const ParameterStack* This, int index) {return This->_to_native_vector<size_t>(index);}};
607 : template<> struct ParameterStack::ToType<std::vector<float>&> {static std::vector<float>& to(const ParameterStack* This, int index) {return This->_to_native_vector<float>(index);}};
608 : template<> struct ParameterStack::ToType<std::vector<double>&> {static std::vector<double>& to(const ParameterStack* This, int index) {return This->_to_native_vector<double>(index);}};
609 : template<> struct ParameterStack::ToType<std::vector<const char*>&> {static std::vector<const char*>& to(const ParameterStack* This, int index) {return This->_to_native_vector<const char*>(index);}};
610 : template<> struct ParameterStack::ToType<std::vector<std::string>&> {static std::vector<std::string>& to(const ParameterStack* This, int index) {return This->_to_native_vector<std::string>(index);}};
611 : */
612 :
613 0 : template<> struct ParameterStack::ToType<const std::vector<bool>&> {static const std::vector<bool>& to(const ParameterStack* This, int index) {return This->_to_native_vector<bool>(index);}};
614 0 : template<> struct ParameterStack::ToType<const std::vector<int>&> {static const std::vector<int>& to(const ParameterStack* This, int index) {return This->_to_native_vector<int>(index);}};
615 0 : template<> struct ParameterStack::ToType<const std::vector<size_t>&> {static const std::vector<size_t>& to(const ParameterStack* This, int index) {return This->_to_native_vector<size_t>(index);}};
616 0 : template<> struct ParameterStack::ToType<const std::vector<float>&> {static const std::vector<float>& to(const ParameterStack* This, int index) {return This->_to_native_vector<float>(index);}};
617 0 : template<> struct ParameterStack::ToType<const std::vector<double>&> {static const std::vector<double>& to(const ParameterStack* This, int index) {return This->_to_native_vector<double>(index);}};
618 0 : template<> struct ParameterStack::ToType<const std::vector<const char*>&> {static const std::vector<const char*>& to(const ParameterStack* This, int index) {return This->_to_native_vector<const char*>(index);}};
619 0 : template<> struct ParameterStack::ToType<const std::vector<std::string>&> {static const std::vector<std::string>& to(const ParameterStack* This, int index) {return This->_to_native_vector<std::string>(index);}};
620 :
621 : // convert to std::vector, std::vector& and const std::vector& (registered types)
622 0 : template<class T> struct ParameterStack::ToType<std::vector<T*> >{static std::vector<T*> to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, T*, void*>(index);}};
623 : //template<class T> struct ParameterStack::ToType<std::vector<T*>& >{static std::vector<T*>& to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, T*, void*>(index);}};
624 0 : template<class T> struct ParameterStack::ToType<const std::vector<T*>&>{static const std::vector<T*>& to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, T*, void*>(index);}};
625 :
626 0 : template<class T> struct ParameterStack::ToType<std::vector<const T*> >{static std::vector<const T*> to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, const T*, const void*>(index);}};
627 : //template<class T> struct ParameterStack::ToType<std::vector<const T*>& >{static std::vector<const T*>& to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, const T*, const void*>(index);}};
628 0 : template<class T> struct ParameterStack::ToType<const std::vector<const T*>&>{static const std::vector<const T*>& to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, const T*, const void*>(index);}};
629 :
630 0 : template<class T> struct ParameterStack::ToType<std::vector<SmartPtr<T> > >{static std::vector<SmartPtr<T> > to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, SmartPtr<T>, SmartPtr<void> >(index);}};
631 : //template<class T> struct ParameterStack::ToType<std::vector<SmartPtr<T> >& >{static std::vector<SmartPtr<T> >& to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, SmartPtr<T>, SmartPtr<void> >(index);}};
632 0 : template<class T> struct ParameterStack::ToType<const std::vector<SmartPtr<T> >&>{static const std::vector<SmartPtr<T> >& to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, SmartPtr<T>, SmartPtr<void> >(index);}};
633 :
634 0 : template<class T> struct ParameterStack::ToType<std::vector<ConstSmartPtr<T> > >{static std::vector<ConstSmartPtr<T> > to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, ConstSmartPtr<T>, ConstSmartPtr<void> >(index);}};
635 : //template<class T> struct ParameterStack::ToType<std::vector<ConstSmartPtr<T> >& >{static std::vector<ConstSmartPtr<T> >& to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, ConstSmartPtr<T>, ConstSmartPtr<void> >(index);}};
636 0 : template<class T> struct ParameterStack::ToType<const std::vector<ConstSmartPtr<T> >&>{static const std::vector<ConstSmartPtr<T> >& to(const ParameterStack* This, int index){return This->_to_pointer_vector<T, ConstSmartPtr<T>, ConstSmartPtr<void> >(index);}};
637 :
638 : // convert to std::vector for void pointer (registered types)
639 0 : template<> struct ParameterStack::ToType<SmartPtr<std::vector<std::pair<void*, const ClassNameNode*> > > >{static SmartPtr<std::vector<std::pair<void*, const ClassNameNode*> > > to(const ParameterStack* This, int index){return This->_to_void_pointer_vector<void*>(index);}};
640 0 : template<> struct ParameterStack::ToType<SmartPtr<std::vector<std::pair<const void*, const ClassNameNode*> > > >{static SmartPtr<std::vector<std::pair<const void*, const ClassNameNode*> > > to(const ParameterStack* This, int index){return This->_to_void_pointer_vector<const void*>(index);}};
641 0 : template<> struct ParameterStack::ToType<SmartPtr<std::vector<std::pair<SmartPtr<void>, const ClassNameNode*> > > >{static SmartPtr<std::vector<std::pair<SmartPtr<void>, const ClassNameNode*> > > to(const ParameterStack* This, int index){return This->_to_void_pointer_vector<SmartPtr<void> >(index);}};
642 0 : template<> struct ParameterStack::ToType<SmartPtr<std::vector<std::pair<ConstSmartPtr<void>, const ClassNameNode*> > > >{static SmartPtr<std::vector<std::pair<ConstSmartPtr<void>, const ClassNameNode*> > > to(const ParameterStack* This, int index){return This->_to_void_pointer_vector<ConstSmartPtr<void> >(index);}};
643 :
644 : // end group registry
645 : /// \}
646 :
647 : } // end namespace bridge
648 : } // end namespace ug
649 :
650 : #endif
|