8#ifndef DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_DATAMOVECALLBACKREGISTRY_HPP_
9#define DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_DATAMOVECALLBACKREGISTRY_HPP_
21namespace datahandlinglibs {
30 std::string
id()
const {
return m_id; }
35template<
typename DataType>
42 m_callback = std::make_shared<std::function<void(DataType&&)>>(callback);
44 std::shared_ptr<std::function<void(DataType&&)>>
m_callback;
50 static std::shared_ptr<DataMoveCallbackRegistry>
get()
72 template<
typename DataType>
83 template<
typename DataType>
90 static std::shared_ptr<DataMoveCallbackRegistry>
s_instance;
virtual ~CallbackConcept()=default
CallbackConcept(std::string id)
DataMoveCallbackRegistry()
static std::shared_ptr< DataMoveCallbackRegistry > s_instance
DataMoveCallbackRegistry(DataMoveCallbackRegistry &&)=delete
DataMoveCallbackRegistry is not move-constructible.
DataMoveCallbackRegistry & operator=(DataMoveCallbackRegistry &&)=delete
DataMoveCallbackRegistry is not move-assignable.
DataMoveCallbackRegistry(const DataMoveCallbackRegistry &)=delete
DataMoveCallbackRegistry is not copy-constructible.
static std::shared_ptr< DataMoveCallbackRegistry > get()
DataMoveCallbackRegistry & operator=(const DataMoveCallbackRegistry &)=delete
DataMoveCallbackRegistry is not copy-assignable.
std::map< std::string, std::shared_ptr< CallbackConcept > > m_callback_map
std::shared_ptr< std::function< void(DataType &&)> > get_callback(const appmodel::DataMoveCallbackConf *conf)
Gets the callback function registered with the given configuration.
void register_callback(const appmodel::DataMoveCallbackConf *conf, std::function< void(DataType &&)> callback)
Registers a callback function with a configuration object.
std::shared_ptr< std::function< void(DataType &&)> > m_callback
DataMoveCallback(std::string id, std::function< void(DataType &&)> callback)