30 template <
typename BaseType,
typename Wrapped>
34 using Wrapped::Wrapped;
38 if (base.
GetType() == LayerEnumOf<BaseType>())
40 Wrapped::Run(graph, *boost::polymorphic_downcast<BaseType*>(&base));
49 template <
typename Wrapped>
53 using Wrapped::Wrapped;
57 Wrapped::Run(graph, base);
64 template <
typename BaseType,
typename Wrapped>
76 template <
typename BaseType,
typename ChildType,
typename Wrapped>
80 using Wrapped::Wrapped;
84 for (
auto output = base.BeginOutputSlots(); output != base.EndOutputSlots(); ++output)
86 for (
auto&& childInput : output->GetConnections())
88 if (childInput->GetOwningLayer().GetType() == LayerEnumOf<ChildType>())
90 Wrapped::Run(graph, *childInput);
95 for (
unsigned int i = 0; i < output->GetNumConnections();)
97 Layer* child = &output->GetConnection(i)->GetOwningLayer();
115 template <
typename BaseType,
typename ChildType,
typename Wrapped>
117 :
public OptimizeForTypeImpl<BaseType, OptimizeForConnectionImpl<BaseType, ChildType, Wrapped>>
LayerType GetType() const
void Run(Graph &graph, Layer &base) const override
bool IsOutputUnconnected()
virtual void Run(Graph &graph, Layer &base) const =0
void EraseLayer(Iterator pos)
Deletes the layer at the specified position.
void Run(Graph &graph, Layer &base) const override
void Run(Graph &graph, BaseType &base) const
virtual ~Optimization()=default