00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022
00023 #include <drizzled/util/storable.h>
00024 #include <drizzled/util/string.h>
00025 #include <boost/unordered_map.hpp>
00026
00027 namespace drizzled
00028 {
00029
00030 class Session;
00031
00032 namespace session
00033 {
00034
00035 class PropertyMap {
00036 private:
00037 typedef boost::unordered_map<std::string, util::Storable *, util::insensitive_hash, util::insensitive_equal_to> Map;
00038
00039 public:
00040 typedef Map::iterator iterator;
00041 typedef Map::const_iterator const_iterator;
00042
00043 drizzled::util::Storable *getProperty(const std::string &arg)
00044 {
00045 return _properties[arg];
00046 }
00047
00048 template<class T>
00049 bool setProperty(const std::string &arg, T *value)
00050 {
00051 _properties[arg]= value;
00052
00053 return true;
00054 }
00055
00056 iterator begin()
00057 {
00058 return _properties.begin();
00059 }
00060
00061 iterator end()
00062 {
00063 return _properties.end();
00064 }
00065
00066 const_iterator begin() const
00067 {
00068 return _properties.begin();
00069 }
00070
00071 const_iterator end() const
00072 {
00073 return _properties.end();
00074 }
00075
00076 ~PropertyMap()
00077 {
00078 for (iterator iter= _properties.begin(); iter != _properties.end(); iter++)
00079 {
00080 boost::checked_delete(iter->second);
00081 }
00082 _properties.clear();
00083 }
00084
00085 private:
00086 Map _properties;
00087 };
00088
00089 }
00090 }
00091