31 #ifndef DW_FRAMEWORK_PORTCOLLECTIONDESCRIPTOR_HPP_ 32 #define DW_FRAMEWORK_PORTCOLLECTIONDESCRIPTOR_HPP_ 37 #include <dw/core/container/BaseString.hpp> 38 #include <dw/core/container/StringView.hpp> 39 #include <dw/core/container/VectorFixed.hpp> 40 #include <dw/core/language/Tuple.hpp> 46 #define NODE_GET_INPUT_PORT_INDEX_EXTERNAL(NodeT, identifier) dw::framework::portIndex<NodeT, dw::framework::PortDirection::INPUT>(identifier) 47 #define NODE_GET_OUTPUT_PORT_INDEX_EXTERNAL(NodeT, identifier) dw::framework::portIndex<NodeT, dw::framework::PortDirection::OUTPUT>(identifier) 60 dw::core::StringView typeName,
size_t arraySize,
bool bindingRequired,
61 dw::core::StringView comment);
64 const dw::core::StringView&
getName()
const;
74 const dw::core::StringView&
getComment()
const;
78 dw::core::StringView m_name;
79 dw::core::StringView m_typeName;
81 bool m_bindingRequired;
82 dw::core::StringView m_comment;
94 size_t getDescriptorSize()
const;
96 size_t getPortSize()
const;
100 size_t getDescriptorIndex(
const char* identifier)
const;
102 const PortDescriptor& getDescriptor(
const char* identifier)
const;
104 size_t getPortIndex(
const char* identifier)
const;
108 bool isValid(
const char* identifier)
const;
115 dw::core::VectorFixed<PortDescriptor, MAX_PORT_DESCRIPTOR_PER_COLLECTION>
m_descriptors;
123 typename std::enable_if_t<Index == dw::core::tuple_size<decltype(describePorts<NodeT, Direction>())>::value,
void>* =
nullptr>
132 typename std::enable_if_t<Index<dw::core::tuple_size<decltype(describePorts<NodeT, Direction>())>::value,
void>* =
nullptr>
void addDescriptors(
PortCollectionDescriptor& d)
134 constexpr
auto t = dw::core::get<Index>(describePorts<NodeT, Direction>());
137 std::get<PORT_NAME>(t).data(),
138 std::get<PORT_TYPE_NAME>(t).data(),
139 std::get<PORT_ARRAY_SIZE>(t),
141 std::get<PORT_COMMENT>(t).data()));
142 addDescriptors<NodeT, Direction, Index + 1>(d);
149 typename std::enable_if_t<Direction == PortDirection::INPUT, void>* =
nullptr>
153 detail::addDescriptors<NodeT, Direction, 0>(d);
159 typename std::enable_if_t<Direction == PortDirection::OUTPUT, void>* =
nullptr>
163 detail::addDescriptors<NodeT, Direction, 0>(d);
170 #endif // DW_FRAMEWORK_PORTCOLLECTIONDESCRIPTOR_HPP_
void addDescriptor(PortDescriptor &&descriptor)
bool isBindingRequired() const
constexpr size_t portIndex(StringView identifier)
const dw::core::StringView & getComment() const
size_t getArraySize() const
PortDirection m_direction
PortDescriptor(PortDirection direction, dw::core::StringView name, dw::core::StringView typeName, size_t arraySize, bool bindingRequired, dw::core::StringView comment)
PortDirection getDirection() const
static constexpr size_t MAX_PORT_DESCRIPTOR_PER_COLLECTION
const dw::core::StringView & getTypeName() const
const dw::core::StringView & getName() const
dw::core::VectorFixed< PortDescriptor, MAX_PORT_DESCRIPTOR_PER_COLLECTION > m_descriptors
static PortCollectionDescriptor createPortCollectionDescriptor()