| 1 | 
< | 
 /* | 
| 1 | 
> | 
/* | 
| 2 | 
  | 
 * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. | 
| 3 | 
  | 
 * | 
| 4 | 
  | 
 * The University of Notre Dame grants you ("Licensee") a | 
| 52 | 
  | 
#include <map> | 
| 53 | 
  | 
namespace oopse { | 
| 54 | 
  | 
 | 
| 55 | 
< | 
    template<class TupleType, class ReturnType> | 
| 56 | 
< | 
    class TupleMatcher { | 
| 57 | 
< | 
        static ReturnType match(const std::map<TupleType, ReturnType>& container, const TupleType& t) { | 
| 58 | 
< | 
            typename std::map<TupleType, ReturnType>::iterator i; | 
| 55 | 
> | 
  template<class TupleType, class ReturnType> | 
| 56 | 
> | 
  class TupleMatcher { | 
| 57 | 
> | 
    static ReturnType match(const std::map<TupleType, ReturnType>& container, const TupleType& t) { | 
| 58 | 
> | 
      typename std::map<TupleType, ReturnType>::iterator i; | 
| 59 | 
  | 
 | 
| 60 | 
< | 
            i = container.find(t); | 
| 61 | 
< | 
            if (i != container.end()) { | 
| 62 | 
< | 
                return i->second; | 
| 63 | 
< | 
            } else { | 
| 64 | 
< | 
                return NULL; | 
| 65 | 
< | 
            } | 
| 66 | 
< | 
        } | 
| 67 | 
< | 
    }; | 
| 60 | 
> | 
      i = container.find(t); | 
| 61 | 
> | 
      if (i != container.end()) { | 
| 62 | 
> | 
        return i->second; | 
| 63 | 
> | 
      } else { | 
| 64 | 
> | 
        return NULL; | 
| 65 | 
> | 
      } | 
| 66 | 
> | 
    } | 
| 67 | 
> | 
  }; | 
| 68 | 
  | 
     | 
| 69 | 
  | 
} | 
| 70 | 
  | 
#endif //UTILS_TUPLEMATCHER_HPP |