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
const&& 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
const&& name_, dwProcessorType processorType_, std::array<dw::core::StringView, NumberOfDependencies>
const&& dependencies_)
79 :
name{std::move(name_)}
93 dw::core::StringView
const&& name, dwProcessorType processorType)
97 std::move(processorType));
107template <
typename DependenciesT>
114 std::move(processorType),
115 std::move(dependencies));
123template <
typename... Args>
127 return {std::forward<const Args>(args)...};
131template <
typename Node>
140template <
typename Node>
144 return std::tuple_size<decltype(describePasses<Node>())>::value;
149template <
typename Node>
153 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);
173 typename Node,
size_t Index,
174 typename std::enable_if_t<Index<passSize<Node>(),
void>* =
nullptr>
176 constexpr std::size_t
passIndex(dw::core::StringView identifier)
178 constexpr dw::core::StringView name{std::get<Index>(describePasses<Node>()).name};
179 if (name == identifier)
185 return 1U + passIndex<Node, Index + 1>(identifier);
191template <
typename Node>
193constexpr size_t passIndex(dw::core::StringView identifier)
195 return detail::passIndex<Node, 0>(identifier);
199template <
typename Node>
203 constexpr size_t index = passIndex<Node>(identifier);
204 return isValidPass<Node>(index);
208template <
typename Node,
size_t Index>
212 return std::get<Index>(describePasses<Node>()).name;
216template <
typename Node,
size_t Index>
220 return std::get<Index>(describePasses<Node>()).processorType;
224template <
typename Node,
size_t Index>
228 return std::get<Index>(describePasses<Node>()).hasDependencies;
232template <
typename Node,
size_t Index>
237 return std::get<Index>(describePasses<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 bool isValidPass(std::size_t passID)
Check if pass index is valid.
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 auto describePasses()
Get described passes for the passed node.
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 PassDescriptorT< 0 > describePass(dw::core::StringView const &&name, dwProcessorType processorType)
constexpr auto describePassDependencies(const Args &&... args) -> std::array< dw::core::StringView, sizeof...(Args)>
constexpr PassDescriptorT(dw::core::StringView const &&name_, dwProcessorType processorType_)
std::array< dw::core::StringView, NumberOfDependencies > dependencies
dw::core::StringView name
constexpr PassDescriptorT(dw::core::StringView const &&name_, dwProcessorType processorType_, std::array< dw::core::StringView, NumberOfDependencies > const &&dependencies_)
dwProcessorType processorType