NAP
Public Member Functions | Public Attributes | List of all members
UDPThread Class Reference

#include <udpthread.h>

Public Member Functions

 UDPThread ()
 
 UDPThread (UDPService &service)
 
virtual ~UDPThread ()
 
virtual bool start (utility::ErrorState &errorState) override final
 
virtual void stop () override final
 
asio::io_context & getIOContext ()
 
void manualProcess ()
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual bool init (utility::ErrorState &errorState)
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

EUDPThreadUpdateMethod mUpdateMethod = EUDPThreadUpdateMethod::UDP_MAIN_THREAD
 Property: 'Update Method' the way the UDPThread should process adapters. More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

UDPThread is a device that calls the process() function on UDPAdapters. UDPAdapters are typically UDPServers or UDPClients. The UDPThread can can run on the main thread, in which case it registers itself to the UDPService, in that case the UDPThread will call process() of the registered adapters inside the update() call of the UDPService. The UDPThread can spawn its own thread, in which case process() will be called within the while loop of a newly spawned thread. When the user chooses to use MANUAL, process() will be called only when the user explicitly calls the manualProcess() function of the UDPThread

Inheritance diagram for UDPThread:
[legend]
Collaboration diagram for UDPThread:
[legend]

Constructor & Destructor Documentation

◆ UDPThread() [1/2]

UDPThread ( )

◆ UDPThread() [2/2]

UDPThread ( UDPService service)

Constructor

Parameters
servicereference to UDP service

◆ ~UDPThread()

virtual ~UDPThread ( )
virtual

Destructor

Member Function Documentation

◆ getIOContext()

asio::io_context& getIOContext ( )
Returns
asio IO context

◆ manualProcess()

void manualProcess ( )

Call this when update method is set to manual. If the update method is MAIN_THREAD or SPAWN_OWN_THREAD, this function will not do anything.

◆ start()

virtual bool start ( utility::ErrorState errorState)
finaloverridevirtual

Starts the UDPThread, spawns new thread if necessary or registers to UDPService

Parameters
errorStatecontains any errors
Returns
true on succes

Reimplemented from Device.

◆ stop()

virtual void stop ( )
finaloverridevirtual

Stops the UDPThread, stops own thread or removes itself from service

Reimplemented from Device.

Member Data Documentation

◆ mUpdateMethod

EUDPThreadUpdateMethod mUpdateMethod = EUDPThreadUpdateMethod::UDP_MAIN_THREAD

Property: 'Update Method' the way the UDPThread should process adapters.