Fawkes API  Fawkes Development Version
ImageInfo Class Reference

ImageInfo representation for JSON transfer. More...

#include <ImageInfo.h>

Public Member Functions

 ImageInfo ()
 Constructor. More...
 
 ImageInfo (const std::string &json)
 Constructor from JSON. More...
 
 ImageInfo (const rapidjson::Value &v)
 Constructor from JSON. More...
 
virtual ~ImageInfo ()
 Destructor. More...
 
virtual std::string to_json (bool pretty=false) const
 Render object to JSON. More...
 
virtual void to_json_value (rapidjson::Document &d, rapidjson::Value &v) const
 Render object to JSON. More...
 
virtual void from_json (const std::string &json)
 Retrieve data from JSON string. More...
 
virtual void from_json_value (const rapidjson::Value &v)
 Retrieve data from JSON string. More...
 
virtual void validate (bool subcall=false) const
 Validate if all required fields have been set. More...
 
std::optional< std::string > kind () const
 Get kind value. More...
 
void set_kind (const std::string &kind)
 Set kind value. More...
 
std::optional< std::string > apiVersion () const
 Get apiVersion value. More...
 
void set_apiVersion (const std::string &apiVersion)
 Set apiVersion value. More...
 
std::optional< std::string > id () const
 Get id value. More...
 
void set_id (const std::string &id)
 Set id value. More...
 
std::optional< std::string > colorspace () const
 Get colorspace value. More...
 
void set_colorspace (const std::string &colorspace)
 Set colorspace value. More...
 
std::optional< std::string > frame () const
 Get frame value. More...
 
void set_frame (const std::string &frame)
 Set frame value. More...
 
std::optional< int64_t > width () const
 Get width value. More...
 
void set_width (const int64_t &width)
 Set width value. More...
 
std::optional< int64_t > height () const
 Get height value. More...
 
void set_height (const int64_t &height)
 Set height value. More...
 
std::optional< int64_t > mem_size () const
 Get mem_size value. More...
 
void set_mem_size (const int64_t &mem_size)
 Set mem_size value. More...
 

Static Public Member Functions

static std::string api_version ()
 Get version of implemented API. More...
 

Detailed Description

ImageInfo representation for JSON transfer.

Definition at line 26 of file ImageInfo.h.

Constructor & Destructor Documentation

◆ ImageInfo() [1/3]

ImageInfo::ImageInfo ( )

Constructor.

Definition at line 23 of file ImageInfo.cpp.

◆ ImageInfo() [2/3]

ImageInfo::ImageInfo ( const std::string &  json)

Constructor from JSON.

Parameters
jsonJSON string to initialize from

Definition at line 27 of file ImageInfo.cpp.

References from_json().

◆ ImageInfo() [3/3]

ImageInfo::ImageInfo ( const rapidjson::Value &  v)

Constructor from JSON.

Parameters
vRapidJSON value object to initialize from.

Definition at line 32 of file ImageInfo.cpp.

References from_json_value().

◆ ~ImageInfo()

ImageInfo::~ImageInfo ( )
virtual

Destructor.

Definition at line 37 of file ImageInfo.cpp.

Member Function Documentation

◆ api_version()

static std::string ImageInfo::api_version ( )
inlinestatic

Get version of implemented API.

Returns
string representation of version

Definition at line 48 of file ImageInfo.h.

◆ apiVersion()

std::optional<std::string> ImageInfo::apiVersion ( ) const
inline

Get apiVersion value.

Returns
apiVersion value

Definition at line 109 of file ImageInfo.h.

Referenced by set_apiVersion().

◆ colorspace()

std::optional<std::string> ImageInfo::colorspace ( ) const
inline

Get colorspace value.

Returns
colorspace value

Definition at line 143 of file ImageInfo.h.

Referenced by MongoLogImagesThread::loop(), and set_colorspace().

◆ frame()

std::optional<std::string> ImageInfo::frame ( ) const
inline

Get frame value.

Returns
frame value

Definition at line 160 of file ImageInfo.h.

Referenced by set_frame().

◆ from_json()

void ImageInfo::from_json ( const std::string &  json)
virtual

Retrieve data from JSON string.

Parameters
jsonJSON representation suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 111 of file ImageInfo.cpp.

References from_json_value().

Referenced by ImageInfo().

◆ from_json_value()

void ImageInfo::from_json_value ( const rapidjson::Value &  v)
virtual

Retrieve data from JSON string.

Parameters
vRapidJSON value suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 120 of file ImageInfo.cpp.

Referenced by from_json(), and ImageInfo().

◆ height()

std::optional<int64_t> ImageInfo::height ( ) const
inline

Get height value.

Returns
height value

Definition at line 194 of file ImageInfo.h.

Referenced by MongoLogImagesThread::loop(), and set_height().

◆ id()

std::optional<std::string> ImageInfo::id ( ) const
inline

Get id value.

Returns
id value

Definition at line 126 of file ImageInfo.h.

Referenced by set_id().

◆ kind()

std::optional<std::string> ImageInfo::kind ( ) const
inline

Get kind value.

Returns
kind value

Definition at line 92 of file ImageInfo.h.

Referenced by set_kind().

◆ mem_size()

std::optional<int64_t> ImageInfo::mem_size ( ) const
inline

Get mem_size value.

Returns
mem_size value

Definition at line 211 of file ImageInfo.h.

Referenced by set_mem_size().

◆ set_apiVersion()

void ImageInfo::set_apiVersion ( const std::string &  apiVersion)
inline

Set apiVersion value.

Parameters
apiVersionnew value

Definition at line 118 of file ImageInfo.h.

References apiVersion().

◆ set_colorspace()

void ImageInfo::set_colorspace ( const std::string &  colorspace)
inline

Set colorspace value.

Parameters
colorspacenew value

Definition at line 152 of file ImageInfo.h.

References colorspace().

◆ set_frame()

void ImageInfo::set_frame ( const std::string &  frame)
inline

Set frame value.

Parameters
framenew value

Definition at line 169 of file ImageInfo.h.

References frame().

◆ set_height()

void ImageInfo::set_height ( const int64_t &  height)
inline

Set height value.

Parameters
heightnew value

Definition at line 203 of file ImageInfo.h.

References height().

◆ set_id()

void ImageInfo::set_id ( const std::string &  id)
inline

Set id value.

Parameters
idnew value

Definition at line 135 of file ImageInfo.h.

References id().

◆ set_kind()

void ImageInfo::set_kind ( const std::string &  kind)
inline

Set kind value.

Parameters
kindnew value

Definition at line 101 of file ImageInfo.h.

References kind().

◆ set_mem_size()

void ImageInfo::set_mem_size ( const int64_t &  mem_size)
inline

Set mem_size value.

Parameters
mem_sizenew value

Definition at line 220 of file ImageInfo.h.

References mem_size().

◆ set_width()

void ImageInfo::set_width ( const int64_t &  width)
inline

Set width value.

Parameters
widthnew value

Definition at line 186 of file ImageInfo.h.

References width().

◆ to_json()

std::string ImageInfo::to_json ( bool  pretty = false) const
virtual

Render object to JSON.

Parameters
prettytrue to enable pretty printing (readable spacing)
Returns
JSON string

Definition at line 42 of file ImageInfo.cpp.

References to_json_value().

◆ to_json_value()

void ImageInfo::to_json_value ( rapidjson::Document &  d,
rapidjson::Value &  v 
) const
virtual

Render object to JSON.

Parameters
dRapidJSON document to retrieve allocator from
vRapidJSON value to add data to

Definition at line 61 of file ImageInfo.cpp.

Referenced by to_json().

◆ validate()

void ImageInfo::validate ( bool  subcall = false) const
virtual

Validate if all required fields have been set.

Parameters
subcalltrue if this is called from another class, e.g., a sub-class or array holder. Will modify the kind of exception thrown.
Exceptions
std::vector<std::string>thrown if required information is missing and subcall is set to true. Contains a list of missing fields.
std::runtime_errorinformative message describing the missing fields

Definition at line 149 of file ImageInfo.cpp.

◆ width()

std::optional<int64_t> ImageInfo::width ( ) const
inline

Get width value.

Returns
width value

Definition at line 177 of file ImageInfo.h.

Referenced by MongoLogImagesThread::loop(), and set_width().


The documentation for this class was generated from the following files: