1 #ifndef Candidate_component_h
2 #define Candidate_component_h
19 namespace componenthelper {
25 template<
typename C,
typename T, T (C::*F)() const>
28 const C * dc =
dynamic_cast<const C *
>( &
c );
29 if ( dc == 0 )
return T();
34 template<
typename C,
typename T, T (C::*F)(
size_t ) const ,
size_t (C::*S)() const>
37 const C * dc =
dynamic_cast<const C *
>( &
c );
38 if ( dc == 0 )
return 0;
42 const C * dc =
dynamic_cast<const C *
>( &
c );
43 if ( dc == 0 )
return T();
44 if (
i < (dc->*S)() )
return (dc->*
F)(
i );
45 else throw cms::Exception(
"Error" ) <<
"index " <<
i <<
" out ot range";
51 template<
typename T,
typename M,
typename Tag = DefaultComponentTag>
59 template<
typename T,
typename Tag>
69 template<
typename T,
typename Tag>
79 template<
typename T,
typename Tag>
86 #define GET_CANDIDATE_COMPONENT( CAND, TYPE, FUN, TAG ) \
88 struct component<TYPE, componenthelper::SingleComponentTag, TAG> { \
89 typedef componenthelper::SingleComponent<CAND, TYPE, & CAND::FUN> type; \
92 #define GET_DEFAULT_CANDIDATE_COMPONENT( CAND, TYPE, FUN ) \
94 struct component<TYPE, componenthelper::SingleComponentTag, DefaultComponentTag> { \
95 typedef componenthelper::SingleComponent<CAND, TYPE, & CAND::FUN> type; \
98 #define GET_CANDIDATE_MULTIPLECOMPONENTS( CAND, TYPE, FUN, SIZE, TAG ) \
100 struct component<TYPE, componenthelper::MultipleComponentsTag, TAG> { \
101 typedef componenthelper::MultipleComponents<CAND, TYPE, & CAND::FUN, & CAND::SIZE> type; \
104 #define GET_DEFAULT_CANDIDATE_MULTIPLECOMPONENTS( CAND, TYPE, FUN, SIZE ) \
106 struct component<TYPE, componenthelper::MultipleComponentsTag, DefaultComponentTag> { \
107 typedef componenthelper::MultipleComponents<CAND, TYPE, & CAND::FUN, & CAND::SIZE> type; \
size_t numberOf(const Candidate &c)
static size_t numberOf(const Candidate &c)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
T get(const Candidate &c)