sensord: fix incorrect return type
[platform/core/system/sensord.git] / src / server / sensor_info_list.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2016 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_LIST_H_
21 #define _SENSOR_INFO_LIST_H_
22
23 #include <list>
24
25 class interval_info {
26 public:
27         interval_info(int client_id, bool is_processor, unsigned int interval);
28         int client_id;
29         bool is_processor;
30         unsigned int interval;
31 };
32
33 typedef std::list<interval_info>::iterator interval_info_iterator;
34
35 class batch_info {
36 public:
37         batch_info(int client_id, unsigned int latency);
38         int client_id;
39         unsigned int latency;
40 };
41
42 typedef std::list<batch_info>::iterator batch_info_iterator;
43
44 class sensor_info_list {
45 public:
46         bool add_interval(int client_id, unsigned int interval, bool is_processor);
47         bool delete_interval(int client_id, bool is_processor);
48         unsigned int get_interval(int client_id, bool is_processor);
49         unsigned int get_min_interval(void);
50
51         bool add_batch(int client_id, unsigned int latency);
52         bool delete_batch(int client_id);
53         unsigned int get_batch(int client_id);
54         unsigned int get_max_batch(void);
55
56 private:
57         static bool comp_interval_info(interval_info a, interval_info b);
58         interval_info_iterator find_if_interval_info(int client_id, bool is_processor);
59
60         static bool comp_batch_info(batch_info a, batch_info b);
61         batch_info_iterator find_if_batch_info(int client_id);
62
63         std::list<interval_info> m_interval_info_list;
64         std::list<batch_info> m_batch_info_list;
65 };
66
67 #endif /* _SENSOR_INFO_LIST_H_ */