digiKam
dataproviders.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam
4  *
5  * Date : 2013-05-18
6  * Description : Wrapper class for face recognition
7  *
8  * Copyright (C) 2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
9  * Copyright (C) 2014-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_FACESENGINE_DATAPROVIDERS_H
25 #define DIGIKAM_FACESENGINE_DATAPROVIDERS_H
26 
27 // Qt includes
28 
29 #include <QImage>
30 #include <QList>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 #include "identity.h"
36 
37 namespace Digikam
38 {
39 
45 class DIGIKAM_GUI_EXPORT ImageListProvider
46 {
47 public:
48 
49  ImageListProvider() = default;
50  virtual ~ImageListProvider() = default;
51 
52  virtual int size() const = 0;
53  virtual bool atEnd() const = 0;
54  virtual void proceed(int steps = 1) = 0;
55  virtual QImage* image() = 0;
56  virtual QList<QImage*> images() = 0;
57  virtual void setImages(const QList<QImage*>&) = 0;
58 
59 private:
60 
61  Q_DISABLE_COPY(ImageListProvider)
62 };
63 
64 // ----------------------------------------------------------------------------------------
65 
69 class DIGIKAM_GUI_EXPORT QListImageListProvider : public ImageListProvider
70 {
71 public:
72 
74  ~QListImageListProvider() override;
75 
76  void reset();
77 
78 public:
79 
80  int size() const override;
81  bool atEnd() const override;
82  void proceed(int steps = 1) override;
83  QImage* image() override;
84  QList<QImage*> images() override;
85  void setImages(const QList<QImage*>&) override;
86 
87 public:
88 
91 
92 private:
93 
94  Q_DISABLE_COPY(QListImageListProvider)
95 };
96 
97 // ----------------------------------------------------------------------------------------
98 
99 class DIGIKAM_GUI_EXPORT EmptyImageListProvider : public ImageListProvider
100 {
101 public:
102 
105 
106  int size() const override;
107  bool atEnd() const override;
108  void proceed(int steps = 1) override;
109  QImage* image() override;
110  QList<QImage*> images() override;
111  void setImages(const QList<QImage*>&) override;
112 
113 private:
114 
115  Q_DISABLE_COPY(EmptyImageListProvider)
116 };
117 
118 // ----------------------------------------------------------------------------------------
119 
126 class DIGIKAM_GUI_EXPORT TrainingDataProvider
127 {
128 public:
129 
130  TrainingDataProvider() = default;
131  virtual ~TrainingDataProvider() = default;
132 
138  virtual ImageListProvider* newImages(const Identity& identity) = 0;
139 
144  virtual ImageListProvider* images(const Identity& identity) = 0;
145 
146 private:
147 
148  Q_DISABLE_COPY(TrainingDataProvider)
149 };
150 
151 } // namespace Digikam
152 
153 #endif // DIGIKAM_FACESENGINE_DATAPROVIDERS_H
Definition: dataproviders.h:100
Definition: identity.h:41
Definition: dataproviders.h:46
virtual void proceed(int steps=1)=0
virtual QList< QImage * > images()=0
virtual ~ImageListProvider()=default
virtual void setImages(const QList< QImage * > &)=0
virtual int size() const =0
virtual QImage * image()=0
virtual bool atEnd() const =0
Definition: dataproviders.h:70
QList< QImage * >::const_iterator it
Definition: dataproviders.h:90
QList< QImage * > list
Definition: dataproviders.h:89
Definition: dataproviders.h:127
virtual ImageListProvider * images(const Identity &identity)=0
virtual ImageListProvider * newImages(const Identity &identity)=0
virtual ~TrainingDataProvider()=default
Definition: datefolderview.cpp:43