CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
27 namespace catapult {
namespace validators {
30 template<
typename... TArgs>
33 template<
typename TNotification>
40 template<
typename TNotification>
42 if constexpr (!std::is_same_v<model::Notification, TNotification>) {
43 auto predicate = [type = TNotification::Notification_Type](
const auto& notification) {
56 return add<model::Notification>(std::move(pValidator));
61 return m_builder.build(isSuppressedFailure);
65 template<
typename TNotification>
76 const std::string&
name()
const override {
84 return m_pValidator->validate(static_cast<const TNotification&>(notification), std::forward<TArgs>(args)...);
std::unique_ptr< const AggregateNotificationValidatorT< model::Notification, TArgs... > > AggregateValidatorPointer
Definition: DemuxValidatorBuilder.h:36
A demultiplexing validator builder.
Definition: DemuxValidatorBuilder.h:31
Definition: DemuxValidatorBuilder.h:66
AggregateValidatorBuilder< model::Notification, TArgs... > m_builder
Definition: DemuxValidatorBuilder.h:93
ValidationResult validate(const model::Notification ¬ification, TArgs &&... args) const override
Validates a single notification with contextual information args.
Definition: DemuxValidatorBuilder.h:80
std::function< bool(TArgs...)> predicate
A predicate function.
Definition: functions.h:31
A strongly typed notification validator.
Definition: NotificationValidator.h:30
ValidationResult
Enumeration of all possible validation results.
Definition: ValidationResult.h:51
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
A strongly typed aggregate notification validator builder.
Definition: AggregateValidatorBuilder.h:31
AggregateValidatorPointer build(const ValidationResultPredicate &isSuppressedFailure)
Builds a demultiplexing validator that ignores suppressed failures according to isSuppressedFailure.
Definition: DemuxValidatorBuilder.h:60
predicate< const model::Notification & > NotificationValidatorPredicate
Definition: DemuxValidatorBuilder.h:35
DemuxValidatorBuilderT & add(NotificationValidatorPointerT< model::Notification > &&pValidator)
Adds a validator (pValidator) to the builder that is always invoked.
Definition: DemuxValidatorBuilder.h:55
A strongly typed aggregate notification validator.
Definition: AggregateNotificationValidator.h:29
NotificationValidatorPointerT< TNotification > m_pValidator
Definition: DemuxValidatorBuilder.h:88
NotificationValidatorPredicate m_predicate
Definition: DemuxValidatorBuilder.h:89
predicate< ValidationResult > ValidationResultPredicate
Validation result predicate.
Definition: ValidatorTypes.h:42
const std::string & name() const override
Gets the validator name.
Definition: DemuxValidatorBuilder.h:76
A basic notification.
Definition: Notifications.h:36
std::unique_ptr< const NotificationValidatorT< TNotification, TArgs... > > NotificationValidatorPointerT
Definition: DemuxValidatorBuilder.h:34
Definition: AddressExtractionExtension.cpp:28
ConditionalValidator(NotificationValidatorPointerT< TNotification > &&pValidator, const NotificationValidatorPredicate &predicate)
Definition: DemuxValidatorBuilder.h:68
constexpr bool AreEqualExcludingChannel(NotificationType lhs, NotificationType rhs)
Returns true if lhs and rhs have the same source (facility and code).
Definition: NotificationType.h:78
DemuxValidatorBuilderT & add(NotificationValidatorPointerT< TNotification > &&pValidator)
Adds a validator (pValidator) to the builder that is invoked only when matching notifications are pro...
Definition: DemuxValidatorBuilder.h:41