3DiVi Face SDK  3.21.0
 Указатель Классы Пространства имен Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Свойства Группы
ProcessingBlock.h
См. документацию.
1 
9 #ifndef PROCESSINGBLOCK_H
10 #define PROCESSINGBLOCK_H
11 
12 #ifndef WITHOUT_PROCESSING_BLOCK
13 
14 #include "Context.h"
15 #include "DllHandle.h"
16 #include "ExceptionCheck.h"
17 
18 namespace pbio
19 {
20 
21 class FacerecService;
22 
30 {
31 public:
32 
33  ProcessingBlock(const ProcessingBlock&) = delete;
34  ProcessingBlock& operator=(const ProcessingBlock&) = delete;
35  ProcessingBlock(ProcessingBlock&& other) : dll_handle_(other.dll_handle_), eh_(nullptr)
36  {
37  handle_ = other.handle_;
38  other.handle_ = nullptr;
39  };
40  ProcessingBlock& operator=(ProcessingBlock&& other)
41  {
42  if (&other != this)
43  {
44  handle_ = other.handle_;
45  other.handle_ = nullptr;
46  }
47  return *this;
48  }
49 
50  virtual void operator()(pbio::Context& ctx)
51  {
52  dll_handle_->TDVProcessingBlock_processContext(handle_, ctx.getHandle(), &eh_);
53  tdvCheckException(dll_handle_, eh_);
54  }
55 
56  ~ProcessingBlock() {
57  if(handle_)
58  {
59  dll_handle_->TDVProcessingBlock_destroyBlock(handle_, &eh_);
60  if (eh_ && std::uncaught_exception())
61  std::cerr << Error(dll_handle_->TDVException_getErrorCode(eh_), dll_handle_->TDVException_getMessage(eh_)).what();
62  else
63  tdvCheckException(dll_handle_, eh_);
64  handle_ = nullptr;
65  }
66  }
67 
68 private:
69 
70  ProcessingBlock(void* service, const DHPtr &dll_handle, const pbio::Context& ctx) : dll_handle_(dll_handle), eh_(nullptr) {
71  void* exception = nullptr;
72  handle_ = dll_handle_->FacerecService_ProcessingBlock_createProcessingBlock(service, ctx.getHandle(), &exception);
73  checkException(exception, *dll_handle_);
74  }
75 
77 
78  const DHPtr dll_handle_;
79  mutable ContextEH* eh_;
80  HPBlock* handle_;
81 
82  friend class FacerecService;
83 };
84 }
85 
86 #endif // WITHOUT_PROCESSING_BLOCK
87 #endif // PROCESSINGBLOCK_H
Интерфейсный объект для взаимодействия с методами из Processing Block API.
Definition: ProcessingBlock.h:29
Интерфейсный объект для создания других интерфейсных объектов.
Definition: FacerecService.h:64
Definition: SmartPtr.h:84
Класс исключений, выбрасываемых при возникновении ошибок.
Definition: Error.h:26
Definition: Context.h:37