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 <dwshared/dwfoundation/dw/core/logger/Logger.hpp>
44#include <dwshared/dwfoundation/dw/core/container/VectorFixed.hpp>
45#include <dwshared/dwfoundation/dw/core/container/BaseString.hpp>
56using dw::core::FixedString;
57using dw::core::VectorFixed;
59class ParameterProvider;
61#define DW_CGF_STRINGIFY(x) #x
63#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)
112 virtual dwStatus
run() = 0;
153 dwProcessorType processorType) = 0;
160 virtual dwStatus
setName(const
char* name) = 0;
167 virtual dwStatus
getName(const
char** name) = 0;
451 if (m_sensorNode !=
nullptr)
453 throw ExceptionWithStatus(DW_INVALID_ARGUMENT,
"Passed node pointer does not implement ISensorNode.");
479 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 isEnabled(bool &isEnabled)=0
Whether or not the node is enabled.
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 addToHealthSignal(uint32_t error, dwTime_t timestamp=0UL)=0
A function the allows user to add an error to the health signal list.
virtual dwStatus getModuleHealthSignal(dwHealthSignal &healthSignal)=0
Return a copy of health signals from module that is a member of node.
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 collectErrorSignals(dwGraphErrorSignal *&errorSignal, bool updateFromModule=true)=0
Collect error signals from node and module, combine and return the pointer to the error signal for th...
virtual dwStatus setOutputChannel(ChannelObject *channel, uint8_t portID)=0
Sets an output channel for this node with an accompanying port.
virtual dwStatus collectHealthSignals(dwGraphHealthSignal *&healthSignal, bool updateFromModule=false)=0
Collect health signals from node and module, combine and return the pointer to the health signal for ...
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.
virtual dwStatus getPass(Pass **pass, uint8_t index)=0
Get a const pointer to the pass at a specific index.
virtual size_t getPassCount() const noexcept=0
Get number of passes in the node.
virtual dwStatus setIterationCount(uint32_t iterationCount)=0
Sets the node's iteration count.
virtual dwStatus getNodeErrorSignal(dwGraphErrorSignal &errorSignal)=0
Get a copy of the error signals for the node.
virtual dwStatus addToErrorSignal(uint32_t error, dwTime_t timestamp=0UL)=0
A function the allows user to add an error to the error signal list.
virtual dwStatus getModuleErrorSignal(dwErrorSignal &errorSignal)=0
Get a copy of the error signals from the module that is a member of this node.
virtual dwStatus updateCurrentHealthSignal(dwGraphHealthSignal &signal)=0
A function that allows user override to update health signal It is automatically called by dwFramewor...
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.
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 getNodeHealthSignal(dwGraphHealthSignal &healthSignal)=0
Return a copy of graph health signals for the node.
virtual dwStatus getName(const char **name)=0
Get the name of the node.
static constexpr const size_t MAX_NAME_LEN
virtual dwStatus updateCurrentErrorSignal(dwGraphErrorSignal &signal)=0
A function that allows user override to update error signal It is automatically called by dwFramework...
virtual dwStatus clearHealthSignal()=0
Clear the health signal for this node.
virtual dwStatus clearErrorSignal()=0
Clear the error signal for this node.
virtual dwStatus reset()=0
Resets the state of the node.
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.
Node const * getNode() const
ISensorNode * getSensorNode()
ISensorNode const * getSensorNode() const
constexpr size_t passIndex(dw::core::StringView identifier)
Get the the pass index for a pass identified by name.