12#ifndef TIDA_ASSOCIATOR_H
13#define TIDA_ASSOCIATOR_H
25template<
typename T,
typename S=T>
41 virtual std::unique_ptr<Associator>
uclone()
const = 0;
43 virtual void match(
const std::vector<T*>& s1,
44 const std::vector<S*>& s2 ) = 0;
48 typename map_type::const_iterator titr =
mmatched.find(t);
49 if ( titr !=
mmatched.end() )
return titr->second;
55 typename rmap_type::const_iterator titr =
mrevmatched.find(t);
56 if ( titr !=
mrevmatched.end() )
return titr->second;
85template<
typename T,
typename S>
87 typename TIDA::Associator<T,S>::map_type::const_iterator mitr =
a.matched().begin();
88 typename TIDA::Associator<T,S>::map_type::const_iterator mend =
a.matched().end();
90 std::cout <<
"TIDA::Associator size() " <<
a.size() << std::endl;
92 while ( mitr!=mend ) {
94 if ( mitr->first ) s << *(mitr->first) <<
"\t";
95 else s <<
"-------\t\t";
97 if ( mitr->second ) s << *(mitr->second);
100 s <<
" ]" << std::endl;
std::ostream & operator<<(std::ostream &s, const TIDA::Associator< T, S > &a)
virtual const T * revmatched(S *t) const
std::map< const T *, const S * > map_type
const map_type & matched() const
virtual std::unique_ptr< Associator > uclone() const =0
virtual const S * matched(T *t) const
const rmap_type & revmatched() const
virtual void match(const std::vector< T * > &s1, const std::vector< S * > &s2)=0
std::map< const S *, const T * > rmap_type
Associator(const std::string &name)