28 #ifndef _THREAD_SAFE_MAP_HPP_ 29 #define _THREAD_SAFE_MAP_HPP_ 31 #include <boost/smart_ptr.hpp> 32 #include <boost/thread/shared_mutex.hpp> 33 #include <boost/thread/mutex.hpp> 59 boost::shared_lock<boost::shared_mutex> lock(*(
mutex_.get()));
61 typename InternalMap::iterator it =
map_->find(first);
62 if (it !=
map_->end())
68 bool insert(
const std::string &first,
const T &value)
75 keys_.push_back(first);
76 map_->insert(std::pair<std::string, T>(first, value));
81 bool update(
const std::string &first,
const T &value)
88 (*map_)[first] = value;
93 std::vector<std::string>
keys()
bool update(const std::string &first, const T &value)
std::vector< std::string > keys_
boost::shared_ptr< boost::shared_mutex > mutex_
std::map< std::string, T > InternalMap
std::vector< std::string > keys()
T find(std::string first)
bool insert(const std::string &first, const T &value)
static const int lock_wait_time
boost::shared_ptr< InternalMap > map_