31#ifndef DW_FRAMEWORK_BASECLASS_NODE_HPP_
32#define DW_FRAMEWORK_BASECLASS_NODE_HPP_
36#include <dw/core/base/Types.h>
37#include <dw/core/context/ObjectExtra.h>
42#include <dw/core/logger/Logger.hpp>
44#include <dw/core/container/VectorFixed.hpp>
45#include <dw/core/container/BaseString.hpp>
56using dw::core::FixedString;
57using dw::core::VectorFixed;
58class ParameterProvider;
60#define _DW_CGF_STRINGIFY(x) #x
62#define STRING_VIEW_OF_FIXED_STRING_TEMPLATE_TYPE(x) dw::core::StringView("dw::core::FixedString<" _DW_CGF_STRINGIFY(x) ">", sizeof("dw::core::FixedString<" _DW_CGF_STRINGIFY(x) ">") - 1)
68 using Name_t = FixedString<MAX_NAME_LEN>;
122 virtual dwStatus
run() = 0;
162 dwProcessorType processorType,
163 dwProcessType processType) = 0;
170 virtual dwStatus
setName(const
char* name) = 0;
177 virtual dwStatus
getName(const
char** name) = 0;
407 if (m_sensorNode !=
nullptr)
409 throw ExceptionWithStatus(DW_INVALID_ARGUMENT,
"Passed node pointer does not implement ISensorNode.");
435 ISensorNode* m_sensorNode{};
Basic error signal that gets reported only when there is an error.
Basic health signal that describes the health status of the graph.
virtual dwStatus setAsyncReset()=0
Set the async reset flag.
virtual dwStatus executeAsyncReset()=0
Executes a reset if the async reset flag is set.
virtual ~IAsyncResetable()=default
virtual ~IChannelsConnectedListener()=default
virtual void onChannelsConnected()=0
Callback received after channels are connected.
virtual dwStatus preShutdown()=0
actions to be taken before node shutdown
virtual ~IContainsPreShutdownAction()=default
virtual dwStatus reset()=0
Executes reset of the node.
virtual ~IResetable()=default
virtual dwStatus setAffinityMask(uint)=0
Sets the affinity mask of the sensor.
virtual dwStatus setLockstepDeterministicMode(bool enable)=0
Set whether replay is running in lockstep deterministic mode.
virtual dwStatus setDataEventReadCallback(DataEventReadCallback cb)=0
Set read timestamp function for dataset replay. Timestamps not in the sequence returned by the callba...
virtual dwStatus setDataEventWriteCallback(DataEventWriteCallback cb)=0
Set write timestamp function for live case. Each timestamp of data output from the node will be passe...
virtual dwStatus start()=0
Start the sensor.
virtual dwStatus setEndTime(dwTime_t)=0
Set end timestamp for dataset replay.
dw::core::Function< bool(DataEvent &)> DataEventReadCallback
virtual dwStatus stop()=0
Stop the sensor.
virtual dwStatus isVirtual(bool *isVirtualBool)=0
distinguishes between a live and virtual sensor
DataEventType dataEventType
virtual dwStatus getNextTimestamp(dwTime_t &nextTimestamp)=0
Get the next timestamp of the sensor.
dw::core::Function< void(DataEvent)> DataEventWriteCallback
virtual dwStatus setThreadPriority(int)=0
Sets the thread priority of the sensor.
virtual dwStatus setStartTime(dwTime_t)=0
Set start timestamp for dataset replay.
virtual dwStatus validate()=0
Checks that all mandatory ports are bound. The implementation should validate that all the ports are ...
virtual dwStatus setNodePeriod(uint32_t period)=0
Set the node's period.
virtual dwStatus setOutputChannel(ChannelObject *channel, uint8_t portID)=0
Sets an output channel for this node with an accompanying port.
virtual dwStatus getInputPort(const uint8_t portID, dw::framework::PortBase *&port) const =0
Gets the input port associated with the port id.
virtual dwStatus runPass(size_t passIndex)=0
Run one pass by index as defined by the pass descriptors.
virtual dwStatus setInputChannel(ChannelObject *channel, uint8_t portID)=0
Sets an input channel for this node with an accompanying port.
virtual dwStatus getInputChannel(const uint8_t portID, ChannelObject *&channel) const =0
Gets the input channel associated with the input port.
virtual dwStatus run()=0
Runs all the passes in the node.
FixedString< MAX_NAME_LEN > Name_t
virtual dwStatus getErrorSignal(dwGraphErrorSignal *&errorSignal)=0
Get the pointer to the error signal for this node.
virtual dwStatus getPass(Pass **pass, uint8_t index)=0
Get a const pointer to the pass at a specific index.
static constexpr uint32_t MAX_PORT_COUNT
virtual size_t getPassCount() const noexcept=0
Get number of passes in the node.
virtual dwStatus getHealthSignal(dwGraphHealthSignal *&healthSignals, bool updateFromModule=false)=0
Get the pointer to the health signal for this node.
virtual dwStatus setIterationCount(uint32_t iterationCount)=0
Sets the node's iteration count.
static constexpr uint32_t MAX_PASS_COUNT
virtual void resetPorts()=0
Resets all the ports in the node.
virtual dwStatus getPasses(VectorFixed< Pass * > &passList)=0
Get all the passes in the node.
static constexpr size_t MAX_NAME_LEN
virtual dwStatus setName(const char *name)=0
Set the name of the node.
virtual dwStatus getOutputPort(const uint8_t portID, dw::framework::PortBase *&port) const =0
Gets the output port associated with the port id.
virtual dwStatus getName(const char **name)=0
Get the name of the node.
virtual dwStatus reportCurrentErrorSignal(dwGraphErrorSignal &signal)=0
A function that allows user override to update error signal It is automatically called by dwFramework...
virtual dwStatus reportCurrentHealthSignal(dwGraphHealthSignal &signal)=0
A function that allows user override to update health signal It is automatically called by dwFramewor...
virtual dwStatus reset()=0
Resets the state of the node.
virtual dwStatus setInputChannel(ChannelObject *channel, uint8_t portID, dwSerializationType dataType)=0
Sets an input channel for this node with an accompanying port.
virtual dwStatus getOutputChannel(const uint8_t portID, ChannelObject *&channel) const =0
Gets the output channel associated with the output port.
virtual dwStatus setState(const char *state)=0
Set the current state in node. Node implementation of this API need to be thread-safe.
Pass is a runnable describes the metadata of a pass.
ISensorNode::DataEventReadCallback DataEventReadCallback
Node const * getNode() const
ISensorNode * getSensorNode()
ISensorNode const * getSensorNode() const
ISensorNode::DataEventWriteCallback DataEventWriteCallback
constexpr size_t passIndex(dw::core::StringView identifier)
Get the the pass index for a pass identified by name.
dwTrivialDataType dataType
Number of levels in the pyramid.