Exemplo n.º 1
0
Real MatchMaker::operator()(int id1, int id2, Real val1, Real val2) const {
	FOREACH(const Vector3r& m, matches){
		if(((int)m[0]==id1 && (int)m[1]==id2) || ((int)m[0]==id2 && (int)m[1]==id1)) return m[2];
	}
	// no match
	if(fbNeedsValues && (isnan(val1) || isnan(val2))) throw std::invalid_argument("MatchMaker: no match for ("+lexical_cast<string>(id1)+","+lexical_cast<string>(id2)+"), and values required for algo computation '"+algo+"' not specified.");
	return computeFallback(val1,val2);
}
Exemplo n.º 2
0
Real MatchMaker::operator()(int id1, int id2, Real val1, Real val2) const {
	const int minId = std::min(id1, id2);
	const int maxId = std::max(id2, id2);
	
	const auto foundMatchItem = matchSet.find (std::make_pair(minId, maxId));
	
	if ( foundMatchItem != matchSet.end() ) {
		return foundMatchItem->second;
	} else {
		if(fbNeedsValues && (std::isnan(val1) || std::isnan(val2))) {
			throw std::invalid_argument("MatchMaker: no match for ("+boost::lexical_cast<string>(id1)+
			","+boost::lexical_cast<string>(id2)+"), and values required for algo computation '"+
			algo+"' not specified.");
		}
		return computeFallback(val1,val2);
	}
}