8#ifndef FCF_DEVMGR_COMMON_DATA_CONTEXT_HPP_
9#define FCF_DEVMGR_COMMON_DATA_CONTEXT_HPP_
11#include <unordered_map>
15#include <rad/topicPub.hpp>
16#include <rad/mal/publisher.hpp>
20#include <ifw/core/utils/bat/dbInterface.hpp>
100 boost::asio::io_service& ios,
101 bool with_publisher =
true,
102 bool with_oldb =
true);
118 void UpdateDb(ifw::core::utils::bat::DbVector& vec);
129 void SetState(
const std::string state);
146 void SetAsync(
const std::string& key,
155 std::unique_ptr<ifw::core::utils::bat::DbInterface> m_db_interface;
158 boost::asio::io_service& m_ios;
162 std::unique_ptr<rad::cii::Publisher<stdif::Status>> m_publisher;
166 std::string m_state_str;
167 std::string m_substate_str;
172 bool m_setting_state {
false};
173 log4cplus::Logger m_logger;
187 if (m_db_interface) {
188 m_db_interface->SetAsync<T>(key, value);
Definition dataContext.hpp:86
Config & GetConfig()
Definition dataContext.cpp:98
bool GetSettingState()
Definition dataContext.cpp:206
void UpdateDb()
Definition dataContext.cpp:65
void ReloadConfig()
Definition dataContext.cpp:58
void SetSubstate(const short state)
Definition dataContext.cpp:142
std::string GetSubstateStr()
Definition dataContext.cpp:137
virtual ~DataContext()
Definition dataContext.cpp:52
short GetSubstate()
Definition dataContext.cpp:132
void SetSettingState(bool new_state)
Definition dataContext.cpp:201
void SetAsync(const std::string &key, const T &value)
Definition dataContext.hpp:186
DataContext & operator=(const DataContext &)=delete
Disable assignment operator.
void PublishStates()
Definition dataContext.cpp:160
DataContext(const DataContext &)=delete
Disable copy constructor.
DataContext(Config &config, boost::asio::io_service &ios, bool with_publisher=true, bool with_oldb=true)
Definition dataContext.cpp:20
short GetState()
Definition dataContext.cpp:105
void SetState(const short state)
Definition dataContext.cpp:115
std::string GetStateStr()
Definition dataContext.cpp:110
ActionMgr class source file.
Definition actionMgr.cpp:28
const short SRV_SUBSTATE_ENABLING
Definition dataContext.hpp:33
const std::string SRV_STATE_UNAVAILABLE_STR
Definition dataContext.hpp:40
const std::string SRV_SUBSTATE_READY_STR
Definition dataContext.hpp:43
const short SRV_SUBSTATE_SETTING_UP
Definition dataContext.hpp:34
const short SRV_SUBSTATE_INITIALISING
Definition dataContext.hpp:32
const std::unordered_map< std::string, short > SRV_SUBSTATE_STR_MAP
Definition dataContext.hpp:72
const short SRV_SUBSTATE_IDLE
Definition dataContext.hpp:31
const std::string SRV_STATE_NOT_OPERATIONAL_STR
Definition dataContext.hpp:38
const short SRV_SUBSTATE_ERROR
Definition dataContext.hpp:35
const std::string SRV_SUBSTATE_IDLE_STR
Definition dataContext.hpp:44
const std::string SRV_SUBSTATE_ERROR_STR
Definition dataContext.hpp:47
const short SRV_STATE_OPERATIONAL
Definition dataContext.hpp:26
const std::string SRV_SUBSTATE_INITIALISING_STR
Definition dataContext.hpp:45
const short SRV_SUBSTATE_READY
Definition dataContext.hpp:30
const short SRV_SUBSTATE_NOTREADY
Definition dataContext.hpp:29
const std::string SRV_SUBSTATE_SETTING_UP_STR
Definition dataContext.hpp:48
const std::string SRV_SUBSTATE_NOTREADY_STR
Definition dataContext.hpp:42
const short SRV_STATE_NOT_OPERATIONAL
Definition dataContext.hpp:25
const std::string SRV_SUBSTATE_ENABLING_STR
Definition dataContext.hpp:46
const std::string SRV_STATE_OPERATIONAL_STR
Definition dataContext.hpp:39
const std::unordered_map< short, std::string > SRV_SUBSTATE_MAP
Definition dataContext.hpp:62
const std::unordered_map< short, std::string > SRV_STATE_MAP
Definition dataContext.hpp:52
const std::unordered_map< std::string, short > SRV_STATE_STR_MAP
Definition dataContext.hpp:57