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);
86 void process(
float dt);
95 [[nodiscard]]
bool empty()
const {
return m_operators.empty(); }
100 [[nodiscard]]
size_t size()
const {
return m_operators.size(); }
106 [[nodiscard]] std::shared_ptr<NetworkOperator> get(
size_t index)
const;
112 template <
typename OpType>
113 [[nodiscard]] std::shared_ptr<OpType>
find()
const
115 for (
const auto& op : m_operators) {
116 if (
auto cast = std::dynamic_pointer_cast<OpType>(op))
128 [[nodiscard]]
const std::vector<std::shared_ptr<NetworkOperator>>&
operators()
const
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.