BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
MemoryDeviceCache.h
1 #pragma once
2 
3 #include <list>
4 #include <map>
5 #include <string>
6 
7 #include <Poco/RWLock.h>
8 
9 #include "core/DeviceCache.h"
10 
11 namespace BeeeOn {
12 
17 public:
22  void setPrepaired(const std::list<std::string> &devices);
23 
29  void markPaired(
30  const DevicePrefix &prefix,
31  const std::set<DeviceID> &devices) override;
32 
38  void markPaired(const DeviceID &id) override;
39 
44  void markUnpaired(const DeviceID &id) override;
45 
49  bool paired(const DeviceID &id) const override;
50 
54  std::set<DeviceID> paired(const DevicePrefix &prefix) const override;
55 
56 private:
57  std::map<DevicePrefix, std::set<DeviceID>> m_cache;
58  mutable Poco::RWLock m_lock;
59 };
60 
61 }
void setPrepaired(const std::list< std::string > &devices)
Set devices to be initially marked as paired. This feature might be useful for debugging purposes...
Definition: MemoryDeviceCache.cpp:13
bool paired(const DeviceID &id) const override
Definition: MemoryDeviceCache.cpp:62
MemoryDeviceCache implements in-memory volatile DeviceCache.
Definition: MemoryDeviceCache.h:16
DeviceCache manages pairing status devices which allows to choose different caching strategies like: ...
Definition: DeviceCache.h:17
void markPaired(const DevicePrefix &prefix, const std::set< DeviceID > &devices) override
Stores the given set of devices of the same prefix as the set of paired devices. Devices not included...
void markUnpaired(const DeviceID &id) override
Remove the given id from the cache. If the id&#39;s prefix does not contain any other id...
Definition: MemoryDeviceCache.cpp:48
Definition: DeviceID.h:17