Incentive Accumulator with no explicit member
template arguments
class IncentiveAccumulator
{
public:
template<class WrappedScope, class ValueType, class NameTag>
void operator()(ValueType& attribute, NameTag nameTag, WrappedScope wrappedScope)
{
typedef typename PartOfIncentiveProgram<NameTag>::type CouldBePartOfIncentives;
accumulateValue(attribute, nameTag,wrappedScope, CouldBePartOfIncentives());
}
std::string result()const
{
return incentives_.str();
}
private:
template<class WrappedScope, class Value, class NameTag> void
accumulateValue(Value& incentive, NameTag nameTag, WrappedScope, Applies)
{
typedef WrappedScope::type Scope;
incentives_ << Scope::getClassName() << "." << Scope::getAttributeName(nameTag)<< ":";
incentives_ << incentive << "\t";
}
template<class WrappedScope, class Value, class NameTag> void
accumulateValue(Value&,NameTag, WrappedScope,DoesNotApply)
{ }
std::stringstream incentives_;
};
Last revised: September 13, 2004 |
Copyright © 2004 Arne Adams |