#include "fielddb/field_db.h" using namespace fielddb; class ThreadSafeSet { private: std::set keys; std::mutex setMutex; public: ThreadSafeSet(){} void insert(std::string key){ std::lock_guard lock(setMutex); keys.insert(key); } void erase(std::string key){ std::lock_guard lock(setMutex); keys.erase(key); } void clear(){ std::lock_guard lock(setMutex); keys.clear(); } size_t size(){ std::lock_guard lock(setMutex); return keys.size(); } bool haveKey(std::string key){ return std::find(keys.begin(), keys.end(), key) != keys.end(); } };