mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
Storage: Make testable, make EntriesMap typedef private.
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
|
||||
namespace nt {
|
||||
|
||||
class StorageTest;
|
||||
|
||||
class StorageEntry {
|
||||
public:
|
||||
StorageEntry() : m_flags(0), m_id(0xffff) {}
|
||||
@@ -70,6 +72,7 @@ class StorageEntry {
|
||||
};
|
||||
|
||||
class Storage {
|
||||
friend class StorageTest;
|
||||
public:
|
||||
static Storage& GetInstance() {
|
||||
if (!m_instance) m_instance.reset(new Storage);
|
||||
@@ -77,8 +80,6 @@ class Storage {
|
||||
}
|
||||
~Storage();
|
||||
|
||||
typedef llvm::StringMap<std::shared_ptr<StorageEntry>> EntriesMap;
|
||||
|
||||
struct Update {
|
||||
std::shared_ptr<StorageEntry> entry;
|
||||
enum Kind { kAssign, kValueUpdate, kFlagsUpdate, kDelete, kDeleteAll };
|
||||
@@ -111,6 +112,8 @@ class Storage {
|
||||
Storage(const Storage&) = delete;
|
||||
Storage& operator=(const Storage&) = delete;
|
||||
|
||||
typedef llvm::StringMap<std::shared_ptr<StorageEntry>> EntriesMap;
|
||||
|
||||
mutable std::mutex m_mutex;
|
||||
EntriesMap m_entries;
|
||||
UpdateQueue m_updates;
|
||||
|
||||
Reference in New Issue
Block a user