Raven Core  3.0.0
P2P Digital Currency
zmqabstractnotifier.h
Go to the documentation of this file.
1 // Copyright (c) 2015 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_ZMQ_ZMQABSTRACTNOTIFIER_H
7 #define RAVEN_ZMQ_ZMQABSTRACTNOTIFIER_H
8 
9 #include "zmqconfig.h"
10 
11 class CBlockIndex;
13 class CMessage;
14 
15 typedef CZMQAbstractNotifier* (*CZMQNotifierFactory)();
16 
18 {
19 public:
20  CZMQAbstractNotifier() : psocket(nullptr) { }
21  virtual ~CZMQAbstractNotifier();
22 
23  template <typename T>
25  {
26  return new T();
27  }
28 
29  std::string GetType() const { return type; }
30  void SetType(const std::string &t) { type = t; }
31  std::string GetAddress() const { return address; }
32  void SetAddress(const std::string &a) { address = a; }
33 
34  virtual bool Initialize(void *pcontext) = 0;
35  virtual void Shutdown() = 0;
36 
37  virtual bool NotifyBlock(const CBlockIndex *pindex);
38  virtual bool NotifyTransaction(const CTransaction &transaction);
39  virtual bool NotifyMessage(const CMessage& message);
40 
41 protected:
42  void *psocket;
43  std::string type;
44  std::string address;
45 };
46 
47 #endif // RAVEN_ZMQ_ZMQABSTRACTNOTIFIER_H
virtual bool NotifyBlock(const CBlockIndex *pindex)
std::string GetAddress() const
virtual bool NotifyTransaction(const CTransaction &transaction)
virtual bool NotifyMessage(const CMessage &message)
void SetAddress(const std::string &a)
virtual void Shutdown()=0
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:172
virtual bool Initialize(void *pcontext)=0
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:270
void SetType(const std::string &t)
std::string GetType() const
static CZMQAbstractNotifier * Create()