Dilbert
Firmware for the Dilbert interactive badge.
 All Classes Files Functions Variables Enumerations Macros Pages
ConfigService.h
Go to the documentation of this file.
1 
3 #ifndef _CONFIGSERVICE_H_
4 #define _CONFIGSERVICE_H_
5 
6 #include "IConfigStorage.h"
7 #include "SystemConfigData.h"
8 
15 {
16 public:
22  {
23  static ConfigService instance;
24  return instance;
25  }
26 
27  inline void setStorage(IConfigStorage *storage)
28  {
29  m_storage = storage;
30  }
31 
32  inline bool load()
33  {
34  if (!m_storage)
35  return false;
36 
37  return loadFrom(m_storage);
38  }
39 
40  inline bool save()
41  {
42  if (!m_storage)
43  return false;
44 
45  return saveTo(m_storage);
46  }
47 
48  bool loadFrom(IConfigStorage *storage);
49  bool saveTo(IConfigStorage *storage);
50 
56  {
57  return m_configData;
58  }
59 
60 private:
61  ConfigService();
63  void operator=(ConfigService const &);
64 
65  SystemConfigData m_configData;
66 
67  IConfigStorage *m_storage;
68 };
69 
70 #endif
bool saveTo(IConfigStorage *storage)
Saves the system configuration to a given storage service.
Definition: ConfigService.cpp:32
Used to store system configuration data.
Definition: SystemConfigData.h:26
provides access to system confgiuration.
Definition: ConfigService.h:14
bool loadFrom(IConfigStorage *storage)
Loads the system configuration from a given storage service.
Definition: ConfigService.cpp:19
SystemConfigData & getConfig()
Gets the system configuration.
Definition: ConfigService.h:55
static ConfigService & Instance()
Gets the configuration service.
Definition: ConfigService.h:21
Interface for configuration storage.
Definition: IConfigStorage.h:13