3DiVi Face SDK  3.24.2
 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 object_with_ref_counter<Template>;
124 };
125 
126 } // pbio namespace
127 
128 
129 
130 
134 
135 namespace pbio
136 {
137 
138 inline
139 Template::Template(
140  const DHPtr &dll_handle,
141  void* impl):
142 ComplexObject(dll_handle, impl)
143 {
144  // nothing else
145 }
146 
147 
148 inline
149 std::string Template::getMethodName() const
150 {
151  std::ostringstream name_stream;
152  pbio::stl_wraps::WrapOStreamImpl name_stream_wrap(name_stream);
153 
154  void* exception = NULL;
155 
156  _dll_handle->Template_getMethodName(
157  _impl,
158  &name_stream_wrap,
159  pbio::stl_wraps::WrapOStream::write_func,
160  &exception);
161 
162  checkException(exception, *_dll_handle);
163 
164  return name_stream.str();
165 }
166 
167 inline
168 void Template::save(std::ostream &binary_stream) const
169 {
170  pbio::stl_wraps::WrapOStreamImpl binary_stream_wrap(binary_stream);
171 
172  save(binary_stream_wrap);
173 }
174 
175 inline
176 void Template::save(pbio::stl_wraps::WrapOStream &binary_stream) const
177 {
178  void* exception = NULL;
179 
180  _dll_handle->Template_save(
181  _impl,
182  &binary_stream,
183  pbio::stl_wraps::WrapOStream::write_func,
184  &exception);
185 
186  checkException(exception, *_dll_handle);
187 }
188 
189 
190 
191 } // pbio namespace
192 #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:168
Definition: SmartPtr.h:84
std::string getMethodName() const
Get a method name. Thread-safe.
Definition: Template.h:149
VideoWorker is an interface object for tracking, processing and matching faces on multiple video stre...
Definition: VideoWorker.h:105
SmartPtr.