20 #include "pedigree/kernel/config/MemoryBackend.h" 21 #include "pedigree/kernel/utilities/new" 23 MemoryBackend::MemoryBackend(
const String &configStore)
28 MemoryBackend::~MemoryBackend()
30 ConfigurationManager::instance().removeBackend(m_ConfigStore);
33 size_t MemoryBackend::createTable(
const String &table)
35 m_Tables.insert(table,
new Table());
43 if (!result.hasValue())
47 result.value()->m_Rows.insert(key, pConfigValue);
56 if (!result.hasValue())
60 result.value()->m_Rows.lookup(key);
68 const String &table,
const String &key, ConfigurationWatcher watcher)
71 if (!result.hasValue())
75 result.value()->m_Rows.lookup(key);
78 for (
int i = 0; i < MAX_WATCHERS; i++)
80 if (val.value()->watchers[i] == 0)
82 val.value()->watchers[i] = watcher;
90 const String &table,
const String &key, ConfigurationWatcher watcher)
93 if (!result.hasValue())
97 result.value()->m_Rows.lookup(key);
100 for (
int i = 0; i < MAX_WATCHERS; i++)
102 if (val.value()->watchers[i] == watcher)
104 val.value()->watchers[i] = 0;
111 const String &MemoryBackend::getTypeName()
A key/value dictionary for string keys.
virtual void unwatch(const String &table, const String &key, ConfigurationWatcher watcher)
virtual void watch(const String &table, const String &key, ConfigurationWatcher watcher)
virtual void insert(const String &table, const String &key, const ConfigValue &value)
virtual ConfigValue & select(const String &table, const String &key)