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__)
63#define NODE_INIT_INPUT_ARRAY_PORT(identifier, ...) \
64 this->template initInputArrayPort<NodeT, dw::framework::portIndex<NodeT, dw::framework::PortDirection::INPUT>(identifier)>(__VA_ARGS__)
70#define NODE_INIT_OUTPUT_PORT(identifier, ...) \
71 this->template initOutputPort<NodeT, dw::framework::portIndex<NodeT, dw::framework::PortDirection::OUTPUT>(identifier)>(__VA_ARGS__)
77#define NODE_INIT_OUTPUT_ARRAY_PORT(identifier, ...) \
78 this->template initOutputArrayPort<NodeT, dw::framework::portIndex<NodeT, dw::framework::PortDirection::OUTPUT>(identifier)>(__VA_ARGS__)
84#define NODE_GET_INPUT_PORT(identifier) this->template getInputPort<NodeT, NODE_GET_INPUT_PORT_INDEX(identifier)>()
89#define NODE_GET_INPUT_ARRAY_PORT(identifier, index) this->template getInputPort<NodeT, NODE_GET_INPUT_PORT_INDEX(identifier)>(index)
94#define NODE_GET_OUTPUT_PORT(identifier) this->template getOutputPort<NodeT, NODE_GET_OUTPUT_PORT_INDEX(identifier)>()
99#define NODE_GET_OUTPUT_ARRAY_PORT(identifier, index) this->template getOutputPort<NodeT, NODE_GET_OUTPUT_PORT_INDEX(identifier)>(index)
132 throw ExceptionWithStatus(DW_CALL_NOT_ALLOWED,
"Not meant to be called");
139 throw ExceptionWithStatus(DW_CALL_NOT_ALLOWED,
"Not meant to be called");
145 return this->
setup();
166 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED,
"Not implemented");
173 [&](
size_t portIdx) ->
bool {
174 const dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortInputBase>>& registeredPorts{
getRegisteredInputPorts()};
175 dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortInputBase>>::const_iterator it{registeredPorts.find(portIdx)};
176 if (it == registeredPorts.end())
178 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED,
"Input port was not registered");
180 if (it->second.get() ==
nullptr)
182 throw ExceptionWithStatus(DW_NOT_INITIALIZED,
"Input port was not initialized");
184 return it->second->isBound();
186 if (status != DW_SUCCESS)
191 size_t outputPortOffset{inputPortDescs.
getPortSize()};
194 [&](
size_t portIdx) ->
bool {
195 const dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortOutputBase>>& registeredPorts{
getRegisteredOutputPorts()};
196 dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortOutputBase>>::const_iterator it{registeredPorts.find(portIdx + outputPortOffset)};
197 if (it == registeredPorts.end())
199 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED,
"Output port was not registered");
201 if (it->second.get() ==
nullptr)
203 throw ExceptionWithStatus(DW_NOT_INITIALIZED,
"Output port was not initialized");
205 return it->second->isBound();
#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.
std::unique_ptr< Pass > createTeardownPass() override
std::unique_ptr< Pass > createSetupPass() override
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()