31#ifndef DW_FRAMEWORK_PASSDESCRIPTOR_HPP_
32#define DW_FRAMEWORK_PASSDESCRIPTOR_HPP_
34#include <dw/core/base/Types.h>
35#include <dwshared/dwfoundation/dw/core/container/StringView.hpp>
54template <
typename... Args>
58 return std::make_tuple(std::forward<const Args>(args)...);
61template <
size_t NumberOfDependencies>
67 std::array<dw::core::StringView, NumberOfDependencies>
dependencies;
69 constexpr PassDescriptorT(dw::core::StringView&& name_, dwProcessorType processorType_)
70 :
name{std::move(name_)}
75 static_assert(NumberOfDependencies == 0,
"PassDescriptorT constructor without dependencies only available with NumberOfDependencies == 0");
78 constexpr PassDescriptorT(dw::core::StringView&& name_, dwProcessorType processorType_, std::array<dw::core::StringView, NumberOfDependencies>&& dependencies_)
79 :
name{std::move(name_)}
93 dw::core::StringView&& name, dwProcessorType processorType)
97 std::move(processorType));
106template <
typename DependenciesT>
113 std::move(processorType),
114 std::move(dependencies));
122template <
typename... Args>
126 return {std::forward<const Args>(args)...};
130template <
typename Node>
135 return Node::describePasses();
139template <
typename Node>
143 return std::tuple_size<decltype(describeNodePasses<Node>())>::value;
148template <
typename Node>
152 return passID < passSize<Node>();
161 typename Node,
size_t Index,
162 typename std::enable_if_t<Index == passSize<Node>(),
void>* =
nullptr>
164constexpr std::size_t
passIndex(dw::core::StringView identifier)
166 static_cast<void>(identifier);
174 typename Node,
size_t Index,
175 typename std::enable_if_t<Index<passSize<Node>(),
void>* =
nullptr>
177 constexpr std::size_t
passIndex(dw::core::StringView identifier)
179 constexpr dw::core::StringView name{std::get<Index>(describeNodePasses<Node>()).name};
180 if (name == identifier)
186 return 1U + passIndex<Node, Index + 1>(identifier);
192template <
typename Node>
194constexpr size_t passIndex(dw::core::StringView identifier)
196 return detail::passIndex<Node, 0>(identifier);
200template <
typename Node>
204 return isValidPassIndex<Node>(passIndex<Node>(identifier));
208template <
typename Node,
size_t Index>
212 return std::get<Index>(describeNodePasses<Node>()).name;
216template <
typename Node,
size_t Index>
220 return std::get<Index>(describeNodePasses<Node>()).processorType;
224template <
typename Node,
size_t Index>
228 return std::get<Index>(describeNodePasses<Node>()).hasDependencies;
232template <
typename Node,
size_t Index>
237 return std::get<Index>(describeNodePasses<Node>()).dependencies;
constexpr std::size_t passSize()
Get the number of passes of the passed node.
constexpr dwProcessorType passProcessorType()
Get the processor type of a pass.
constexpr auto describePassWithCustomDependencies(dw::core::StringView &&name, dwProcessorType processorType, DependenciesT &&dependencies) -> PassDescriptorT< std::tuple_size< DependenciesT >::value >
constexpr bool isValidPassIndex(std::size_t passID)
Check if pass index is valid.
constexpr bool isValidPass(dw::core::StringView identifier)
Check if given string is a valid pass name.
constexpr dw::core::StringView passName()
Get the name of a pass.
constexpr size_t passIndex(dw::core::StringView identifier)
Get the the pass index for a pass identified by name.
constexpr PassDescriptorT< 0 > describePass(dw::core::StringView &&name, dwProcessorType processorType)
constexpr bool hasPassDependencies()
Check if a pass specifies explicit dependencies.
constexpr auto describePassCollection(const Args &&... args) -> std::tuple< Args... >
constexpr auto passDependencies()
Get the dependencies of a pass (which returns an empty collection for passes without explicit depende...
constexpr auto describeNodePasses()
Get described passes for the passed node.
constexpr auto describePassDependencies(const Args &&... args) -> std::array< dw::core::StringView, sizeof...(Args)>
std::array< dw::core::StringView, NumberOfDependencies > dependencies
constexpr PassDescriptorT(dw::core::StringView &&name_, dwProcessorType processorType_)
dw::core::StringView name
dwProcessorType processorType
constexpr PassDescriptorT(dw::core::StringView &&name_, dwProcessorType processorType_, std::array< dw::core::StringView, NumberOfDependencies > &&dependencies_)