single instance log & add global broadcast
This commit is contained in:
20
doric-Qt/example/doric/utils/DoricGlobalBroadcast.h
Normal file
20
doric-Qt/example/doric/utils/DoricGlobalBroadcast.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef DORICGLOBALBROADCAST_H
|
||||
#define DORICGLOBALBROADCAST_H
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
class DoricGlobalBroadcast {
|
||||
private:
|
||||
static DoricGlobalBroadcast *local_instance;
|
||||
DoricGlobalBroadcast() { qDebug() << "DoricGlobalBroadcast constructor"; }
|
||||
|
||||
~DoricGlobalBroadcast() { qDebug() << "DoricGlobalBroadcast destructor"; }
|
||||
|
||||
public:
|
||||
static DoricGlobalBroadcast *getInstance() {
|
||||
static DoricGlobalBroadcast instance;
|
||||
return &instance;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // DORICGLOBALBROADCAST_H
|
||||
Reference in New Issue
Block a user