PartialMap.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00028 #ifndef KEYVALUE_KEY_MAP_PARTIALMAP_H_
00029 #define KEYVALUE_KEY_MAP_PARTIALMAP_H_
00030
00031 #include <boost/static_assert.hpp>
00032 #include <boost/type_traits/is_same.hpp>
00033
00034 #include "keyvalue/extern/String.h"
00035 #include "keyvalue/extern/Ptime.h"
00036 #include "keyvalue/key/Key.h"
00037
00038 namespace keyvalue {
00039
00040
00041
00042 namespace value {
00043 class Variant;
00044 }
00045
00046 namespace key {
00047
00074 template <typename OutputType>
00075 class PartialMap {
00076
00077 public:
00078
00079 typedef OutputType OutputType_;
00080
00081 PartialMap();
00082
00094 OutputType
00095 map(const value::Variant& variant) const;
00096
00106 virtual OutputType
00107 get(const string& name) const = 0;
00108
00109 private:
00110
00116 virtual string
00117 getName() const = 0;
00118
00119 typedef typename boost::is_same<OutputType, double>::type IsDouble_;
00120 typedef typename boost::is_same<OutputType, ptime>::type IsPtime_;
00121 typedef typename boost::is_same<OutputType, unsigned int>::type IsUInt_;
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 BOOST_STATIC_ASSERT(IsDouble_::value || IsPtime_::value ||
00132 IsUInt_::value);
00133
00134 };
00135
00136 }
00137 }
00138
00139 #endif // KEYVALUE_KEY_MAP_PARTIALMAP_H_