LRAUV  revA
Config.h
Go to the documentation of this file.
1 
10 #ifndef CONFIG_H_
11 #define CONFIG_H_
12 
13 #include "component/Component.h"
14 #include "logger/Logger.h"
15 #include "utils/FastMap.h"
16 
25 class Config: public Component
26 {
27 public:
28 
30  virtual ~Config()
31  {}
32 
35  static void LoadConfigFiles( const Str& path, const Str& altConfig, const Str& dataDir, Logger& logger );
36 
39  static Config* Instance( const Str& realPath, const Str& basePath, const char* name, const Str& dataDir, bool& duplicate, Logger& logger );
40 
42  void run() {};
43 
45  static void Persist( const Str& name, const char* line, Logger& logger );
46 
50  static void LoadPersistedConfigSets( Logger& logger, bool reload, bool list );
51 
53  static void Uninitialize();
54 
55 private:
56 
58 
60  static void CopyFileToDir( const Str& path, const char* name, const Str& destDir, Logger& logger );
61 
63  Config( const Str& name );
64 
66  static void LoadConfigFilesInPath( const Str& basePath, const Str& addPath, const Str& dataDir, Logger& logger );
67 
69  static bool ParseLine( Component* config, char* buffer, unsigned int length, bool secure );
70 
71 };
72 
73 #endif /*CONFIG_H_*/
Client-side interface for injecting log data into the log queue.
Definition: Logger.h:30
static void LoadConfigFiles(const Str &path, const Str &altConfig, const Str &dataDir, Logger &logger)
Scans a folder for files that end in ".cfg" and loads them Also looks in sub-folders corresponding to...
Definition: Config.cpp:50
void run()
No reason to ever run a config component.
Definition: Config.h:42
static bool ParseLine(Component *config, char *buffer, unsigned int length, bool secure)
Parse a line from the input file, associating the value with the Config object.
Definition: Config.cpp:297
Config(const Str &name)
Private constructor – use Instance.
Definition: Config.cpp:481
Contains the Component class definition.
static void CopyFileToDir(const Str &path, const char *name, const Str &destDir, Logger &logger)
Copies the indicated file and its path to the destDir.
Definition: Config.cpp:29
static void LoadPersistedConfigSets(Logger &logger, bool reload, bool list)
Loads configuration settings persisted via configSet command.
Definition: Config.cpp:137
The Config class provides static methods for accessing configuration values.
Definition: Config.h:25
static Config * Instance(const Str &realPath, const Str &basePath, const char *name, const Str &dataDir, bool &duplicate, Logger &logger)
Returns an instance, or NULL if the config file can't be read duplicate will be set to true if this i...
Definition: Config.cpp:202
static void Uninitialize()
Release static resources.
Definition: Config.cpp:486
Replacement for standard template class string.
Definition: Str.h:12
Abstract Base class for software components.
Definition: Component.h:53
Contains the FastMap class declaration.
Contains the Logger class definition.
virtual ~Config()
Destructor – never called.
Definition: Config.h:30
static void LoadConfigFilesInPath(const Str &basePath, const Str &addPath, const Str &dataDir, Logger &logger)
Scans a folder for files that end in ".cfg" and loads them.
Definition: Config.cpp:257
static FastMap< const Str, Str * > PersistedConfigSetMap_
Definition: Config.h:57
static void Persist(const Str &name, const char *line, Logger &logger)
Saves a configuration setting persisted via configSet command.
Definition: Config.cpp:114