Add ZeroMQ support. Notify blocks and transactions via ZeroMQ
[bitcoinplatinum.git] / src / zmq / zmqabstractnotifier.h
blob626d1ddf926c17d6f1c595353115a0366c377e95
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 "zmqconfig.h"
10 class CZMQAbstractNotifier;
11 typedef CZMQAbstractNotifier* (*CZMQNotifierFactory)();
13 class CZMQAbstractNotifier
15 public:
16 CZMQAbstractNotifier() : psocket(0) { }
17 virtual ~CZMQAbstractNotifier();
19 template <typename T>
20 static CZMQAbstractNotifier* Create()
22 return new T();
25 std::string GetType() const { return type; }
26 void SetType(const std::string &t) { type = t; }
27 std::string GetAddress() const { return address; }
28 void SetAddress(const std::string &a) { address = a; }
30 virtual bool Initialize(void *pcontext) = 0;
31 virtual void Shutdown() = 0;
33 virtual bool NotifyBlock(const uint256 &hash);
34 virtual bool NotifyTransaction(const CTransaction &transaction);
36 protected:
37 void *psocket;
38 std::string type;
39 std::string address;
42 #endif // BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H