MeVisLab Toolbox Reference
mlTypedProcessing.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2013, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_TYPED_PROCESSING_H
14#define ML_TYPED_PROCESSING_H
15
16#include "mlInitSystemML.h"
17
18#include "mlTypedHandlers.h"
19
20ML_START_NAMESPACE
21
22namespace internal
23{
24
27 template <class Processor, template <typename, int, typename> class VariableType>
28 class SingleTypeCaller : public VariableType<SingleTypeCaller<Processor, VariableType>, 0, internal::EmptyType >
29 {
30 public:
31 inline void process(int dataType, Processor& f)
32 {
33 _f = &f;
34 internal::EmptyType args;
35 this->template doSwitchingCode<internal::EmptyTypeTuple4, internal::EmptyType >(dataType, args);
36 }
37
38 template<typename Types>
39 inline void doSwitchingWithLabel(const internal::EmptyType&, internal::EmptyType*)
40 {
41 _f->template process<typename Types::T0>();
42 }
43 private:
44 Processor* _f;
45 };
46
49 template <class Processor,
50 template <typename, int, typename> class VariableType1,
51 template <typename, int, typename> class VariableType2>
53 public VariableType1<DualTypeCaller<Processor, VariableType1, VariableType2>, 0, internal::EmptyType >,
54 public VariableType2<DualTypeCaller<Processor, VariableType1, VariableType2>, 1, internal::EmptyType >
55 {
56 public:
57 inline void process(int firstDataType, int secondDataType, Processor& f)
58 {
59 _f = &f;
60 _secondDataType = secondDataType;
61 internal::EmptyType args;
62 static_cast<VariableType1<DualTypeCaller<Processor, VariableType1, VariableType2>, 0, internal::EmptyType > *>(this)->template doSwitchingCode<internal::EmptyTypeTuple4, internal::EmptyType >(firstDataType, args);
63 }
64
65 template<typename Types>
66 inline void doSwitchingWithLabel(const internal::EmptyType& args, internal::EmptyType*)
67 {
68 static_cast<VariableType2<DualTypeCaller<Processor, VariableType1, VariableType2>, 1, internal::EmptyType > *>(this)->template doSwitchingCode<Types, internal::DispatchVariableType1Label >(_secondDataType, args);
69 }
70
71 template<typename Types>
72 inline void doSwitchingWithLabel(const internal::EmptyType&, internal::DispatchVariableType1Label*)
73 {
75 }
76
77 private:
78 Processor* _f;
79 int _secondDataType;
80 };
81
82}
83
85{
92
128
129 template <template <typename, int, typename> class VariableType, class Processor>
130 static inline void call(MLDataType dataType, Processor& processor)
131 {
133 caller.process(dataType, processor);
134 }
135
142 template <template <typename, int, typename> class VariableType1,
143 template <typename, int, typename> class VariableType2,
144 class Processor>
145 static inline void call(MLDataType firstDataType, MLDataType secondDataType, Processor& processor)
146 {
148 caller.process(firstDataType, secondDataType, processor);
149 }
150}
151
152ML_END_NAMESPACE
153
154#endif
155
void process(int firstDataType, int secondDataType, Processor &f)
void doSwitchingWithLabel(const internal::EmptyType &, internal::DispatchVariableType1Label *)
void doSwitchingWithLabel(const internal::EmptyType &args, internal::EmptyType *)
void process(int dataType, Processor &f)
void doSwitchingWithLabel(const internal::EmptyType &, internal::EmptyType *)
MLint32 MLDataType
Definition mlTypeDefs.h:595
static void call(MLDataType dataType, Processor &processor)