Merge #11726: Cleanups + nit fixes for walletdir PR
[bitcoinplatinum.git] / src / zmq / zmqabstractnotifier.h
blob6fbaba2036d56c2d1e09efa424965c0ebdddb3c6
1 // Copyright (c) 2015 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H
6 #define BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H
8 #include <zmq/zmqconfig.h>
10 class CBlockIndex;
11 class CZMQAbstractNotifier;
13 typedef CZMQAbstractNotifier* (*CZMQNotifierFactory)();
15 class CZMQAbstractNotifier
17 public:
18 CZMQAbstractNotifier() : psocket(nullptr) { }
19 virtual ~CZMQAbstractNotifier();
21 template <typename T>
22 static CZMQAbstractNotifier* Create()
24 return new T();
27 std::string GetType() const { return type; }
28 void SetType(const std::string &t) { type = t; }
29 std::string GetAddress() const { return address; }
30 void SetAddress(const std::string &a) { address = a; }
32 virtual bool Initialize(void *pcontext) = 0;
33 virtual void Shutdown() = 0;
35 virtual bool NotifyBlock(const CBlockIndex *pindex);
36 virtual bool NotifyTransaction(const CTransaction &transaction);
38 protected:
39 void *psocket;
40 std::string type;
41 std::string address;
44 #endif // BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H