Face Engine SDK 5.25.0
A face detection, recognition and tracking engine.
Loading...
Searching...
No Matches
fsdk::ISettingsProvider Struct Referenceabstract

SDK settings provider interface. More...

#include <ISettingsProvider.h>

Inheritance diagram for fsdk::ISettingsProvider:
fsdk::IRefCounted

Classes

struct  Desc
 Configuration parameter description. More...
 
struct  Entry
 Configuration parameter entry. More...
 
struct  Key
 Configuration parameter key. More...
 
struct  Value
 Configuration parameter value. More...
 

Public Types

enum class  Error : uint32_t {
  Ok , IOError , Memory , Internal ,
  InvalidPi , InvalidTag , InvalidCdata , FileNotFound ,
  InvalidPcdata , InvalidDocType , InvalidSettings , InvalidComment ,
  InvalidAttribute , InvalidEndElement , AppendInvalidRoot , NoDocumentElement ,
  EndElementMismatch , InvalidStartElement , MemoryAllocationFailed
}
 Config parsing error codes. More...
 

Public Member Functions

virtual const char * getDefaultPath () const noexcept=0
 Get settings path this provider is bound to.
 
virtual void setDefaultPath (const char *path) noexcept=0
 Sets default path for saving of settings provider.
 
virtual Result< Errorload (const char *path) noexcept=0
 Load settings from given path.
 
virtual Result< ErrorloadFromString (const char *content) noexcept=0
 Load settings from given xml-formatted string.
 
virtual bool save (const char *path) const noexcept=0
 Save settings values using the default path.
 
virtual void clear () noexcept=0
 Clear settings.
 
virtual bool isEmpty () const noexcept=0
 
virtual void setDesc (const Key &key, const Desc &desc) noexcept=0
 Set parameter description.
 
void setDesc (const char *section, const char *parameter, const Desc &desc) noexcept
 Set parameter description.
 
virtual void setValue (const Key &key, Value &&value) noexcept=0
 Set parameter value.
 
void setValue (const char *section, const char *parameter, Value &&value) noexcept
 Set parameter value.
 
virtual void setEntry (const Key &key, Entry &&entry) noexcept=0
 Set parameter.
 
void setEntry (const Key &key, const Desc &desc, Value &&value) noexcept
 Set parameter.
 
void setEntry (const char *section, const char *parameter, const Desc &desc, Value &&value) noexcept
 Set parameter.
 
virtual const EntrygetEntry (const Key &key) const noexcept=0
 Find parameter entry.
 
Desc getDesc (const Key &key) const noexcept
 Get parameter description.
 
Desc getDesc (const char *section, const char *parameter) const noexcept
 Get parameter description.
 
const ValuegetValue (const Key &key) const noexcept
 Get parameter value.
 
const ValuegetValue (const char *section, const char *parameter) const noexcept
 Get parameter value.
 
- Public Member Functions inherited from fsdk::IRefCounted
virtual int32_t retain () noexcept=0
 Increase strong reference count.
 
virtual int32_t retainLocked () noexcept=0
 Increase strong reference count thread safely.
 
virtual int32_t release () noexcept=0
 Decrease strong reference count.
 
virtual int32_t getRefCount () const noexcept=0
 Get actual strong reference count.
 
virtual int32_t retainWeak () noexcept=0
 Increase weak reference count.
 
virtual int32_t releaseWeak () noexcept=0
 Decrease weak reference count.
 
virtual int32_t getWeakRefCount () const noexcept=0
 Get actual weak reference count.
 

Detailed Description

SDK settings provider interface.

Takes care of loading and parsing of SDK configuration files.

Member Enumeration Documentation

◆ Error

enum class fsdk::ISettingsProvider::Error : uint32_t
strong

Config parsing error codes.

Enumerator
Ok 

No error.

IOError 

Error reading from file/stream.

Memory 

Could not allocate memory.

Internal 

Internal error occurred.

InvalidPi 

Parsing error occurred while parsing document declaration/processing instruction.

InvalidTag 

Parser could not determine tag type.

InvalidCdata 

Parsing error occurred while parsing CDATA section.

FileNotFound 

File was not found during load_file()

InvalidPcdata 

Parsing error occurred while parsing PCDATA section.

InvalidDocType 

Parsing error occurred while parsing document type declaration.

InvalidSettings 

Settings section is invalid or absent.

InvalidComment 

Parsing error occurred while parsing comment.

InvalidAttribute 

Parsing error occurred while parsing element attribute.

InvalidEndElement 

Parsing error occurred while parsing end element tag.

AppendInvalidRoot 

(exclusive to xml_node::append_buffer)

Unable to append nodes since root type is not node_element or node_document

NoDocumentElement 

Parsing resulted in a document without element nodes.

EndElementMismatch 

tag was not closed or there was an excessive closing tag)

There was a mismatch of start-end tags (closing tag had incorrect name, some

InvalidStartElement 

Parsing error occurred while parsing start element tag.

MemoryAllocationFailed 

memory allocation failed for internal data

Member Function Documentation

◆ clear()

virtual void fsdk::ISettingsProvider::clear ( )
pure virtualnoexcept

Clear settings.

Returns
true if succeded, false otherwise.

◆ getDefaultPath()

virtual const char * fsdk::ISettingsProvider::getDefaultPath ( ) const
pure virtualnoexcept

Get settings path this provider is bound to.

This is the same path that was given to load().

Returns
path string.

◆ getDesc() [1/2]

Desc fsdk::ISettingsProvider::getDesc ( const char * section,
const char * parameter ) const
noexcept

Get parameter description.

Lookup parameter by key. Return empty description if the parameters does not exist.

Parameters
sectionparameter section.
parameterparameter name.
Returns
parameter description.

◆ getDesc() [2/2]

Desc fsdk::ISettingsProvider::getDesc ( const Key & key) const
noexcept

Get parameter description.

Lookup parameter by key. Return empty description if the parameters does not exist.

Parameters
keyparameter key.
Returns
parameter description.

◆ getEntry()

virtual const Entry & fsdk::ISettingsProvider::getEntry ( const Key & key) const
pure virtualnoexcept

Find parameter entry.

Lookup parameter by key. Return empty entry if the parameters does not exist.

Parameters
keyparameter key.
Returns
parameter entry.

◆ getValue() [1/2]

const Value & fsdk::ISettingsProvider::getValue ( const char * section,
const char * parameter ) const
noexcept

Get parameter value.

Lookup parameter by key. Return empty value if the parameters does not exist.

Parameters
sectionparameter section.
parameterparameter name.
Returns
parameter value.

◆ getValue() [2/2]

const Value & fsdk::ISettingsProvider::getValue ( const Key & key) const
noexcept

Get parameter value.

Lookup parameter by key. Return empty value if the parameters does not exist.

Parameters
keyparameter key.
Returns
parameter value.

◆ isEmpty()

virtual bool fsdk::ISettingsProvider::isEmpty ( ) const
pure virtualnoexcept

Check if there are loaded settings.

Returns
true if provider is empty.

◆ load()

virtual Result< Error > fsdk::ISettingsProvider::load ( const char * path)
pure virtualnoexcept

Load settings from given path.

Parameters
pathconfiguration file path
Returns
Result with error code specified by ISettingsProvider::ParseError.
See also
Result and ISettingsProvider::ParseError.

◆ loadFromString()

virtual Result< Error > fsdk::ISettingsProvider::loadFromString ( const char * content)
pure virtualnoexcept

Load settings from given xml-formatted string.

Parameters
contentcontent of xml-formatted file as a string, in a case of nullptr empty config will be created
Returns
Result with error code specified by ISettingsProvider::ParseError.
See also
Result and ISettingsProvider::ParseError.

◆ save()

virtual bool fsdk::ISettingsProvider::save ( const char * path) const
pure virtualnoexcept

Save settings values using the default path.

path may be null, in this case a path from getDefaultPath() will be used.

Returns
true if succeded, false otherwise.

◆ setDefaultPath()

virtual void fsdk::ISettingsProvider::setDefaultPath ( const char * path)
pure virtualnoexcept

Sets default path for saving of settings provider.

Parameters
pathdefault path

◆ setDesc() [1/2]

void fsdk::ISettingsProvider::setDesc ( const char * section,
const char * parameter,
const Desc & desc )
noexcept

Set parameter description.

Lookup parameter by key. Creates a parameter if it does not already exist.

Parameters
sectionparameter section.
parameterparameter name.
descparameter description.

◆ setDesc() [2/2]

virtual void fsdk::ISettingsProvider::setDesc ( const Key & key,
const Desc & desc )
pure virtualnoexcept

Set parameter description.

Lookup parameter by key. Creates a parameter if it does not already exist.

Parameters
keyparameter key.
descparameter description.

◆ setEntry() [1/3]

void fsdk::ISettingsProvider::setEntry ( const char * section,
const char * parameter,
const Desc & desc,
Value && value )
noexcept

Set parameter.

Lookup parameter by key. Creates a parameter if it does not already exist.

Parameters
sectionparameter section.
parameterparameter name.
descparameter description.
valueparameter value.

◆ setEntry() [2/3]

void fsdk::ISettingsProvider::setEntry ( const Key & key,
const Desc & desc,
Value && value )
noexcept

Set parameter.

Lookup parameter by key. Creates a parameter if it does not already exist.

Parameters
keyparameter key.
descparameter description.
valueparameter value.

◆ setEntry() [3/3]

virtual void fsdk::ISettingsProvider::setEntry ( const Key & key,
Entry && entry )
pure virtualnoexcept

Set parameter.

Lookup parameter by key. Creates a parameter if it does not already exist.

Parameters
keyparameter key.
entryparameter entry.

◆ setValue() [1/2]

void fsdk::ISettingsProvider::setValue ( const char * section,
const char * parameter,
Value && value )
noexcept

Set parameter value.

Lookup parameter by key. Creates a parameter if it does not already exist.

Parameters
sectionparameter section.
parameterparameter name.
valueparameter value.

◆ setValue() [2/2]

virtual void fsdk::ISettingsProvider::setValue ( const Key & key,
Value && value )
pure virtualnoexcept

Set parameter value.

Lookup parameter by key. Creates a parameter if it does not already exist.

Parameters
keyparameter key.
valueparameter value.

The documentation for this struct was generated from the following file: