AnCH Framework  0.1
Another C++ Hack Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
resource.hpp
1 /*
2  ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3  Copyright (C) 2012 Vincent Lachenal
4 
5  This file is part of ANCH Framework.
6 
7  ANCH Framework is free software: you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  ANCH Framework is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19 */
20 #ifndef _ANCH_RESOURCE_RESOURCE_H_
21 #define _ANCH_RESOURCE_RESOURCE_H_
22 
23 #include <iostream>
24 #include <map>
25 #include <mutex>
26 
27 #include "resource/section.hpp"
28 
29 namespace anch {
30  namespace resource {
31 
37  class Resource {
38  private:
39  // Attributes +
41  static std::map<std::string,Resource> RESOURCES;
42 
44  static std::mutex MUTEX;
45 
47  std::map<std::string,anch::resource::Section> _resources;
48  // Attributes -
49 
50  private:
51  // Constructors +
55  Resource();
56  // Constructors -
57 
58  public:
59  // Destructor +
63  virtual ~Resource();
64  // Destructor -
65 
66  public:
74  static const Resource& getResource(const std::string& filePath);
75 
85  bool getParameter(std::string& value,
86  const std::string& param,
87  const std::string& section = "") const;
88 
94  inline const std::map<std::string,anch::resource::Section>& getConfiguration() const {
95  return _resources;
96  }
97 
98  };
99 
100  }
101 }
102 
103 #endif // _ANCH_RESOURCE_RESOURCE_H_
virtual ~Resource()
Definition: resource.cpp:48
bool getParameter(std::string &value, const std::string &param, const std::string &section="") const
Definition: resource.cpp:80
const std::map< std::string, anch::resource::Section > & getConfiguration() const
Definition: resource.hpp:94
AnCH framework base namespace.
Definition: base64.hpp:28
static const Resource & getResource(const std::string &filePath)
Definition: resource.cpp:58
Definition: resource.hpp:37