46 void add(std::shared_ptr<NetworkOperator> op);
55 template <
typename OpType,
typename... Args>
56 std::shared_ptr<OpType>
emplace(Args&&... args)
58 auto op = std::make_shared<OpType>(std::forward<Args>(args)...);
59 m_operators.push_back(op);
71 void remove(
const std::shared_ptr<NetworkOperator>& op);
100 [[nodiscard]]
bool empty()
const {
return m_operators.empty(); }
105 [[nodiscard]]
size_t size()
const {
return m_operators.size(); }
111 [[nodiscard]] std::shared_ptr<NetworkOperator> get(
size_t index)
const;
117 template <
typename OpType>
118 [[nodiscard]] std::shared_ptr<OpType>
find()
const
120 for (
const auto& op : m_operators) {
121 if (
auto cast = std::dynamic_pointer_cast<OpType>(op))
133 [[nodiscard]]
const std::vector<std::shared_ptr<NetworkOperator>>&
operators()
const
Domain-agnostic interpretive lens for network processing.
std::vector< std::shared_ptr< NetworkOperator > > m_operators
std::shared_ptr< OpType > emplace(Args &&... args)
Construct an operator in-place and append it.
const std::vector< std::shared_ptr< NetworkOperator > > & operators() const
Read-only access to the underlying operator vector.
OperatorChain & operator=(const OperatorChain &)=delete
std::shared_ptr< OpType > find() const
Return the first operator whose dynamic type matches OpType, or nullptr.
OperatorChain(OperatorChain &&)=default
size_t size() const
Number of operators currently in the chain.
OperatorChain & operator=(OperatorChain &&)=default
bool empty() const
Returns true when the chain contains no operators.
OperatorChain(const OperatorChain &)=delete
Ordered sequence of secondary operators applied after the primary operator.