singleton
parent
be0a19d37e
commit
4cee907912
|
@ -3,8 +3,16 @@
|
|||
#include <cassert>
|
||||
|
||||
namespace pEp {
|
||||
bool CallbackDispatcher::once = true;
|
||||
CallbackDispatcher dispatcher;
|
||||
|
||||
CallbackDispatcher::CallbackDispatcher()
|
||||
{
|
||||
if (!once)
|
||||
throw std::out_of_range("CallbackDispatcher is a singleton");
|
||||
once = false;
|
||||
}
|
||||
|
||||
PEP_STATUS CallbackDispatcher::messageToSend(::message *msg)
|
||||
{
|
||||
return dispatcher._messageToSend(msg);
|
||||
|
|
|
@ -9,10 +9,13 @@ namespace pEp {
|
|||
::messageToSend_t messageToSend;
|
||||
::notifyHandshake_t notifyHandshake;
|
||||
};
|
||||
|
||||
std::vector<callbacks> targets;
|
||||
|
||||
static bool once;
|
||||
|
||||
public:
|
||||
CallbackDispatcher();
|
||||
|
||||
static PEP_STATUS messageToSend(::message *msg);
|
||||
static PEP_STATUS notifyHandshake(::pEp_identity *me,
|
||||
::pEp_identity *partner, ::sync_handshake_signal signal);
|
||||
|
|
Loading…
Reference in New Issue