3DiVi Face SDK  3.25.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
Template.h
1 
9 #ifndef __PBIO_API__PBIO__TEMPLATE_H_
10 #define __PBIO_API__PBIO__TEMPLATE_H_
11 
12 
13 #include <ostream>
14 #include <sstream>
15 
16 
17 #include "ComplexObject.h"
18 #include "Error.h"
19 #include "ExceptionCheck.h"
20 #include "SmartPtr.h"
21 #include "stl_wraps_impls/WrapOStreamImpl.h"
22 
23 
24 
25 namespace pbio
26 {
27 
28 class Recognizer;
29 class VideoWorker;
30 class TemplatesIndex;
31 
37 class Template : public ComplexObject
38 {
39 public:
40 
47 
65  std::string getMethodName() const;
66 
67 
89  void save(std::ostream &binary_stream) const;
90 
112  void save(pbio::stl_wraps::WrapOStream &binary_stream) const;
113 
114 private:
115 
116  Template(
117  const DHPtr &dll_handle,
118  void* impl);
119 
120  friend class Recognizer;
121  friend class VideoWorker;
122  friend class TemplatesIndex;
123  friend class DynamicTemplateIndex;
124  friend class object_with_ref_counter<Template>;
125 };
126 
127 } // pbio namespace
128 
129 
130 
131 
135 
136 namespace pbio
137 {
138 
139 inline
140 Template::Template(
141  const DHPtr &dll_handle,
142  void* impl):
143 ComplexObject(dll_handle, impl)
144 {
145  // nothing else
146 }
147 
148 
149 inline
150 std::string Template::getMethodName() const
151 {
152  std::ostringstream name_stream;
153  pbio::stl_wraps::WrapOStreamImpl name_stream_wrap(name_stream);
154 
155  void* exception = NULL;
156 
157  _dll_handle->Template_getMethodName(
158  _impl,
159  &name_stream_wrap,
160  pbio::stl_wraps::WrapOStream::write_func,
161  &exception);
162 
163  checkException(exception, *_dll_handle);
164 
165  return name_stream.str();
166 }
167 
168 inline
169 void Template::save(std::ostream &binary_stream) const
170 {
171  pbio::stl_wraps::WrapOStreamImpl binary_stream_wrap(binary_stream);
172 
173  save(binary_stream_wrap);
174 }
175 
176 inline
177 void Template::save(pbio::stl_wraps::WrapOStream &binary_stream) const
178 {
179  void* exception = NULL;
180 
181  _dll_handle->Template_save(
182  _impl,
183  &binary_stream,
184  pbio::stl_wraps::WrapOStream::write_func,
185  &exception);
186 
187  checkException(exception, *_dll_handle);
188 }
189 
190 
191 
192 } // pbio namespace
193 #endif // __PBIO_API__PBIO__TEMPLATE_H_
Interface object for saving the face template.
Definition: Template.h:37
Interface object for working with the template index.
Definition: TemplatesIndex.h:37
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
Error - the class of exceptions thrown when errors occur.
VideoWorker is an interface object for tracking, processing and matching faces on multiple video stre...
Definition: VideoWorker.h:63
void save(std::ostream &binary_stream) const
Save the template to binary_stream. The format is platform-independent. Thread-safe.
Definition: Template.h:169
Definition: SmartPtr.h:84
std::string getMethodName() const
Get a method name. Thread-safe.
Definition: Template.h:150
VideoWorker is an interface object for tracking, processing and matching faces on multiple video stre...
Definition: VideoWorker.h:105
SmartPtr.
Interface object for working with the template index.
Definition: DynamicTemplateIndex.h:26