CatapultServer  v0.5.0.1 (Elephant)
BasicAggregateSubscriber.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include <memory>
23 #include <vector>
24 
25 namespace catapult { namespace subscribers {
26 
28  template<typename TSubscriber>
30  public:
32  explicit BasicAggregateSubscriber(std::vector<std::unique_ptr<TSubscriber>>&& subscribers)
33  : m_subscribers(std::move(subscribers))
34  {}
35 
36  protected:
37  template<typename TAction>
38  void forEach(TAction action) const {
39  for (auto& pSubscriber : m_subscribers)
40  action(*pSubscriber);
41  }
42 
43  private:
44  std::vector<std::unique_ptr<TSubscriber>> m_subscribers;
45  };
46 }}
catapult::subscribers::BasicAggregateSubscriber::m_subscribers
std::vector< std::unique_ptr< TSubscriber > > m_subscribers
Definition: BasicAggregateSubscriber.h:44
catapult::validators::Notification
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
catapult::subscribers::BasicAggregateSubscriber::BasicAggregateSubscriber
BasicAggregateSubscriber(std::vector< std::unique_ptr< TSubscriber >> &&subscribers)
Creates an aggregate subscriber around subscribers.
Definition: BasicAggregateSubscriber.h:32
catapult::validators::maxCosignatures
uint8_t maxCosignatures
Definition: BasicAggregateCosignaturesValidator.cpp:28
catapult::validators::MAKE_STATELESS_VALIDATOR
for(const auto &name :reservedRootNamespaceNames) reservedRootIds.emplace(model return MAKE_STATELESS_VALIDATOR(NamespaceName,([maxNameSize, reservedRootIds](const auto &notification) { if(maxNameSize< notification.NameSize||!model::IsValidName(notification.NamePtr, notification.NameSize)) return Failure_Namespace_Invalid_Name;auto name=utils::RawString(reinterpret_cast< const char * >(notification.NamePtr), notification.NameSize);if(notification.NamespaceId !=model::GenerateNamespaceId(notification.ParentId, name)) return Failure_Namespace_Name_Id_Mismatch;auto namespaceId=Namespace_Base_Id==notification.ParentId ? notification.NamespaceId :notification.ParentId;if(reservedRootIds.cend() !=reservedRootIds.find(namespaceId)) return Failure_Namespace_Root_Name_Reserved;return ValidationResult::Success;}))
Definition: NamespaceNameValidator.cpp:36
catapult::subscribers::BasicAggregateSubscriber::forEach
void forEach(TAction action) const
Definition: BasicAggregateSubscriber.h:38
catapult::action
std::function< void()> action
An action function.
Definition: functions.h:27
catapult::subscribers::BasicAggregateSubscriber
Basic aggregate subscriber.
Definition: BasicAggregateSubscriber.h:29
catapult::validators::ValidationResult::Success
Validation succeeded.
ArraySet.h
catapult::validators::DECLARE_STATELESS_VALIDATOR
DECLARE_STATELESS_VALIDATOR(MaxTransactions, Notification)(uint32_t maxTransactions)
Definition: MaxTransactionsValidator.cpp:27
catapult::utils::KeyPointerSet
ArrayPointerSet< Key > KeyPointerSet
A key pointer set.
Definition: ArraySet.h:73
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::model::AccountAddressNotification
Notification of use of an account address.
Definition: Notifications.h:57
Validators.h