The Pedigree Project  0.1
MemoryBackend.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef MEMORY_BACKEND_H
21 #define MEMORY_BACKEND_H
22 
23 #include "pedigree/kernel/config/ConfigurationBackend.h"
24 #include "pedigree/kernel/config/ConfigurationManager.h"
25 #include "pedigree/kernel/processor/types.h"
27 #include "pedigree/kernel/utilities/String.h"
28 
33 {
34  public:
35  MemoryBackend(const String &configStore);
36  virtual ~MemoryBackend();
37 
38  virtual size_t createTable(const String &table);
41  virtual void
42  insert(const String &table, const String &key, const ConfigValue &value);
44  virtual ConfigValue &select(const String &table, const String &key);
45 
47  virtual void
48  watch(const String &table, const String &key, ConfigurationWatcher watcher);
50  virtual void unwatch(
51  const String &table, const String &key, ConfigurationWatcher watcher);
52 
53  const String &getTypeName();
54 
55  private:
56  // A Table
57  struct Table
58  {
59  Table() : m_Rows()
60  {
61  }
62  ~Table()
63  {
64  }
65 
67  };
68 
69  // Our tables
70  RadixTree<Table *> m_Tables;
71 
72  String m_TypeName;
73 };
74 
75 #endif
Definition: String.h:49
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)
Implements a Radix Tree, a kind of Trie with compressed keys.