eb3b242f21f385d4a47a9b64c520cb247496ae2d
[apps/native/sample/ImageFeatureManager.git] / project / inc / FeatureSetGenerator.h
1 //
2 // Tizen C++ SDK
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #ifndef _DB_GENERATOR_H_
19 #define _DB_GENERATOR_H_
20
21 #include <FBase.h>
22 #include <FUix.h>
23 #include "IFeatureSetGeneratorListener.h"
24
25 struct ResultInfo
26 {
27     ResultInfo(void)
28         : appendTime(-1)
29         , appendedObjectsNumber(-1)
30         , rejectedObjectsNumber(-1)
31         , totalObjectsNumber(-1)
32     {}
33
34     int appendTime;
35     int appendedObjectsNumber;
36     int rejectedObjectsNumber;
37     int totalObjectsNumber;
38 };
39
40 class FeatureSetGenThread: public Tizen::Base::Runtime::Thread
41 {
42 public:
43
44     FeatureSetGenThread(void);
45     ~FeatureSetGenThread(void);
46     result Construct(void);
47
48     void SetListener(IFeatureSetGeneratorListener*);
49     void SetImagePath(const Tizen::Base::String& imPath);
50     void SetFeatureManager(Tizen::Uix::Vision::ImageFeatureManager* pImageFeatureManager);
51     void GetResults(ResultInfo&);
52
53 private:
54     Tizen::Base::Object* Run(void);
55     bool Generate(Tizen::Base::String imPath, ResultInfo&);
56     bool CheckExt(Tizen::Base::String fileName);
57
58 private:
59     IFeatureSetGeneratorListener*                                    __pListener;
60     Tizen::Base::String                                        __imagePath;
61     Tizen::Base::String                                        __databasePath;
62     ResultInfo                                                 __resultInfo;
63     Tizen::Base::Collection::ArrayListT<Tizen::Base::String>   __files;
64     Tizen::Uix::Vision::ImageFeatureManager*                   __pImageFeatureManager;
65
66 private:
67     class StrComparer
68         : public Tizen::Base::Collection::IComparerT<Tizen::Base::String>
69     {
70         virtual result Compare(const Tizen::Base::String& str1, const Tizen::Base::String& str2, int& cmp) const
71         {
72             cmp = Tizen::Base::String::Compare(str1, str2);
73             return E_SUCCESS;
74         }
75     };
76
77 };
78
79 #endif // DBGENERATOR_H_