31#ifndef DW_FRAMEWORK_SIMPLENODET_HPP_
32#define DW_FRAMEWORK_SIMPLENODET_HPP_
40#define NODE_GET_INPUT_PORT_INDEX(identifier) dw::framework::portIndex<NodeT, dw::framework::PortDirection::INPUT>(identifier)
42#define NODE_GET_OUTPUT_PORT_INDEX(identifier) dw::framework::portIndex<NodeT, dw::framework::PortDirection::OUTPUT>(identifier)
49#define NODE_REGISTER_PASS(identifier, ...) this->template registerPass<NodeT, dw::framework::passIndex<NodeT>(identifier)>(__VA_ARGS__)
56#define NODE_INIT_INPUT_PORT(identifier, ...) \
57 this->template initInputPort<NodeT, dw::framework::portIndex<NodeT, dw::framework::PortDirection::INPUT>(identifier)>(__VA_ARGS__)
65#define NODE_INIT_INPUT_ARRAY_PORTS(identifier, ...) \
66 this->template initInputArrayPorts<NodeT, dw::framework::portIndex<NodeT, dw::framework::PortDirection::INPUT>(identifier)>(__VA_ARGS__)
72#define NODE_INIT_INPUT_ARRAY_PORT(identifier, arrayIndex, ...) \
73 this->template initInputArrayPort<NodeT, dw::framework::portIndex<NodeT, dw::framework::PortDirection::INPUT>(identifier)>(arrayIndex, __VA_ARGS__)
79#define NODE_INIT_OUTPUT_PORT(identifier, ...) \
80 this->template initOutputPort<NodeT, dw::framework::portIndex<NodeT, dw::framework::PortDirection::OUTPUT>(identifier)>(__VA_ARGS__)
88#define NODE_INIT_OUTPUT_ARRAY_PORTS(identifier, ...) \
89 this->template initOutputArrayPorts<NodeT, dw::framework::portIndex<NodeT, dw::framework::PortDirection::OUTPUT>(identifier)>(__VA_ARGS__)
95#define NODE_INIT_OUTPUT_ARRAY_PORT(identifier, arrayIndex, ...) \
96 this->template initOutputArrayPort<NodeT, dw::framework::portIndex<NodeT, dw::framework::PortDirection::OUTPUT>(identifier)>(arrayIndex, __VA_ARGS__)
102#define NODE_GET_INPUT_PORT(identifier) this->template getInputPort<NodeT, NODE_GET_INPUT_PORT_INDEX(identifier)>()
107#define NODE_GET_INPUT_ARRAY_PORT(identifier, index) this->template getInputPort<NodeT, NODE_GET_INPUT_PORT_INDEX(identifier)>(index)
112#define NODE_GET_OUTPUT_PORT(identifier) this->template getOutputPort<NodeT, NODE_GET_OUTPUT_PORT_INDEX(identifier)>()
117#define NODE_GET_OUTPUT_ARRAY_PORT(identifier, index) this->template getOutputPort<NodeT, NODE_GET_OUTPUT_PORT_INDEX(identifier)>(index)
149 return this->
setup();
170 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED,
"Not implemented");
177 [&](
size_t portIdx) ->
bool {
178 const dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortInputBase>>& registeredPorts{
getRegisteredInputPorts()};
179 dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortInputBase>>::const_iterator it{registeredPorts.find(portIdx)};
180 if (it == registeredPorts.end())
182 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED,
"Input port was not registered");
184 if (it->second.get() ==
nullptr)
186 throw ExceptionWithStatus(DW_NOT_INITIALIZED,
"Input port was not initialized");
188 return it->second->isBound();
190 if (status != DW_SUCCESS)
195 size_t outputPortOffset{inputPortDescs.
getPortSize()};
198 [&](
size_t portIdx) ->
bool {
199 const dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortOutputBase>>& registeredPorts{
getRegisteredOutputPorts()};
200 dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortOutputBase>>::const_iterator it{registeredPorts.find(portIdx + outputPortOffset)};
201 if (it == registeredPorts.end())
203 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED,
"Output port was not registered");
205 if (it->second.get() ==
nullptr)
207 throw ExceptionWithStatus(DW_NOT_INITIALIZED,
"Output port was not initialized");
209 return it->second->isBound();
219 {{DW_NOT_AVAILABLE, 0U}});
#define NODE_REGISTER_PASS(identifier,...)
Register a pass function with the node base class.
size_t getPortSize() const
dwStatus validate() override
Validate that all registered ports which have the flag binding-required are bound to a channel.
SimpleNodeT()
Default constructor registering the setup and teardown passes.
virtual dwStatus setupImpl()
The default implementation calls SimpleNode::setup.
SimpleNodeT(NodeAllocationParams params)
virtual dwStatus teardownImpl()
The default implementation calls SimpleNode::teardown.
dwStatus reset() override
The default implementation calls SimpleNode::resetPorts.
dwStatus validate() override
const dw::core::HeapHashMap< size_t, std::shared_ptr< ManagedPortOutputBase > > & getRegisteredOutputPorts() const
const dw::core::HeapHashMap< size_t, std::shared_ptr< ManagedPortInputBase > > & getRegisteredInputPorts() const
void resetPorts() override
Default implementation to reset ports managed by the base class.
dwStatus setup()
Default implementation of the setup pass.
dwStatus teardown()
Default implementation of the teardown pass.
NodeAllocationParams createAllocationParams()