ML 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
20
ML_START_NAMESPACE
21
22
namespace
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>
52
class
DualTypeCaller
:
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
{
74
_f->template process<typename Types::T0, typename Types::T1>();
75
}
76
77
private
:
78
Processor* _f;
79
int
_secondDataType;
80
};
81
82
}
83
84
namespace
TypedProcessing
85
{
92
129
template
<
template
<
typename
,
int
,
typename
>
class
VariableType
,
class
Processor>
130
static
inline
void
call(
MLDataType
dataType, Processor& processor)
131
{
132
internal::SingleTypeCaller<Processor, VariableType>
caller;
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
{
147
internal::DualTypeCaller<Processor, VariableType1, VariableType2>
caller;
148
caller.
process
(firstDataType, secondDataType, processor);
149
}
150
}
151
152
ML_END_NAMESPACE
153
154
#endif
155
ml::VariableType
Base class for all variable types, mainly for Doxygen documentation purpose.
Definition
mlTypedHandlers.h:91
ml::internal::DualTypeCaller
Internal helper class that uses VariableType1 and VariableType2 to convert two data type integers to ...
Definition
mlTypedProcessing.h:55
ml::internal::DualTypeCaller::process
void process(int firstDataType, int secondDataType, Processor &f)
Definition
mlTypedProcessing.h:57
ml::internal::DualTypeCaller::doSwitchingWithLabel
void doSwitchingWithLabel(const internal::EmptyType &, internal::DispatchVariableType1Label *)
Definition
mlTypedProcessing.h:72
ml::internal::DualTypeCaller::doSwitchingWithLabel
void doSwitchingWithLabel(const internal::EmptyType &args, internal::EmptyType *)
Definition
mlTypedProcessing.h:66
ml::internal::SingleTypeCaller
Internal helper class that uses a VariableType to convert a data type integer to the correct Processo...
Definition
mlTypedProcessing.h:29
ml::internal::SingleTypeCaller::process
void process(int dataType, Processor &f)
Definition
mlTypedProcessing.h:31
ml::internal::SingleTypeCaller::doSwitchingWithLabel
void doSwitchingWithLabel(const internal::EmptyType &, internal::EmptyType *)
Definition
mlTypedProcessing.h:39
MLDataType
MLint32 MLDataType
MLDataType.
Definition
mlTypeDefs.h:595
mlInitSystemML.h
mlTypedHandlers.h
MeVis
Foundation
Sources
ML
include
mlTypedProcessing.h
Generated by
1.9.8