2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __CONTEXT_INACTIVE_DETECTOR_STORAGE_H__
18 #define __CONTEXT_INACTIVE_DETECTOR_STORAGE_H__
21 #include "AppInactiveDetectorTypes.h"
23 #include <DatabaseManager.h>
27 class inactive_detector_storage : public IDatabaseListener
30 //int type; //TODO: enum
31 void inject_params(std::string& str,
32 const std::string& from,
33 const std::string& to);
35 void json_to_object(std::vector<Json>& records,
36 std::vector<app_t> *apps_with_weights, bool result_mode);
38 std::string query_get_apps(const char *subject,
41 std::string query_update_apps(std::vector<app_t> *apps_with_weights);
43 std::string subquery_form_values(std::vector<app_t> *apps_with_weights);
45 void onTableCreated(unsigned int query_id, int error) {}
46 void onInserted(unsigned int query_id, int error, int64_t row_id) {}
47 void onExecuted(unsigned int query_id, int error, std::vector<Json>& records);
49 DatabaseManager __dbManager;
52 inactive_detector_storage();
53 ~inactive_detector_storage();
55 int read(const char *subject,
59 int get_apps_info_w_weights(double timestamp_from);
60 }; /* class inactive_detector_storage */
64 #endif /* __CONTEXT_INACTIVE_DETECTOR_STORAGE_H__ */