0.5.0
Loading...
Searching...
No Matches
NAV::UdpRecv Class Reference

UDP Client. More...

Public Member Functions

void guiConfig () override
 ImGui config window which is shown on double click.
UdpRecvoperator= (const UdpRecv &)=delete
 Copy assignment operator.
UdpRecvoperator= (UdpRecv &&)=delete
 Move assignment operator.
bool resetNode () override
 Resets the node. Moves the read cursor to the start.
void restore (const json &j) override
 Restores the node from a json object.
json save () const override
 Saves the node into a json object.
std::string type () const override
 String representation of the Class Type.
 UdpRecv ()
 Default constructor.
 UdpRecv (const UdpRecv &)=delete
 Copy constructor.
 UdpRecv (UdpRecv &&)=delete
 Move constructor.
 ~UdpRecv () override
 Destructor.
Public Member Functions inherited from NAV::Node
virtual void afterCreateLink (OutputPin &startPin, InputPin &endPin)
 Called when a new link was established.
virtual void afterDeleteLink (OutputPin &startPin, InputPin &endPin)
 Called when a link was deleted.
bool doDeinitialize (bool wait=false)
 Asks the node worker to deinitialize the node.
bool doDisable (bool wait=false)
 Asks the node worker to disable the node.
bool doEnable ()
 Enable the node.
bool doInitialize (bool wait=false)
 Asks the node worker to initialize the node.
bool doReinitialize (bool wait=false)
 Asks the node worker to reinitialize the node.
virtual void flush ()
 Function called by the flow executer after finishing to flush out remaining data.
template<typename T>
std::optional< InputPin::IncomingLink::ValueWrapper< T > > getInputValue (size_t portIndex) const
 Get Input Value connected on the pin. Only const data types.
Mode getMode () const
 Get the current mode of the node.
const ImVec2 & getSize () const
 Get the size of the node.
State getState () const
 Get the current state of the node.
bool hasInputPinWithSameTime (const InsTime &insTime) const
 Checks wether there is an input pin with the same time.
InputPininputPinFromId (ax::NodeEditor::PinId pinId)
 Returns the pin with the given id.
size_t inputPinIndexFromId (ax::NodeEditor::PinId pinId) const
 Returns the index of the pin.
void invokeCallbacks (size_t portIndex, const std::shared_ptr< const NodeData > &data)
 Calls all registered callbacks on the specified output port.
bool isDisabled () const
 Checks if the node is disabled.
bool isInitialized () const
 Checks if the node is initialized.
bool isOnlyRealtime () const
 Checks if the node is only working in real time (sensors, network interfaces, ...)
bool isTransient () const
 Checks if the node is changing its state currently.
std::string nameId () const
 Node name and id.
 Node (const Node &)=delete
 Copy constructor.
 Node (Node &&)=delete
 Move constructor.
 Node (std::string name)
 Constructor.
void notifyOutputValueChanged (size_t pinIdx, const InsTime &insTime, const std::scoped_lock< std::mutex > &&guard)
 Notifies connected nodes about the change.
virtual bool onCreateLink (OutputPin &startPin, InputPin &endPin)
 Called when a new link is to be established.
virtual void onDeleteLink (OutputPin &startPin, InputPin &endPin)
 Called when a link is to be deleted.
Nodeoperator= (const Node &)=delete
 Copy assignment operator.
Nodeoperator= (Node &&)=delete
 Move assignment operator.
OutputPinoutputPinFromId (ax::NodeEditor::PinId pinId)
 Returns the pin with the given id.
size_t outputPinIndexFromId (ax::NodeEditor::PinId pinId) const
 Returns the index of the pin.
void releaseInputValue (size_t portIndex)
 Unblocks the connected node. Has to be called when the input value should be released and getInputValue was not called.
std::scoped_lock< std::mutex > requestOutputValueLock (size_t pinIdx)
 Blocks the thread till the output values was read by all connected nodes.
virtual void restoreAtferLink (const json &j)
 Restores link related properties of the node from a json object.
void wakeWorker ()
 Wakes the worker thread.
virtual ~Node ()
 Destructor.

Static Public Member Functions

static std::string category ()
 String representation of the Class Category.
static std::string typeStatic ()
 String representation of the Class Type.
Static Public Member Functions inherited from NAV::Node
static std::string toString (State state)
 Converts the state into a printable text.

Private Member Functions

void asyncReceive ()
 Polls the next data.
void deinitialize () override
 Deinitialize the node.
bool initialize () override
 Initialize the node.

Private Attributes

std::array< char, UdpUtil::MAXIMUM_BYTES_charArray
 The array that contains the data from the UDP stream.
boost::asio::io_context _io_context
 Asynchronous receive fct.
bool _isStartup
 Startup handler: used in 'initialize()' to differentiate between startup and re-initialization.
UdpUtil::MessageType _outputType
 The selected output type in the GUI.
int _port
 UDP port number.
std::thread _recvThread
 Receiver thread.
bool _running
 Flag that indicates the running data link.
boost::asio::ip::udp::endpoint _sender_endpoint
 Boost udp endpoint.
boost::asio::ip::udp::socket _socket
 Boost udp socket.
std::chrono::steady_clock::time_point _startPoint
 Time point where the first package has been received.

Static Private Attributes

static constexpr size_t OUTPUT_PORT_INDEX_NODE_DATA
 Object (NodeData)

Additional Inherited Members

Public Types inherited from NAV::Node
enum class  Mode : uint8_t {
  REAL_TIME ,
  POST_PROCESSING
}
 Different Modes the Node can work in. More...
enum class  State : uint8_t {
  Disabled ,
  Deinitialized ,
  DoInitialize ,
  Initializing ,
  Initialized ,
  DoDeinitialize ,
  Deinitializing ,
  DoShutdown ,
  Shutdown
}
 Possible states of the node. More...
Data Fields inherited from NAV::Node
bool callbacksEnabled
 Enables the callbacks.
ax::NodeEditor::NodeId id
 Unique Id of the Node.
std::vector< InputPininputPins
 List of input pins.
Kind kind
 Kind of the Node.
std::string name
 Name of the Node.
std::vector< OutputPinoutputPins
 List of output pins.
std::multimap< InsTime, std::pair< OutputPin *, size_t > > pollEvents
 Map with callback events (sorted by time)
Protected Attributes inherited from NAV::Node
ImVec2 _guiConfigDefaultWindowSize
bool _hasConfig
 Flag if the config window should be shown.
bool _lockConfigDuringRun
 Lock the config when executing post-processing.
bool _onlyRealTime
 Whether the node can run in post-processing or only real-time.

Detailed Description

UDP Client.

Definition at line 34 of file udpRecv.hpp.

Constructor & Destructor Documentation

◆ UdpRecv() [1/3]

NAV::UdpRecv::UdpRecv ( )

Default constructor.

Definition at line 32 of file udpRecv.cpp.

◆ ~UdpRecv()

NAV::UdpRecv::~UdpRecv ( )
override

Destructor.

Definition at line 44 of file udpRecv.cpp.

◆ UdpRecv() [2/3]

NAV::UdpRecv::UdpRecv ( const UdpRecv & )
delete

Copy constructor.

◆ UdpRecv() [3/3]

NAV::UdpRecv::UdpRecv ( UdpRecv && )
delete

Move constructor.

Member Function Documentation

◆ asyncReceive()

void NAV::UdpRecv::asyncReceive ( )
private

Polls the next data.

Definition at line 208 of file udpRecv.cpp.

◆ category()

std::string NAV::UdpRecv::category ( )
staticnodiscard

String representation of the Class Category.

Definition at line 59 of file udpRecv.cpp.

◆ deinitialize()

void NAV::UdpRecv::deinitialize ( )
overrideprivatevirtual

Deinitialize the node.

Reimplemented from NAV::Node.

Definition at line 198 of file udpRecv.cpp.

◆ guiConfig()

void NAV::UdpRecv::guiConfig ( )
overridevirtual

ImGui config window which is shown on double click.

Attention
Don't forget to set _hasConfig to true in the constructor of the node

Reimplemented from NAV::Node.

Definition at line 64 of file udpRecv.cpp.

◆ initialize()

bool NAV::UdpRecv::initialize ( )
overrideprivatevirtual

Initialize the node.

Reimplemented from NAV::Node.

Definition at line 161 of file udpRecv.cpp.

◆ operator=() [1/2]

UdpRecv & NAV::UdpRecv::operator= ( const UdpRecv & )
delete

Copy assignment operator.

◆ operator=() [2/2]

UdpRecv & NAV::UdpRecv::operator= ( UdpRecv && )
delete

Move assignment operator.

◆ resetNode()

bool NAV::UdpRecv::resetNode ( )
overridevirtual

Resets the node. Moves the read cursor to the start.

Reimplemented from NAV::Node.

Definition at line 108 of file udpRecv.cpp.

◆ restore()

void NAV::UdpRecv::restore ( const json & j)
overridevirtual

Restores the node from a json object.

Parameters
[in]jJson object with the node state

Reimplemented from NAV::Node.

Definition at line 124 of file udpRecv.cpp.

◆ save()

json NAV::UdpRecv::save ( ) const
nodiscardoverridevirtual

Saves the node into a json object.

Reimplemented from NAV::Node.

Definition at line 113 of file udpRecv.cpp.

◆ type()

std::string NAV::UdpRecv::type ( ) const
nodiscardoverridevirtual

String representation of the Class Type.

Implements NAV::Node.

Definition at line 54 of file udpRecv.cpp.

◆ typeStatic()

std::string NAV::UdpRecv::typeStatic ( )
staticnodiscard

String representation of the Class Type.

Definition at line 49 of file udpRecv.cpp.

Field Documentation

◆ _charArray

std::array<char, UdpUtil::MAXIMUM_BYTES> NAV::UdpRecv::_charArray
private

The array that contains the data from the UDP stream.

Definition at line 110 of file udpRecv.hpp.

◆ _io_context

boost::asio::io_context NAV::UdpRecv::_io_context
private

Asynchronous receive fct.

Definition at line 92 of file udpRecv.hpp.

◆ _isStartup

bool NAV::UdpRecv::_isStartup
private

Startup handler: used in 'initialize()' to differentiate between startup and re-initialization.

Definition at line 104 of file udpRecv.hpp.

◆ _outputType

UdpUtil::MessageType NAV::UdpRecv::_outputType
private

The selected output type in the GUI.

Definition at line 89 of file udpRecv.hpp.

◆ _port

int NAV::UdpRecv::_port
private

UDP port number.

Definition at line 86 of file udpRecv.hpp.

◆ _recvThread

std::thread NAV::UdpRecv::_recvThread
private

Receiver thread.

Definition at line 99 of file udpRecv.hpp.

◆ _running

bool NAV::UdpRecv::_running
private

Flag that indicates the running data link.

Definition at line 102 of file udpRecv.hpp.

◆ _sender_endpoint

boost::asio::ip::udp::endpoint NAV::UdpRecv::_sender_endpoint
private

Boost udp endpoint.

Definition at line 96 of file udpRecv.hpp.

◆ _socket

boost::asio::ip::udp::socket NAV::UdpRecv::_socket
private

Boost udp socket.

Definition at line 94 of file udpRecv.hpp.

◆ _startPoint

std::chrono::steady_clock::time_point NAV::UdpRecv::_startPoint
private

Time point where the first package has been received.

Definition at line 107 of file udpRecv.hpp.

◆ OUTPUT_PORT_INDEX_NODE_DATA

size_t NAV::UdpRecv::OUTPUT_PORT_INDEX_NODE_DATA
staticconstexprprivate

Object (NodeData)

Definition at line 74 of file udpRecv.hpp.


The documentation for this class was generated from the following files:
  • /home/runner/work/INSTINCT/INSTINCT/src/Nodes/DataLink/udpRecv.hpp
  • /home/runner/work/INSTINCT/INSTINCT/src/Nodes/DataLink/udpRecv.cpp