1 #ifndef Candidate_component_h
2 #define Candidate_component_h
20 namespace componenthelper {
26 template<
typename C,
typename T, T (C::*F)() const>
29 const C * dc =
dynamic_cast<const C *
>( &
c );
30 if ( dc == 0 )
return T();
35 template<
typename C,
typename T, T (C::*F)(
size_t ) const ,
size_t (C::*S)() const>
38 const C * dc =
dynamic_cast<const C *
>( &
c );
39 if ( dc == 0 )
return 0;
43 const C * dc =
dynamic_cast<const C *
>( &
c );
44 if ( dc == 0 )
return T();
45 if (
i < (dc->*S)() )
return (dc->*
F)(
i );
46 else throw cms::Exception(
"Error" ) <<
"index " <<
i <<
" out ot range";
52 template<
typename T,
typename M,
typename Tag = DefaultComponentTag>
60 template<
typename T,
typename Tag>
70 template<
typename T,
typename Tag>
80 template<
typename T,
typename Tag>
87 #define GET_CANDIDATE_COMPONENT( CAND, TYPE, FUN, TAG ) \
89 struct component<TYPE, componenthelper::SingleComponentTag, TAG> { \
90 typedef componenthelper::SingleComponent<CAND, TYPE, & CAND::FUN> type; \
93 #define GET_DEFAULT_CANDIDATE_COMPONENT( CAND, TYPE, FUN ) \
95 struct component<TYPE, componenthelper::SingleComponentTag, DefaultComponentTag> { \
96 typedef componenthelper::SingleComponent<CAND, TYPE, & CAND::FUN> type; \
99 #define GET_CANDIDATE_MULTIPLECOMPONENTS( CAND, TYPE, FUN, SIZE, TAG ) \
101 struct component<TYPE, componenthelper::MultipleComponentsTag, TAG> { \
102 typedef componenthelper::MultipleComponents<CAND, TYPE, & CAND::FUN, & CAND::SIZE> type; \
105 #define GET_DEFAULT_CANDIDATE_MULTIPLECOMPONENTS( CAND, TYPE, FUN, SIZE ) \
107 struct component<TYPE, componenthelper::MultipleComponentsTag, DefaultComponentTag> { \
108 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)