3DiVi Face SDK  3.21.0
 Указатель Классы Пространства имен Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Свойства Группы
TemplatesIndex.h
См. документацию.
1 
9 #ifndef __PBIO_API__PBIO__TEMPLATES_INDEX_H_
10 #define __PBIO_API__PBIO__TEMPLATES_INDEX_H_
11 
12 
13 #include <ostream>
14 #include <sstream>
15 
16 
17 #include "ComplexObject.h"
18 #include "Error.h"
19 #include "SmartPtr.h"
20 #include "stl_wraps_impls/WrapOStreamImpl.h"
21 
22 
23 
24 
25 namespace pbio
26 {
27 
28 class Recognizer;
29 
35 class TemplatesIndex : public ComplexObject
36 {
37 public:
38 
44  typedef LightSmartPtr<TemplatesIndex>::tPtr Ptr;
45 
63  std::string getMethodName() const;
64 
82  size_t size() const;
83 
107  pbio::Template::Ptr at(size_t i) const;
108 
109 
130  void reserveSearchMemory(const int queries_count) const;
131 
132 private:
133 
135  const DHPtr &dll_handle,
136  void* impl);
137 
138  friend class Recognizer;
139  friend class object_with_ref_counter<TemplatesIndex>;
140 };
141 
142 } // pbio namespace
143 
144 
145 
146 
150 
151 namespace pbio
152 {
153 
154 inline
155 TemplatesIndex::TemplatesIndex(
156  const DHPtr &dll_handle,
157  void* impl):
158 ComplexObject(dll_handle, impl)
159 {
160  // nothing else
161 }
162 
163 
164 
165 inline
166 std::string TemplatesIndex::getMethodName() const
167 {
168  std::ostringstream name_stream;
169  pbio::stl_wraps::WrapOStreamImpl name_stream_wrap(name_stream);
170 
171  void* exception = NULL;
172 
173  _dll_handle->TemplatesIndex_getMethodName(
174  _impl,
175  &name_stream_wrap,
176  pbio::stl_wraps::WrapOStream::write_func,
177  &exception);
178 
179  checkException(exception, *_dll_handle);
180 
181  return name_stream.str();
182 }
183 
184 
185 inline
186 size_t TemplatesIndex::size() const
187 {
188  void* exception = NULL;
189 
190  const size_t size = _dll_handle->TemplatesIndex_size(
191  _impl,
192  &exception);
193 
194  checkException(exception, *_dll_handle);
195 
196  return size;
197 }
198 
199 
200 inline
202 {
203  void* exception = NULL;
204 
205  pbio::facerec::TemplateImpl* const result_impl = _dll_handle->TemplatesIndex_at(
206  _impl,
207  i,
208  &exception);
209 
210  checkException(exception, *_dll_handle);
211 
212  return Template::Ptr::make(_dll_handle, result_impl);
213 }
214 
215 
216 inline
217 void TemplatesIndex::reserveSearchMemory(const int queries_count) const
218 {
219  void* exception = NULL;
220 
221  _dll_handle->TemplatesIndex_reserveSearchMemory(
222  _impl,
223  queries_count,
224  &exception);
225 
226  checkException(exception, *_dll_handle);
227 }
228 
229 
230 } // pbio namespace
231 #endif // __PBIO_API__PBIO__TEMPLATES_INDEX_H_
size_t size() const
Получить количество шаблонов в индексе. Потокобезопасный.
Definition: TemplatesIndex.h:186
Интерфейсный объект для работы с индексом шаблонов.
Definition: TemplatesIndex.h:35
std::string getMethodName() const
Получить имя метода. Потокобезопасный.
Definition: TemplatesIndex.h:166
Интерфейсный объект для создания и сравнения шаблонов.
Definition: Recognizer.h:37
LightSmartPtr< Template >::tPtr Ptr
Псевдоним для типа умного указателя на Template.
Definition: Template.h:46
LightSmartPtr< TemplatesIndex >::tPtr Ptr
Псевдоним для типа умного указателя на TemplatesIndex.
Definition: TemplatesIndex.h:44
Error - класс исключений, выбрасываемых при возникновении ошибок.
void reserveSearchMemory(const int queries_count) const
Зарезервировать память для временных буферов, используемых при поиске. Эти временные буферы требуют 8...
Definition: TemplatesIndex.h:217
SmartPtr.
pbio::Template::Ptr at(size_t i) const
Получить i-й шаблон. Потокобезопасный.
Definition: TemplatesIndex.h:201