32 #include <boost/shared_ptr.hpp>
62 virtual bool match(
const std::string& key)
const = 0;
75 bool match(
const std::string& )
const {
80 return "AlwaysApplicable";
97 template <
typename WireType>
101 typedef std::list< std::pair<ConverterPredicatePtr, ConverterPtr> >
ConverterList;
113 template <
typename ForwardIterator>
115 std::copy(begin, end, std::inserter(this->
converters,
120 for (
typename ConverterList::const_iterator it = this->
converters.begin();
122 if (it->first->match(key)) {
130 return "PredicateConverterList";
134 stream <<
"converters = " << this->
converters;
Converter< WireType >::Ptr ConverterPtr
Implementation of this interface perform mappings of one of the followings forms: ...
std::string getClassName() const
ConverterPtr getConverter(const std::string &key) const
Tries to look up the converter designator by key.
void printContents(std::ostream &stream) const
std::string getClassName() const
void printContents(std::ostream &) const
Objects of this class are used to perform Converter selection via a chain-of-responsibility strategy...
PredicateConverterList(ForwardIterator begin, ForwardIterator end)
Construct a new PredicateConverterList object, initializing its Converter to the elements of the iter...
virtual bool match(const std::string &key) const =0
Return true if the Converter associated to this predicate should be selected for key.
Implementations of this interface can be used to perform Converter selection based on predicate evalu...
virtual ~ConverterPredicate()
A predicate that unconditionally causes its associated Converter to be selected.
bool match(const std::string &) const
Return true if the Converter associated to this predicate should be selected for key.
std::list< std::pair< ConverterPredicatePtr, ConverterPtr > > ConverterList
boost::shared_ptr< ConverterPredicate > ConverterPredicatePtr
ConverterSelectionStrategy< WireType >::ConverterPtr ConverterPtr