Bitcoin ABC  0.22.13
P2P Digital Currency
zmqabstractnotifier.h
Go to the documentation of this file.
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.
4 
5 #ifndef BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H
6 #define BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H
7 
8 #include <zmq/zmqconfig.h>
9 
10 class CBlockIndex;
12 
13 typedef CZMQAbstractNotifier *(*CZMQNotifierFactory)();
14 
16 public:
17  static const int DEFAULT_ZMQ_SNDHWM{1000};
18 
20  : psocket(nullptr),
22  virtual ~CZMQAbstractNotifier();
23 
24  template <typename T> static CZMQAbstractNotifier *Create() {
25  return new T();
26  }
27 
28  std::string GetType() const { return type; }
29  void SetType(const std::string &t) { type = t; }
30  std::string GetAddress() const { return address; }
31  void SetAddress(const std::string &a) { address = a; }
34  }
35  void SetOutboundMessageHighWaterMark(const int sndhwm) {
36  if (sndhwm >= 0) {
38  }
39  }
40 
41  virtual bool Initialize(void *pcontext) = 0;
42  virtual void Shutdown() = 0;
43 
44  virtual bool NotifyBlock(const CBlockIndex *pindex);
45  virtual bool NotifyTransaction(const CTransaction &transaction);
46 
47 protected:
48  void *psocket;
49  std::string type;
50  std::string address;
52 };
53 
54 #endif // BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H
virtual bool NotifyBlock(const CBlockIndex *pindex)
std::string GetAddress() const
virtual bool NotifyTransaction(const CTransaction &transaction)
void SetOutboundMessageHighWaterMark(const int sndhwm)
int GetOutboundMessageHighWaterMark() const
void SetAddress(const std::string &a)
static const int DEFAULT_ZMQ_SNDHWM
virtual void Shutdown()=0
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: blockindex.h:23
virtual bool Initialize(void *pcontext)=0
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:211
void SetType(const std::string &t)
std::string GetType() const
static CZMQAbstractNotifier * Create()