[my-place] Make PlacesDetector pure static.
[platform/core/context/context-provider.git] / src / my-place / place / PlacesDetector.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef _CONTEXT_PLACE_RECOGNITION_PLACES_DETECTOR_
18 #define _CONTEXT_PLACE_RECOGNITION_PLACES_DETECTOR_
19
20 #include <vector>
21 #include <cstdint>
22 #include <UserPlacesTypes.h>
23 #include <MyPlaceTypes.h>
24 #include "Graph.h"
25
26 namespace ctx {
27
28         class PlacesDetector {
29
30         private:
31                 static double __doubleValueFromJson(Json &row, const char* key);
32                 static Categs __visitCategsFromJson(Json &row);
33                 static void __visitLocationFromJson(Json &row, ctx::Visit &visit);
34                 static Visit __visitFromJson(Json &row);
35                 static Visits __visitsFromJsons(std::vector<Json>& records);
36
37                 static std::shared_ptr<graph::Graph> __graphFromVisits(const std::vector<Visit> &visits);
38
39                 static void __dbCreateTable();
40                 static void __dbDeletePlaces();
41                 static void __dbDeleteOldEntries();
42                 static void __dbDeleteOlderVisitsThan(time_t threshold);
43                 static void __dbDeleteOlderWifiAPsThan(time_t threshold);
44                 static std::vector<Json> __dbGetVisits();
45                 static void __dbInsertPlace(const Place &place);
46
47                 static std::shared_ptr<Place> __placeFromMergedVisits(Visits &mergedVisits);
48                 static std::vector<std::shared_ptr<ctx::Place>> __processVisits(Visits &visits, bool testMode = false);
49                 static void __mergeLocation(const Visits &mergedVisits, Place &place);
50                 static std::shared_ptr<graph::Components> __mergeVisits(const std::vector<Visit> &visits);
51                 static void __reduceOutliers(Visits &visits);
52                 static void __reduceOutliers(std::shared_ptr<graph::Components> &cc);
53
54                 PlacesDetector();
55
56         public:
57                 static void detectPlaces();
58
59         };  /* class PlacesDetector */
60
61 }       /* namespace ctx */
62
63 #endif /* End of _CONTEXT_PLACE_RECOGNITION_PLACES_DETECTOR_ */