9 #ifndef __PBIO_API__PBIO__TEMPLATES_INDEX_H_
10 #define __PBIO_API__PBIO__TEMPLATES_INDEX_H_
19 #include "ComplexObject.h"
22 #include "stl_wraps_impls/WrapOStreamImpl.h"
46 typedef LightSmartPtr<TemplatesIndex>::tPtr
Ptr;
136 void remove(
const std::string& uuid);
138 void remove(
const std::vector<std::string>& uuids);
145 const DHPtr &dll_handle,
165 TemplatesIndex::TemplatesIndex(
166 const DHPtr &dll_handle,
168 ComplexObject(dll_handle, impl)
178 std::ostringstream name_stream;
179 pbio::stl_wraps::WrapOStreamImpl name_stream_wrap(name_stream);
181 void* exception = NULL;
183 _dll_handle->TemplatesIndex_getMethodName(
186 pbio::stl_wraps::WrapOStream::write_func,
189 checkException(exception, *_dll_handle);
191 return name_stream.str();
198 void* exception = NULL;
200 const size_t size = _dll_handle->TemplatesIndex_size(
204 checkException(exception, *_dll_handle);
213 void* exception = NULL;
215 pbio::facerec::TemplateImpl*
const result_impl = _dll_handle->TemplatesIndex_at(
220 checkException(exception, *_dll_handle);
222 return Template::Ptr::make(_dll_handle, result_impl);
229 void* exception = NULL;
231 _dll_handle->TemplatesIndex_reserveSearchMemory(
236 checkException(exception, *_dll_handle);
241 void* exception = NULL;
243 _dll_handle->ResizableTemplatesIndex_add_1(_impl, static_cast<pbio::facerec::TemplateImpl*>(templ->_impl), uuid.data(), &exception);
245 checkException(exception, *_dll_handle);
248 inline void TemplatesIndex::remove(
const std::string& uuid)
250 void* exception = NULL;
252 _dll_handle->ResizableTemplatesIndex_remove_1(_impl, uuid.data(), &exception);
254 checkException(exception, *_dll_handle);
257 inline void TemplatesIndex::remove(
const std::vector<std::string>& uuids)
259 void* exception = NULL;
261 const char** data =
new const char*[uuids.size()];
263 for (
size_t i = 0; i < uuids.size(); i++)
265 data[i] = uuids[i].data();
268 _dll_handle->ResizableTemplatesIndex_remove_2(_impl, data, uuids.size(), &exception);
272 checkException(exception, *_dll_handle);
277 void* exception = NULL;
279 _dll_handle->ResizableTemplatesIndex_concatenate(_impl, otherIndex->_impl, &exception);
281 checkException(exception, *_dll_handle);
285 #endif // __PBIO_API__PBIO__TEMPLATES_INDEX_H_
size_t size() const
Get a number of templates in the index. Thread-safe.
Definition: TemplatesIndex.h:196
Interface object for working with the template index.
Definition: TemplatesIndex.h:37
std::string getMethodName() const
Get a method name. Thread-safe.
Definition: TemplatesIndex.h:176
Definition: Recognizer.h:64
Interface object for creating and matching templates.
Definition: Recognizer.h:37
LightSmartPtr< Template >::tPtr Ptr
Alias for the type of a smart pointer to Template.
Definition: Template.h:46
LightSmartPtr< TemplatesIndex >::tPtr Ptr
Alias for the type of a smart pointer to TemplatesIndex.
Definition: TemplatesIndex.h:46
Error - the class of exceptions thrown when errors occur.
void reserveSearchMemory(const int queries_count) const
Reserve memory for temporary buffers used while searching. These temporary buffers require 8 * size()...
Definition: TemplatesIndex.h:227
pbio::Template::Ptr at(size_t i) const
Get an i-th template. Thread-safe.
Definition: TemplatesIndex.h:211