CatapultServer  v0.5.0.1 (Elephant)
AggregateStateChangeSubscriber.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include "StateChangeSubscriber.h"
24 
25 namespace catapult { namespace subscribers {
26 
28  template<typename TStateChangeSubscriber = StateChangeSubscriber>
29  class AggregateStateChangeSubscriber : public BasicAggregateSubscriber<TStateChangeSubscriber>, public StateChangeSubscriber {
30  public:
32 
33  public:
34  void notifyScoreChange(const model::ChainScore& chainScore) override {
35  this->forEach([&chainScore](auto& subscriber) { subscriber.notifyScoreChange(chainScore); });
36  }
37 
38  void notifyStateChange(const StateChangeInfo& stateChangeInfo) override {
39  this->forEach([&stateChangeInfo](auto& subscriber) { subscriber.notifyStateChange(stateChangeInfo); });
40  }
41  };
42 }}
catapult::subscribers::AggregateStateChangeSubscriber
Aggregate state change subscriber.
Definition: AggregateStateChangeSubscriber.h:29
catapult::subscribers::StateChangeSubscriber
State change subscriber.
Definition: StateChangeSubscriber.h:31
BasicAggregateSubscriber.h
catapult::subscribers::AggregateStateChangeSubscriber::notifyScoreChange
void notifyScoreChange(const model::ChainScore &chainScore) override
Indicates chain score was changed to chainScore.
Definition: AggregateStateChangeSubscriber.h:34
catapult::model::ChainScore
Definition: ChainScore.h:30
catapult::subscribers::AggregateStateChangeSubscriber::notifyStateChange
void notifyStateChange(const StateChangeInfo &stateChangeInfo) override
Indicates state was changed with change information in stateChangeInfo.
Definition: AggregateStateChangeSubscriber.h:38
catapult::subscribers::BasicAggregateSubscriber< TStateChangeSubscriber >::forEach
void forEach(TAction action) const
Definition: BasicAggregateSubscriber.h:38
catapult::subscribers::BasicAggregateSubscriber
Basic aggregate subscriber.
Definition: BasicAggregateSubscriber.h:29
catapult::subscribers::StateChangeInfo
State change information.
Definition: StateChangeInfo.h:29
catapult
Definition: AddressExtractionExtension.cpp:28
StateChangeSubscriber.h