Subversion Repositories HomeAutomation

Rev

Rev 1642 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*
  2.  *
  3.  *  Copyright (C) 2010  Mattias Runge
  4.  *
  5.  *  This program is free software; you can redistribute it and/or modify
  6.  *  it under the terms of the GNU General Public License as published by
  7.  *  the Free Software Foundation; either version 2 of the License, or
  8.  *  (at your option) any later version.
  9.  *
  10.  *  This program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  *  GNU General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU General Public License along
  16.  *  with this program; if not, write to the Free Software Foundation, Inc.,
  17.  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18.  *
  19.  */
  20.  
  21. #ifndef CONFIG_MANAGER_H
  22. #define CONFIG_MANAGER_H
  23.  
  24. #include <string>
  25. #include <vector>
  26.  
  27. #include <boost/shared_ptr.hpp>
  28. #include <boost/thread/mutex.hpp>
  29. #include <boost/program_options.hpp>
  30.  
  31. #include "common/common.h"
  32.  
  33. namespace atom {
  34. namespace config {
  35.  
  36. class Manager
  37. {
  38. public:
  39.   typedef boost::shared_ptr<Manager> Pointer;
  40.  
  41.   virtual ~Manager();
  42.  
  43.   static Pointer Instance();
  44.   static void Create();
  45.   static void Delete();
  46.  
  47.   bool Set(int argument_count, char **argument_vector);
  48.  
  49.   bool Exist(std::string name);
  50.  
  51.   std::string GetAsString(std::string name);
  52.   common::StringList GetAsStringVector(std::string name);
  53.   int GetAsInt(std::string name);
  54.    
  55. private:
  56.   static Pointer instance_;
  57.  
  58.   boost::program_options::options_description command_line_;
  59.   boost::program_options::options_description configuration_file_;
  60.   boost::program_options::variables_map       variable_map_;
  61.  
  62.   Manager();
  63. };
  64.  
  65. }; // namespace config
  66. }; // namespace atom
  67.  
  68. #endif // CONFIG_MANAGER_H
  69.