12#ifndef TIDA_ASSOCIATOR_H
13#define TIDA_ASSOCIATOR_H
23template<
typename T,
typename S=T>
41 virtual void match(
const std::vector<T*>& s1,
42 const std::vector<S*>& s2 ) = 0;
46 typename map_type::const_iterator titr =
mmatched.find(t);
47 if ( titr !=
mmatched.end() )
return titr->second;
53 typename rmap_type::const_iterator titr =
mrevmatched.find(t);
54 if ( titr !=
mrevmatched.end() )
return titr->second;
83template<
typename T,
typename S>
85 typename TIDA::Associator<T,S>::map_type::const_iterator mitr =
a.matched().begin();
86 typename TIDA::Associator<T,S>::map_type::const_iterator mend =
a.matched().end();
88 std::cout <<
"TIDA::Associator size() " <<
a.size() << std::endl;
90 while ( mitr!=mend ) {
92 if ( mitr->first ) s << *(mitr->first) <<
"\t";
93 else s <<
"-------\t\t";
95 if ( mitr->second ) s << *(mitr->second);
98 s <<
" ]" << std::endl;
std::ostream & operator<<(std::ostream &s, const TIDA::Associator< T, S > &a)
std::map< T *, S * > map_type
std::map< S *, T * > rmap_type
virtual const T * revmatched(S *t)
const map_type & matched() const
virtual Associator * clone()=0
virtual const S * matched(T *t)
const rmap_type & revmatched() const
virtual void match(const std::vector< T * > &s1, const std::vector< S * > &s2)=0
Associator(const std::string &name)