49 std::shared_ptr<Chain> chain, std::optional<If> condition)
50 :
Rule(
std::move(condition)), chain_(
std::move(chain))
52 if (chain_ ==
nullptr)
54 throw std::invalid_argument(
"Given chain pointer is null.");
76 std::shared_ptr<Chain> chain,
int priority,
77 std::optional<If> condition)
78 :
Rule(
std::move(condition)), chain_(
std::move(chain)), priority_(priority)
80 if (chain_ ==
nullptr)
82 throw std::invalid_argument(
"Given chain pointer is null.");
95 os <<
"call " << chain_->name();
99 os <<
" with priority " << priority_.value();
126 auto result = chain_->action(packet, address);
132 result.priority(priority_.value());
146 return std::make_unique<Call>(chain_, priority_.value(),
condition_);
149 return std::make_unique<Call>(chain_,
condition_);
159 return typeid(*this) ==
typeid(other) &&
160 chain_ == static_cast<const Call &>(other).chain_ &&
161 priority_ ==
static_cast<const Call &
>(other).priority_ &&
162 condition_ == static_cast<const Call &>(other).condition_;
172 return typeid(*this) !=
typeid(other) ||
173 chain_ != static_cast<const Call &>(other).chain_ ||
174 priority_ !=
static_cast<const Call &
>(other).priority_ ||
175 condition_ != static_cast<const Call &>(other).condition_;
virtual bool operator!=(const Rule &other) const
static Action make_continue()
Call(std::shared_ptr< Chain > chain, std::optional< If > condition={})
std::optional< If > condition_
virtual Action action(const Packet &packet, const MAVAddress &address) const
virtual std::unique_ptr< Rule > clone() const
virtual bool operator==(const Rule &other) const
virtual std::ostream & print_(std::ostream &os) const