EII ConfigMgr C/C++ Reference
Public Member Functions | Protected Member Functions | List of all members
eii::config_manager::AppCfg Class Reference

#include <app_cfg.hpp>

Inheritance diagram for eii::config_manager::AppCfg:
eii::config_manager::ClientCfg eii::config_manager::PublisherCfg eii::config_manager::ServerCfg eii::config_manager::SubscriberCfg

Public Member Functions

 AppCfg (cfgmgr_ctx_t *cfgmgr)
 
config_t * getConfig ()
 
config_t * getInterface ()
 
config_value_t * getConfigValue (const char *key)
 
bool watch (const char *key, cfgmgr_watch_callback_t watch_callback, void *user_data)
 
bool watchPrefix (char *prefix, cfgmgr_watch_callback_t watch_callback, void *user_data)
 
bool watchConfig (cfgmgr_watch_callback_t watch_callback, void *user_data)
 
bool watchInterface (cfgmgr_watch_callback_t watch_callback, void *user_data)
 
virtual config_t * getMsgBusConfig ()
 
virtual std::string getEndpoint ()
 
virtual config_value_t * getInterfaceValue (const char *key)
 
virtual std::vector< std::string > getTopics ()
 
virtual bool setTopics (std::vector< std::string > topics_list)
 
virtual std::vector< std::string > getAllowedClients ()
 
virtual ~AppCfg ()
 

Protected Member Functions

std::vector< std::string > tokenizer (const char *str, const char *delim)
 

Detailed Description

AppCfg class

Constructor & Destructor Documentation

◆ AppCfg()

eii::config_manager::AppCfg::AppCfg ( cfgmgr_ctx_t cfgmgr)
explicit

AppCfg Constructor

Parameters
app_config- The config associated with a service
app_interface- The interface associated with a service
dev_mode- bool whether dev mode is set

◆ ~AppCfg()

virtual eii::config_manager::AppCfg::~AppCfg ( )
virtual

Destructor

Member Function Documentation

◆ getAllowedClients()

virtual std::vector<std::string> eii::config_manager::AppCfg::getAllowedClients ( )
virtual

virtual getAllowedClients function implemented by child classes to fetch topics

Returns
std::string - On Success, Allowed client of associated config of type std::string
  • On Failure, returns empty vector

Reimplemented in eii::config_manager::PublisherCfg, and eii::config_manager::ServerCfg.

◆ getConfig()

config_t* eii::config_manager::AppCfg::getConfig ( )

Gets app config

Parameters
key- Key for which value is needed
Returns
config_value_t* - config_value_t object

◆ getConfigValue()

config_value_t* eii::config_manager::AppCfg::getConfigValue ( const char *  key)

Gets value from respective application's config

Parameters
key- Key for which value is needed
Returns
config_value_t* - config_value_t object

◆ getEndpoint()

virtual std::string eii::config_manager::AppCfg::getEndpoint ( )
virtual

virtual getEndpoint function implemented by child classes to fetch Endpoint

Returns
std::string - On Success, Endpoint of associated config of type std::string
  • On Failure, returns empty string

Reimplemented in eii::config_manager::ServerCfg, eii::config_manager::SubscriberCfg, eii::config_manager::ClientCfg, and eii::config_manager::PublisherCfg.

◆ getInterface()

config_t* eii::config_manager::AppCfg::getInterface ( )

Gets app interface

Returns
config_value_t* - config_value_t object

◆ getInterfaceValue()

virtual config_value_t* eii::config_manager::AppCfg::getInterfaceValue ( const char *  key)
virtual

virtual function that gets value from interface

Parameters
key- Key for which value is needed
Returns
config_value_t* - On Success, config_value_t object
  • On Failure, returns NULL

Reimplemented in eii::config_manager::PublisherCfg, eii::config_manager::ServerCfg, eii::config_manager::ClientCfg, and eii::config_manager::SubscriberCfg.

◆ getMsgBusConfig()

virtual config_t* eii::config_manager::AppCfg::getMsgBusConfig ( )
virtual

Get msgbus configuration for application to communicate over EII message bus

Returns
config_t* - JSON msg bus server config of type config_t
  • On Failure, returns NULL

Reimplemented in eii::config_manager::PublisherCfg, eii::config_manager::ServerCfg, eii::config_manager::ClientCfg, and eii::config_manager::SubscriberCfg.

◆ getTopics()

virtual std::vector<std::string> eii::config_manager::AppCfg::getTopics ( )
virtual

virtual getTopics function implemented by child classes to fetch topics

Returns
std::string - On Success, Topics of associated config of type std::string
  • On Failure, returns empty vector

Reimplemented in eii::config_manager::PublisherCfg, and eii::config_manager::SubscriberCfg.

◆ setTopics()

virtual bool eii::config_manager::AppCfg::setTopics ( std::vector< std::string >  topics_list)
virtual

virtual setTopics function implemented by child classes to set topics

Parameters
topics_list- vector of strings containing topics
Returns
bool - Boolean whether topics were set
  • On Success, returns true
  • On Failure, returns false

Reimplemented in eii::config_manager::PublisherCfg, and eii::config_manager::SubscriberCfg.

◆ tokenizer()

std::vector<std::string> eii::config_manager::AppCfg::tokenizer ( const char *  str,
const char *  delim 
)
protected

Helper base class function to split string based on delimiter

Parameters
str- string to be split
delim- delimiter
Returns
std::vector<std::string> - vector of split strings

◆ watch()

bool eii::config_manager::AppCfg::watch ( const char *  key,
cfgmgr_watch_callback_t  watch_callback,
void *  user_data 
)

Register a callback to watch on any given key

Parameters
key- key to watch
watch_callback- callback object
user_data- user data to be sent to callback
Returns
bool - Boolean whether the callback was registered

◆ watchConfig()

bool eii::config_manager::AppCfg::watchConfig ( cfgmgr_watch_callback_t  watch_callback,
void *  user_data 
)

Register a callback to watch on app config

Parameters
watch_callback- callback object
user_data- user data to be sent to callback
Returns
bool - Boolean whether the callback was registered

◆ watchInterface()

bool eii::config_manager::AppCfg::watchInterface ( cfgmgr_watch_callback_t  watch_callback,
void *  user_data 
)

Register a callback to watch on app interface

Parameters
watch_callback- callback object
user_data- user data to be sent to callback
Returns
bool - Boolean whether the callback was registered

◆ watchPrefix()

bool eii::config_manager::AppCfg::watchPrefix ( char *  prefix,
cfgmgr_watch_callback_t  watch_callback,
void *  user_data 
)

Register a callback to watch on any given key prefix

Parameters
prefix- key prefix to watch
watch_callback- callback object
user_data- user data to be sent to callback
Returns
bool - Boolean whether the callback was registered

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