00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _TMWSERV_FUNCTORS_H_
00022 #define _TMWSERV_FUNCTORS_H_
00023
00024
00025 #include <functional>
00026 #include <sstream>
00027 #include <string>
00028
00029
00030 namespace
00031 {
00032
00033
00042 template <typename T>
00043 struct obj_name_is
00044 : public std::binary_function<T, std::string, bool>
00045 {
00046 bool
00047 operator()(const T& obj,
00048 const std::string& name) const
00049 {
00050 return (obj->getName() == name);
00051 }
00052 };
00053
00054
00059 template <typename T>
00060 struct string_to: public std::unary_function<std::string, T>
00061 {
00062 T
00063 operator()(const std::string& s) const
00064 {
00065 std::istringstream is(s);
00066 T value;
00067 is >> value;
00068
00069 return value;
00070 }
00071 };
00072
00073
00074 }
00075
00076
00077 #endif // _TMWSERV_FUNCTORS_H_