3DiVi Face SDK  3.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
pbio::Context Class Reference

Context is an interface object for storing data and interacting with methods from the Processing Block API. More...

#include <Context.h>

Public Member Functions

template<typename T , typename = typename std::enable_if<!std::is_base_of<Context, typename std::decay<T>::type>::value>::type>
Contextoperator= (T &&value)
 adds a value to the container More...
 
size_t size () const
 Get the size of the container. More...
 
Ref operator[] (const std::string &key)
 indexing by key. More...
 
Ref operator[] (const int index)
 indexing by index. More...
 
bool contains (const std::string &key) const
 checks the existence of an element by a specific key More...
 
bool compare (const Context &other) const
 compares two Context objects More...
 
std::vector< std::string > getKeys ()
 returns a list of keys in the container-Context More...
 
void push_back (const Context &data)
 adds a object to the container. More...
 
double getDouble () const
 returns a double value from the container More...
 
long getLong () const
 returns a long value from the container More...
 
bool getBool () const
 returns a bool value from the container More...
 
std::string getString () const
 returns a std::string value from the container More...
 
unsigned char * getDataPtr () const
 returns a pointer to data from the container More...
 
void setString (const char *str)
 adds a value of type string to the container More...
 
void setString (const std::string &str)
 adds a value of type std::string to the container More...
 
void setLong (long val)
 adds a value of type long to the container More...
 
void setDouble (double val)
 adds a value of type double to the container More...
 
void setBool (bool val)
 adds a value of type bool to the container More...
 
unsigned char * setDataPtr (void *ptr, int copy_sz=0)
 adds a pointer to the data in the container More...
 
bool isNone () const
 checks if there are no elements in the container More...
 
bool isArray () const
 checks whether the container is an array More...
 
bool isObject () const
 checks whether the container is an object More...
 
bool isBool () const
 checks whether the container is a bool type value More...
 
bool isLong () const
 проверяет является ли контейнер значением типа long. More...
 
bool isDouble () const
 checks whether the container is a long type double More...
 
bool isString () const
 checks whether the container is a long type string More...
 
bool isDataPtr () const
 checks whether the container is a pointer to the data More...
 
void clear ()
 clears the contents of the container-Context.
 
void erase (const char *str)
 deletes the contents of the container-Context stored by key. More...
 
void erase (const std::string &str)
 deletes the contents of the container-Context stored by key. More...
 
void reserve (const size_t size)
 allocates memory for num elements in the array. More...
 
void saveToJsonFile (std::string &path)
 saves the contents of the container to a json file More...
 
void saveToJsonFile (const char *path)
 saves the contents of the container to a json file More...
 

Detailed Description

Context is an interface object for storing data and interacting with methods from the Processing Block API.

Member Function Documentation

bool pbio::Context::compare ( const Context other) const
inline

compares two Context objects

Parameters
[in]other- container-Context
Returns
True if the objects are the same
bool pbio::Context::contains ( const std::string &  key) const
inline

checks the existence of an element by a specific key

Parameters
[in]key
Returns
True if the element exists
void pbio::Context::erase ( const char *  str)
inline

deletes the contents of the container-Context stored by key.

Parameters
[in]str.
void pbio::Context::erase ( const std::string &  str)
inline

deletes the contents of the container-Context stored by key.

Parameters
[in]key.
bool pbio::Context::getBool ( ) const
inline

returns a bool value from the container

Returns
value
unsigned char* pbio::Context::getDataPtr ( ) const
inline

returns a pointer to data from the container

Returns
pointer to data
double pbio::Context::getDouble ( ) const
inline

returns a double value from the container

Returns
value
std::vector<std::string> pbio::Context::getKeys ( )
inline

returns a list of keys in the container-Context

Returns
key list
long pbio::Context::getLong ( ) const
inline

returns a long value from the container

Returns
value
std::string pbio::Context::getString ( ) const
inline

returns a std::string value from the container

Returns
value
bool pbio::Context::isArray ( ) const
inline

checks whether the container is an array

Returns
True if the container is an array
bool pbio::Context::isBool ( ) const
inline

checks whether the container is a bool type value

Returns
True if the container is a bool type value
bool pbio::Context::isDataPtr ( ) const
inline

checks whether the container is a pointer to the data

Returns
True if the container is a pointer to the data
bool pbio::Context::isDouble ( ) const
inline

checks whether the container is a long type double

Returns
True if the container is a double type value
bool pbio::Context::isLong ( ) const
inline

проверяет является ли контейнер значением типа long.

Returns
True если контейнер является значением типа long
bool pbio::Context::isNone ( ) const
inline

checks if there are no elements in the container

Returns
True if the container is empty
bool pbio::Context::isObject ( ) const
inline

checks whether the container is an object

Returns
True if the container is an object
bool pbio::Context::isString ( ) const
inline

checks whether the container is a long type string

Returns
True if the container is a string type value
template<typename T , typename = typename std::enable_if<!std::is_base_of<Context, typename std::decay<T>::type>::value>::type>
Context& pbio::Context::operator= ( T &&  value)
inline

adds a value to the container

Returns
this
Context::Ref Context::operator[] ( const std::string &  key)
inline

indexing by key.

Parameters
[in]key
Context::Ref Context::operator[] ( const int  index)
inline

indexing by index.

Parameters
[in]index
void pbio::Context::push_back ( const Context data)
inline

adds a object to the container.

Parameters
[in]data- container-Context
void pbio::Context::reserve ( const size_t  size)
inline

allocates memory for num elements in the array.

Parameters
[in]size- the size of the array.
void pbio::Context::saveToJsonFile ( std::string &  path)
inline

saves the contents of the container to a json file

Parameters
[in]path- the path to the file
void pbio::Context::saveToJsonFile ( const char *  path)
inline

saves the contents of the container to a json file

Parameters
[in]path- the path to the file
void pbio::Context::setBool ( bool  val)
inline

adds a value of type bool to the container

Parameters
[in]val- bool value
unsigned char* pbio::Context::setDataPtr ( void *  ptr,
int  copy_sz = 0 
)
inline

adds a pointer to the data in the container

Parameters
[in]ptr- pointer to data
[in]copy_sz- the number of copied elements, if 0 is specified, then there will be no copying
void pbio::Context::setDouble ( double  val)
inline

adds a value of type double to the container

Parameters
[in]val- double value
void pbio::Context::setLong ( long  val)
inline

adds a value of type long to the container

Parameters
[in]val- long value
void pbio::Context::setString ( const char *  str)
inline

adds a value of type string to the container

Parameters
[in]str- string value
void pbio::Context::setString ( const std::string &  str)
inline

adds a value of type std::string to the container

Parameters
[in]str- string value
size_t pbio::Context::size ( ) const
inline

Get the size of the container.

Returns
the size of the container.