Leosac
0.8.0
Open Source Access Control
|
This class is here to help check the validity of the configuration. More...
#include <ConfigChecker.hpp>
Public Member Functions | |
void | register_object (const std::string &name, const Leosac::Hardware::DeviceClass &type) |
Declare an object on the registry. More... | |
bool | has_object (const std::string &name) const |
Check whether or not an object with name name is declared in the registry, no matter its type. More... | |
bool | has_object (const std::string &name, const Leosac::Hardware::DeviceClass &type) const |
Check whether or not an object with name name is declared in the registry and if check that its type is type . More... | |
void | clear () |
Clear all informations. More... | |
Private Attributes | |
std::map< std::string, Leosac::Hardware::DeviceClass > | objects_ |
std::mutex | mutex_ |
This class is here to help check the validity of the configuration.
Leosac configuration being text-based, various object (LED, Reader, GPIO) are referenced by name. This is practical because it gives the configuration maintainer some flexibility (especially regarding the Doorman module). However, it is also difficult to detect misconfiguration before running into trouble at runtime.
How does this class help?
The idea is for module declaring object to register them with this class, and for module using (aka talking-to) objects, to check here first.
As a result, this class shall be fully thread safe.
Definition at line 46 of file ConfigChecker.hpp.
void ConfigChecker::clear | ( | ) |
Clear all informations.
This is useful when synchronizing with remote.
Definition at line 48 of file ConfigChecker.cpp.
bool ConfigChecker::has_object | ( | const std::string & | name | ) | const |
Check whether or not an object with name name
is declared in the registry, no matter its type.
Definition at line 34 of file ConfigChecker.cpp.
bool ConfigChecker::has_object | ( | const std::string & | name, |
const Leosac::Hardware::DeviceClass & | type | ||
) | const |
Check whether or not an object with name name
is declared in the registry and if check that its type is type
.
Definition at line 40 of file ConfigChecker.cpp.
void ConfigChecker::register_object | ( | const std::string & | name, |
const Leosac::Hardware::DeviceClass & | type | ||
) |
Declare an object on the registry.
Definition at line 25 of file ConfigChecker.cpp.
|
mutableprivate |
Definition at line 74 of file ConfigChecker.hpp.
|
private |
Definition at line 73 of file ConfigChecker.hpp.