12 #ifndef WITHOUT_PROCESSING_BLOCK
22 #include <unordered_map>
24 #include <pbio/DllHandle.h>
25 #include <pbio/RawImage.h>
30 typedef LightSmartPtr<import::DllHandle>::tPtr DHPtr;
32 inline void tdvCheckException(
const DHPtr& dll_handle, ContextEH*& out_exception) {
35 auto err = Error(dll_handle->TDVException_getErrorCode(out_exception), dll_handle->TDVException_getMessage(out_exception));
36 dll_handle->TDVException_deleteException(out_exception);
37 out_exception =
nullptr;
57 template<
bool isConst=false>
58 class ContextArrayIterator
64 charsList(
size_t length,
char** ptr) : length_(length), ptr_(ptr) {}
66 return (index<length_) ? *(ptr_+index) :
nullptr;
75 std::shared_ptr<charsList> keys_;
77 void charsList_deleter(charsList* ptr) {
78 for(
size_t indx=0; indx < ptr->length_; ++indx)
79 base_.dll_handle->TDVContext_freePtr(ptr->ptr_[indx]);
80 base_.dll_handle->TDVContext_freePtr(ptr->ptr_);
84 typedef std::ptrdiff_t difference_type;
85 typedef std::forward_iterator_tag iterator_category;
87 typedef typename std::conditional<isConst, const value_type*, value_type*>::type pointer;
88 typedef typename std::conditional<isConst, const value_type&, value_type&>::type reference;
89 typedef const value_type& const_reference;
91 ContextArrayIterator(
const Context& ctx,
long long index);
92 ContextArrayIterator(
const Context& ctx,
const std::string& key);
94 ContextArrayIterator(
const ContextArrayIterator& iter);
95 ContextArrayIterator& operator=(
const ContextArrayIterator& iter) =
delete;
96 ContextArrayIterator(ContextArrayIterator&& iter);
97 ContextArrayIterator& operator=(ContextArrayIterator&& iter) =
delete;
99 ~ContextArrayIterator() {
104 bool operator==(
const ContextArrayIterator& other)
const {
105 return ((this->base_ == other.base_) && (this->curr_ == other.curr_));
108 bool operator!=(
const ContextArrayIterator& other)
const {
109 return (!(this->base_ == other.base_) || !(this->curr_ == other.curr_));
112 ContextArrayIterator& operator++();
113 ContextArrayIterator operator++(
int);
115 reference operator*() {
119 pointer operator->() {
123 std::string key()
const {
124 if (keys_ && index_ < length_)
125 return std::string(keys_->operator[](index_));
126 return std::string();
143 Context(
const DHPtr& dll_handle) : dll_handle(dll_handle), weak_(
false), eh_(
nullptr) {
144 handle_ = dll_handle->TDVContext_create(&eh_);
145 tdvCheckException(dll_handle, eh_);
148 Context(
const DHPtr& dll_handle, HContext* handle,
bool weak =
true) : dll_handle(dll_handle), weak_(weak), eh_(
nullptr) {
153 handle_ = dll_handle->TDVContext_clone(handle, &eh_);
154 tdvCheckException(dll_handle, eh_);
158 Context(
const DHPtr& dll_handle,
const uint8_t* data, uint64_t dataSize) :
159 dll_handle(dll_handle),
163 handle_ = dll_handle->TDVContext_createFromEncodedImage(data, dataSize, &eh_);
164 tdvCheckException(dll_handle, eh_);
167 Context(
const DHPtr& dll_handle, uint8_t* data, int32_t width, int32_t height, Format format, int32_t baseAngle) :
168 dll_handle(dll_handle),
172 handle_ = dll_handle->TDVContext_createFromFrame(data, width, height, static_cast<int32_t>(format), baseAngle, &eh_);
173 tdvCheckException(dll_handle, eh_);
176 Context(
const DHPtr& dll_handle,
const char* path) :
177 dll_handle(dll_handle),
181 handle_ = dll_handle->TDVContext_createFromJsonFile(path, &eh_);
182 tdvCheckException(dll_handle, eh_);
188 mutable ContextEH* eh_;
197 dll_handle->TDVContext_destroy(handle_, &eh_);
198 if (eh_ && std::uncaught_exception())
199 std::cerr <<
Error(dll_handle->TDVException_getErrorCode(eh_), dll_handle->TDVException_getMessage(eh_)).what();
201 tdvCheckException(dll_handle, eh_);
205 Context(
const Context& other) : dll_handle(other.dll_handle), weak_(
false), eh_(
nullptr) {
206 handle_ = dll_handle->TDVContext_clone(other.handle_, &eh_);
207 tdvCheckException(dll_handle, eh_);
214 dll_handle->TDVContext_copy(other.handle_, handle_, &eh_);
216 HContext* copy = dll_handle->TDVContext_clone(other.handle_, &eh_);
217 tdvCheckException(dll_handle, eh_);
218 std::swap(handle_, copy);
219 dll_handle->TDVContext_destroy(copy, &eh_);
221 tdvCheckException(dll_handle, eh_);
226 Context(
Context&& other) : dll_handle(other.dll_handle), weak_(
false), eh_(
nullptr) {
229 handle_ = dll_handle->TDVContext_clone(other.handle_, &eh_);
230 tdvCheckException(dll_handle, eh_);
234 handle_ = other.handle_;
235 other.handle_ =
nullptr;
244 dll_handle->TDVContext_copy(other.handle_, handle_, &eh_);
245 tdvCheckException(dll_handle, eh_);
251 HContext* copy = dll_handle->TDVContext_clone(other.handle_, &eh_);
252 tdvCheckException(dll_handle, eh_);
253 std::swap(handle_, copy);
254 dll_handle->TDVContext_destroy(copy, &eh_);
255 tdvCheckException(dll_handle, eh_);
259 handle_ = other.handle_;
260 other.handle_ =
nullptr;
278 template <typename T, typename = typename std::enable_if<!std::is_base_of<Context, typename std::decay<T>::type>::value>::type>
280 setValue(std::forward<T>(value));
284 bool operator==(
const Context& other)
const
285 {
return this->handle_ == other.handle_;}
296 size_t lenght = dll_handle->TDVContext_getLength(handle_, &eh_);
297 tdvCheckException(dll_handle, eh_);
301 ContextArrayIterator<> begin(){
302 return ContextArrayIterator<>(*
this, 0);
305 ContextArrayIterator<> end(){
306 return ContextArrayIterator<>(*
this, -1);
309 ContextArrayIterator<true> begin()
const {
310 return ContextArrayIterator<true>(*
this, 0);
313 ContextArrayIterator<true> end()
const {
314 return ContextArrayIterator<true>(*
this, -1);
317 ContextArrayIterator<true> cbegin()
const {
318 return ContextArrayIterator<true>(*
this, 0);
321 ContextArrayIterator<true> cend()
const {
322 return ContextArrayIterator<true>(*
this, -1);
346 const Ref
operator[](
const std::string& key)
const;
350 Ref at(
const char* key);
351 Ref at(
const std::string& key);
352 Ref at(
const int index);
354 const Ref at(
const char* key)
const;
355 const Ref at(
const std::string& key)
const;
356 const Ref at(
const int index)
const;
369 bool result = dll_handle->TDVContext_contains(handle_, key.data(), &eh_);
370 tdvCheckException(dll_handle, eh_);
386 bool result = dll_handle->TDVContext_compare(handle_, other.handle_, &eh_);
387 tdvCheckException(dll_handle, eh_);
401 size_t length =
size();
403 auto keys = dll_handle->TDVContext_getKeys(handle_, length, &eh_);
404 tdvCheckException(dll_handle, eh_);
406 std::vector<std::string> result(length);
407 for (
size_t i = 0; i < length; ++i)
408 result.emplace_back(keys[i]);
413 ContextArrayIterator<> find(
const std::string& key) {
414 return ContextArrayIterator<>(*
this, key);
417 ContextArrayIterator<true> find(
const std::string& key)
const {
418 return ContextArrayIterator<true>(*
this, key);
422 typename std::enable_if<!std::is_base_of<Context, typename std::decay<T>::type>::value>::type push_back(T&& data) {
424 elem.setValue(std::forward<T>(data));
426 push_back(std::move(elem));
438 dll_handle->TDVContext_pushBack(handle_, data.handle_,
true, &eh_);
439 tdvCheckException(dll_handle, eh_);
442 void push_back(
Context&& data) {
443 dll_handle->TDVContext_pushBack(handle_, data.handle_, weak_, &eh_);
444 tdvCheckException(dll_handle, eh_);
456 double ret = dll_handle->TDVContext_getDouble(handle_, &eh_);
457 tdvCheckException(dll_handle, eh_);
470 long ret = dll_handle->TDVContext_getLong(handle_, &eh_);
471 tdvCheckException(dll_handle, eh_);
484 bool ret = dll_handle->TDVContext_getBool(handle_, &eh_);
485 tdvCheckException(dll_handle, eh_);
498 unsigned long str_size = dll_handle->TDVContext_getStrSize(handle_, &eh_);
499 tdvCheckException(dll_handle, eh_);
501 ret.resize(str_size);
502 dll_handle->TDVContext_getStr(handle_, &ret[0], &eh_);
503 tdvCheckException(dll_handle, eh_);
516 unsigned char* ret = dll_handle->TDVContext_getDataPtr(handle_, &eh_);
517 tdvCheckException(dll_handle, eh_);
530 dll_handle->TDVContext_putStr(handle_, str, &eh_);
531 tdvCheckException(dll_handle, eh_);
543 dll_handle->TDVContext_putStr(handle_, str.c_str(), &eh_);
544 tdvCheckException(dll_handle, eh_);
556 dll_handle->TDVContext_putLong(handle_, val, &eh_);
557 tdvCheckException(dll_handle, eh_);
569 dll_handle->TDVContext_putDouble(handle_, val, &eh_);
570 tdvCheckException(dll_handle, eh_);
582 dll_handle->TDVContext_putBool(handle_, val, &eh_);
583 tdvCheckException(dll_handle, eh_);
597 unsigned char* ret{
nullptr};
599 ret = dll_handle->TDVContext_allocDataPtr(handle_, copy_sz, &eh_);
601 ret = dll_handle->TDVContext_putDataPtr(handle_, static_cast<unsigned char*>(ptr), copy_sz, &eh_);
602 tdvCheckException(dll_handle, eh_);
606 unsigned char*
setDataPtr(
const void* ptr,
int copy_sz) {
607 unsigned char* ret = dll_handle->TDVContext_putConstDataPtr(handle_, static_cast<const unsigned char*>(ptr), copy_sz, &eh_);
608 tdvCheckException(dll_handle, eh_);
621 bool value = dll_handle->TDVContext_isNone(handle_, &eh_);
622 tdvCheckException(dll_handle, eh_);
635 bool value = dll_handle->TDVContext_isArray(handle_, &eh_);
636 tdvCheckException(dll_handle, eh_);
649 bool value = dll_handle->TDVContext_isObject(handle_, &eh_);
650 tdvCheckException(dll_handle, eh_);
663 bool val = dll_handle->TDVContext_isBool(handle_, &eh_);
664 tdvCheckException(dll_handle, eh_);
677 bool val = dll_handle->TDVContext_isLong(handle_, &eh_);
678 tdvCheckException(dll_handle, eh_);
691 bool val = dll_handle->TDVContext_isDouble(handle_, &eh_);
692 tdvCheckException(dll_handle, eh_);
705 bool val = dll_handle->TDVContext_isString(handle_, &eh_);
706 tdvCheckException(dll_handle, eh_);
719 bool val = dll_handle->TDVContext_isDataPtr(handle_, &eh_);
720 tdvCheckException(dll_handle, eh_);
724 HContext* getHandle() {
return handle_;}
725 const HContext* getHandle()
const {
return handle_;}
734 dll_handle->TDVContext_clear(handle_, &eh_);
735 tdvCheckException(dll_handle,eh_);
747 dll_handle->TDVContext_erase(handle_, str, &eh_);
748 tdvCheckException(dll_handle,eh_);
759 void erase(
const std::string& str) {
772 dll_handle->TDVContext_reserve(handle_, size, &eh_);
773 tdvCheckException(dll_handle,eh_);
786 dll_handle->TDVContext_saveToJsonFile(handle_, path.c_str(), &eh_);
787 tdvCheckException(dll_handle,eh_);
800 dll_handle->TDVContext_saveToJsonFile(handle_, path, &eh_);
801 tdvCheckException(dll_handle,eh_);
806 void setValue(
const char* str) {
807 dll_handle->TDVContext_putStr(handle_, str, &eh_);
808 tdvCheckException(dll_handle, eh_);
810 void setValue(
const std::string& str) {
811 dll_handle->TDVContext_putStr(handle_, str.c_str(), &eh_);
812 tdvCheckException(dll_handle, eh_);
815 template<typename T, typename = typename std::enable_if<std::is_enum<T>::value || std::is_integral<T>::value>::type>
816 void setValue(T val) {
817 dll_handle->TDVContext_putLong(handle_, val, &eh_);
818 tdvCheckException(dll_handle, eh_);
821 void setValue(
double val) {
822 dll_handle->TDVContext_putDouble(handle_, val, &eh_);
823 tdvCheckException(dll_handle, eh_);
825 void setValue(
float val) {
826 dll_handle->TDVContext_putDouble(handle_, val, &eh_);
827 tdvCheckException(dll_handle, eh_);
829 void setValue(
bool val) {
830 dll_handle->TDVContext_putBool(handle_, val, &eh_);
831 tdvCheckException(dll_handle, eh_);
833 void setValue(
void* ptr,
int copy_sz = 0) {
834 dll_handle->TDVContext_putDataPtr(handle_, static_cast<unsigned char*>(ptr), copy_sz, &eh_);
835 tdvCheckException(dll_handle, eh_);
842 ContextRef(
const DHPtr &dll_handle, HContext* handle) :
Context(dll_handle ,handle,
true) {}
846 template <typename T, typename = typename std::enable_if<!std::is_base_of<Context, typename std::decay<T>::type>::value>::type>
847 void operator=(T&& value) {
848 setValue(std::forward<T>(value));
852 template<
bool isConst>
853 Context::ContextArrayIterator<isConst>::ContextArrayIterator(
const Context& ctx,
long long index) : base_(ctx), curr_(nullptr), isObj_(ctx.isObject())
855 length_ = base_.dll_handle->TDVContext_getLength(base_.handle_, &(base_.eh_));
856 tdvCheckException(base_.dll_handle, base_.eh_);
857 index_ = (index > -1) ? std::min<size_t>(static_cast<size_t>(index), length_) : length_;
858 if(index_ < length_) {
861 auto keys = base_.dll_handle->TDVContext_getKeys(base_.handle_, length_, &(base_.eh_));
862 tdvCheckException(base_.dll_handle, base_.eh_);
863 keys_ = std::shared_ptr<charsList>(
new charsList(length_, keys), std::bind(&ContextArrayIterator::charsList_deleter,
this, std::placeholders::_1));
864 curr_ =
new Context(base_[keys_->operator[](index)]);
867 curr_ =
new Context(base_[index]);
871 template<
bool isConst>
872 Context::ContextArrayIterator<isConst>::ContextArrayIterator(
const Context& ctx,
const std::string& key) : base_(ctx), curr_(nullptr), isObj_(ctx.isObject())
874 length_ = base_.dll_handle->TDVContext_getLength(base_.handle_, &(base_.eh_));
875 tdvCheckException(base_.dll_handle, base_.eh_);
877 if(isObj_ && length_) {
878 auto keys = base_.dll_handle->TDVContext_getKeys(base_.handle_, length_, &(base_.eh_));
879 tdvCheckException(base_.dll_handle, base_.eh_);
880 keys_ = std::shared_ptr<charsList>(
new charsList(length_, keys), std::bind(&ContextArrayIterator::charsList_deleter,
this, std::placeholders::_1));
883 if(!key.compare(keys_->operator[](i))) {
885 curr_ =
new Context(base_[key]);
888 }
while((++i)<length_);
892 template<
bool isConst>
893 Context::ContextArrayIterator<isConst>::ContextArrayIterator(
const ContextArrayIterator& iter) :
894 base_(iter.base_), length_(iter.length_), index_(iter.index_), curr_(iter.curr_ ? new
Context(*(iter.curr_)) : nullptr), isObj_(iter.isObj_), keys_(iter.keys_)
897 template<
bool isConst>
898 Context::ContextArrayIterator<isConst>::ContextArrayIterator(ContextArrayIterator&& iter) :
899 base_(iter.base_), length_(iter.length_), index_(iter.index_), curr_(iter.curr_), isObj_(iter.isObj_), keys_(std::move(iter.keys_)) {
900 iter.curr_ =
nullptr;
903 template<
bool isConst>
904 Context::ContextArrayIterator<isConst>& Context::ContextArrayIterator<isConst>::operator++() {
907 index_ = std::min(index_+1, length_);
909 curr_ = (index_ < length_) ?
new Context(base_[keys_->operator[](index_)]) :
nullptr;
911 curr_ = (index_ < length_) ?
new Context(base_[index_]) :
nullptr;
915 template<
bool isConst>
916 Context::ContextArrayIterator<isConst> Context::ContextArrayIterator<isConst>::operator++(
int) {
917 ContextArrayIterator tmp = *
this;
918 index_ = std::min(index_+1, length_);
920 curr_ = (index_ < length_) ?
new Context(base_[keys_->operator[](index_)]) :
nullptr;
922 curr_ = (index_ < length_) ?
new Context(base_[index_]) :
nullptr;
926 inline Context::operator ContextRef()
928 return ContextRef(dll_handle, handle_);
932 HContext* handle = dll_handle->TDVContext_getOrInsertByKey(handle_, key.c_str(), &eh_);
933 tdvCheckException(dll_handle, eh_);
934 return Ref(dll_handle, handle);
938 HContext* handle = dll_handle->TDVContext_getOrInsertByKey(handle_, key, &eh_);
939 tdvCheckException(dll_handle, eh_);
940 return Ref(dll_handle, handle);
944 HContext* handle = dll_handle->TDVContext_getByIndex(handle_, index, &eh_);
945 tdvCheckException(dll_handle, eh_);
946 return Ref(dll_handle, handle);
950 HContext* handle = dll_handle->TDVContext_getByKey(handle_, key.c_str(), &eh_);
951 tdvCheckException(dll_handle, eh_);
952 return Ref(dll_handle, handle);
956 HContext* handle = dll_handle->TDVContext_getByKey(handle_, key, &eh_);
957 tdvCheckException(dll_handle, eh_);
958 return Ref(dll_handle, handle);
962 HContext* handle = dll_handle->TDVContext_getByIndex(handle_, index, &eh_);
963 tdvCheckException(dll_handle, eh_);
964 return Ref(dll_handle, handle);
967 inline Context::Ref Context::at(
const char* key) {
968 HContext* handle = dll_handle->TDVContext_getByKey(handle_, key, &eh_);
969 tdvCheckException(dll_handle, eh_);
970 return Ref(dll_handle, handle);
973 inline Context::Ref Context::at(
const std::string& key) {
974 HContext* handle = dll_handle->TDVContext_getByKey(handle_, key.c_str(), &eh_);
975 tdvCheckException(dll_handle, eh_);
976 return Ref(dll_handle, handle);
979 inline Context::Ref Context::at(
const int index) {
980 HContext* handle = dll_handle->TDVContext_getByIndex(handle_, index, &eh_);
981 tdvCheckException(dll_handle, eh_);
982 return Ref(dll_handle, handle);
985 inline const Context::Ref Context::at(
const char* key)
const {
986 HContext* handle = dll_handle->TDVContext_getByKey(handle_, key, &eh_);
987 tdvCheckException(dll_handle, eh_);
988 return Ref(dll_handle, handle);
991 inline const Context::Ref Context::at(
const std::string& key)
const {
992 HContext* handle = dll_handle->TDVContext_getByKey(handle_, key.c_str(), &eh_);
993 tdvCheckException(dll_handle, eh_);
994 return Ref(dll_handle, handle);
997 inline const Context::Ref Context::at(
const int index)
const {
998 HContext* handle = dll_handle->TDVContext_getByIndex(handle_, index, &eh_);
999 tdvCheckException(dll_handle, eh_);
1000 return Ref(dll_handle, handle);
1004 namespace context_utils {
1010 ctx[
"format"] =
"NDARRAY";
1011 ctx[
"color_space"] = color_mode.at(raw_image.format);
1013 size_t copy_sz = raw_image.
height * raw_image.
width * channels *
sizeof(uint8_t);
1014 if (raw_image.with_crop)
1016 unsigned char* buff{
nullptr};
1017 buff = ctx[
"blob"].setDataPtr(buff, copy_sz);
1018 size_t shift = (raw_image.crop_info_offset_y*raw_image.crop_info_data_image_width + raw_image.crop_info_offset_x)*channels*
sizeof(uint8_t);
1019 size_t stride = raw_image.
width*channels*
sizeof(uint8_t);
1020 unsigned char* ptr = buff;
1021 for(
int row=0; row<raw_image.
height; ++row)
1023 std::memcpy(ptr, raw_image.
data+shift, stride);
1024 shift += raw_image.crop_info_data_image_width*channels*
sizeof(uint8_t);
1029 ctx[
"blob"].setDataPtr(raw_image.
data, copy_sz);
1030 ctx[
"dtype"] =
"uint8_t";
1031 ctx[
"shape"].push_back(static_cast<int64_t>(raw_image.
height));
1032 ctx[
"shape"].push_back(static_cast<int64_t>(raw_image.
width));
1033 ctx[
"shape"].push_back(static_cast<int64_t>(channels));
1038 ctx[
"format"] =
"NDARRAY";
1039 ctx[
"color_space"] = color_mode.at(format);
1041 size_t copy_sz = copy ? height * width * channels *
sizeof(uint8_t) : 0;
1042 ctx[
"blob"].setDataPtr(data, copy_sz);
1043 ctx[
"dtype"] =
"uint8_t";
1044 ctx[
"shape"].push_back(static_cast<int64_t>(height));
1045 ctx[
"shape"].push_back(static_cast<int64_t>(width));
1046 ctx[
"shape"].push_back(static_cast<int64_t>(channels));
1052 #endif // WITHOUT_PROCESSING_BLOCK
bool isString() const
checks whether the container is a long type string
Definition: Context.h:704
Interface object for creating other interface objects.
Definition: FacerecService.h:64
RGB, 24 bit per pixel, 8 bit per channel.
Definition: IRawImage.h:60
bool isDataPtr() const
checks whether the container is a pointer to the data
Definition: Context.h:718
Interface object that stores a captured face sample.
Definition: RawSample.h:49
void saveToJsonFile(std::string &path)
saves the contents of the container to a json file
Definition: Context.h:784
void erase(const char *str)
deletes the contents of the container-Context stored by key.
Definition: Context.h:746
void setString(const char *str)
adds a value of type string to the container
Definition: Context.h:529
void erase(const std::string &str)
deletes the contents of the container-Context stored by key.
Definition: Context.h:759
void saveToJsonFile(const char *path)
saves the contents of the container to a json file
Definition: Context.h:798
void reserve(const size_t size)
allocates memory for num elements in the array.
Definition: Context.h:771
Grayscale, 8 bit per pixel.
Definition: IRawImage.h:53
void setDouble(double val)
adds a value of type double to the container
Definition: Context.h:568
std::vector< std::string > getKeys()
returns a list of keys in the container-Context
Definition: Context.h:400
void setString(const std::string &str)
adds a value of type std::string to the container
Definition: Context.h:542
unsigned char * getDataPtr() const
returns a pointer to data from the container
Definition: Context.h:515
bool isDouble() const
checks whether the container is a long type double
Definition: Context.h:690
void push_back(const Context &data)
adds a object to the container.
Definition: Context.h:437
bool compare(const Context &other) const
compares two Context objects
Definition: Context.h:385
bool isBool() const
checks whether the container is a bool type value
Definition: Context.h:662
void clear()
clears the contents of the container-Context.
Definition: Context.h:733
BGR, 24 bit per pixel, 8 bit per channel.
Definition: IRawImage.h:67
size_t size() const
Get the size of the container.
Definition: Context.h:295
bool contains(const std::string &key) const
checks the existence of an element by a specific key
Definition: Context.h:368
bool isNone() const
checks if there are no elements in the container
Definition: Context.h:620
The class of exceptions thrown when errors occur.
Definition: Error.h:26
Context & operator=(T &&value)
adds a value to the container
Definition: Context.h:279
bool isLong() const
проверяет является ли контейнер значением типа long.
Definition: Context.h:676
void clear()
clears the contents of the container-Context.
Definition: Context.mm:129
long getLong() const
returns a long value from the container
Definition: Context.h:469
bool isObject() const
checks whether the container is an object
Definition: Context.h:648
Definition: Context.h:839
double getDouble() const
returns a double value from the container
Definition: Context.h:455
void setLong(long val)
adds a value of type long to the container
Definition: Context.h:555
bool getBool() const
returns a bool value from the container
Definition: Context.h:483
Context is an interface object for storing data and interacting with methods from the Processing Bloc...
Definition: Context.h:51
unsigned char * setDataPtr(void *ptr, int copy_sz=0)
adds a pointer to the data in the container
Definition: Context.h:596
std::string getString() const
returns a std::string value from the container
Definition: Context.h:497
void setBool(bool val)
adds a value of type bool to the container
Definition: Context.h:581
Context is an interface object for storing data and interacting with methods from the Processing Bloc...
Definition: Context.h:65
bool isArray() const
checks whether the container is an array
Definition: Context.h:634
int height
Image height.
Definition: RawImage.h:117
const unsigned char * data
Pointer to the image data buffer. All pixels must be stored continuously, row by row, without gaps at the end of each row.
Definition: RawImage.h:118
Format
Format of image data.
Definition: IRawImage.h:46
Struct that provides raw image data and optional cropping information.
Definition: RawImage.h:113
int width
Image width.
Definition: RawImage.h:116
Ref operator[](const std::string &key)
indexing by key.
Definition: Context.h:931