#ifndef DORICGLOBALBROADCAST_H #define DORICGLOBALBROADCAST_H #include #include "DoricExport.h" class DORIC_EXPORT DoricGlobalBroadcast { private: static DoricGlobalBroadcast *local_instance; DoricGlobalBroadcast() { qDebug() << "DoricGlobalBroadcast constructor"; } ~DoricGlobalBroadcast() { qDebug() << "DoricGlobalBroadcast destructor"; } public: static DoricGlobalBroadcast *getInstance() { static DoricGlobalBroadcast instance; return &instance; } QString subscribe(QString name, std::function callback); void unsubscribe(QString subscribeId); void publish(QString name, QString data); private: QAtomicInt idGenerator; QMap>>> subjects; }; #endif // DORICGLOBALBROADCAST_H