2016-07-05 20:20:33 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
#include "data_structures/concurrent/concurrent_set.hpp"
|
2016-08-23 02:03:45 +08:00
|
|
|
#include "storage/label/label.hpp"
|
|
|
|
#include "utils/char_str.hpp"
|
2016-07-05 20:20:33 +08:00
|
|
|
|
|
|
|
class LabelStore
|
|
|
|
{
|
|
|
|
public:
|
2016-08-30 07:45:07 +08:00
|
|
|
using store_t = ConcurrentMap<CharStr, std::unique_ptr<Label>>;
|
|
|
|
|
|
|
|
store_t::Accessor access();
|
|
|
|
|
2016-08-23 02:03:45 +08:00
|
|
|
const Label &find_or_create(const char *name);
|
2016-07-05 20:20:33 +08:00
|
|
|
|
2016-08-23 02:03:45 +08:00
|
|
|
bool contains(const char *name); // TODO: const
|
2016-07-05 20:20:33 +08:00
|
|
|
|
|
|
|
// TODO: implement find method
|
|
|
|
// return { Label, is_found }
|
|
|
|
|
|
|
|
private:
|
2016-08-30 07:45:07 +08:00
|
|
|
store_t labels;
|
2016-07-05 20:20:33 +08:00
|
|
|
};
|