Merge branch 'tizen_3.0' into devel/tizen
[platform/core/system/sensord.git] / src / client / sensor_info_manager.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2013 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef _SENSOR_INFO_MANAGER_H_
21 #define _SENSOR_INFO_MANAGER_H_
22
23 #include <sensor_common.h>
24 #include <sensor_info.h>
25 #include <map>
26 #include <unordered_map>
27 #include <unordered_set>
28
29 class sensor_info_manager {
30 public:
31         static sensor_info_manager& get_instance(void);
32         const sensor_info* get_info(sensor_type_t type);
33         std::vector<sensor_info *> get_infos(sensor_type_t type);
34         const sensor_info* get_info(sensor_id_t id);
35         bool is_valid(sensor_info* info);
36         void add_info(sensor_info* info);
37
38 private:
39         typedef std::multimap<sensor_type_t, sensor_info*> sensor_infos;
40         typedef std::unordered_map<sensor_id_t, sensor_info*> id_to_info_map;
41         typedef std::unordered_set<sensor_info*> info_set;
42
43         sensor_info_manager();
44         ~sensor_info_manager();
45
46         sensor_info_manager(const sensor_info_manager&) {};
47         sensor_info_manager& operator=(const sensor_info_manager&);
48
49         sensor_infos m_sensor_infos;
50         id_to_info_map m_id_to_info_map;
51         info_set m_info_set;
52 };
53
54 #endif /* _SENSOR_INFO_MANAGER_H_ */