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/base/ObjectExtra.h>
39#include <dwcgf/Types.hpp>
44#include <dw/core/container/VectorFixed.hpp>
45#include <dw/core/container/BaseString.hpp>
55using dw::core::FixedString;
56using dw::core::VectorFixed;
57class ParameterProvider;
59#define _DW_CGF_STRINGIFY(x) #x
61#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)
67 using Name_t = FixedString<MAX_NAME_LEN>;
72 static constexpr uint8_t
PASS_SETUP = std::numeric_limits<uint8_t>::max() - 1;
73 static constexpr uint8_t
PASS_TEARDOWN = std::numeric_limits<uint8_t>::max();
123 virtual dwStatus
run() = 0;
160 dwProcessorType processorType,
161 dwProcessType processType) = 0;
168 virtual dwStatus
setName(const
char* name) = 0;
175 virtual dwStatus
getName(const
char** name) = 0;
343 if (m_sensorNode !=
nullptr)
345 throw Exception(DW_INVALID_ARGUMENT,
"Passed node pointer does not implement ISensorNode.");
371 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 dwStatus preShutdown()=0
actions to be taken before node shutdown
virtual ~IContainsPreShutdownAction()=default
virtual dwStatus setAffinityMask(uint)=0
Sets the affinity mask of the sensor.
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
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 setOutputChannel(ChannelObject *channel, uint8_t portID)=0
Sets an output channel for this node with an accompanying port.
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.
static constexpr uint8_t PASS_TEARDOWN
virtual dwStatus run()=0
Runs all the passes in the node.
FixedString< MAX_NAME_LEN > Name_t
static constexpr uint8_t PASS_SETUP
virtual dwStatus getErrorSignal(dwGraphErrorSignal *&errorSignal)=0
Get the pointer to the error signal for this node.
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 dwStatus getPasses(VectorFixed< Pass * > &passList)=0
Get all the passes in the node.
static constexpr size_t MAX_NAME_LEN
virtual dwStatus runPassByID(uint8_t passID)=0
Run one pass by ID as defined by the PassList enum class.
virtual dwStatus setName(const char *name)=0
Set the name of the node.
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 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.