Kanzi Connect 3.9.10
kanzi::connect::ConnectionManagerWorkItem Class Reference

Connection manager specific work item definition. More...

#include <connection_manager.hpp>

Inheritance diagram for kanzi::connect::ConnectionManagerWorkItem:
kanzi::connect::ConnectWorkItem

Public Types

enum  { CONNECTION_MANAGER_WORK_ITEM_TYPE = ConnectWorkItem::User + 1 }
 
- Public Types inherited from kanzi::connect::ConnectWorkItem
enum class  ExecutionContext { RUN_IN_MAIN_THREAD , RUN_IN_WORKER_THREAD }
 How to execute the work item. More...
 
typedef function< void(void)> Executor
 Callback function that is dispatched to work queue and is used to execute work.
 
enum  Priority { LowPriority = 1 , NormalPriority = 10 , HighPriority = 20 , SystemPriority = 30 }
 Priority levels for the work items. More...
 
enum  Type { Base , User = 1000 }
 Types for the work items. More...
 

Public Member Functions

 ConnectionManagerWorkItem (int32_t priority, int32_t client, NetworkListenerWeakPtr listener)
 Constructor.
 
int32_t getClientId () const
 Retrieve client identifier.
 
NetworkListenerSharedPtr getListener ()
 Retrieve comms interface.
 
- Public Member Functions inherited from kanzi::connect::ConnectWorkItem
 ConnectWorkItem (int32_t type=Base, int32_t priority=NormalPriority, ExecutionContext executionContext=ExecutionContext::RUN_IN_MAIN_THREAD)
 Constructor.
 
bool deadlineIsEarlierThan (const ConnectWorkItem &workItem) const
 Checks whether this object(s) deadline is earlier than with the "other" item.
 
ConnectWorkItem::Executor getExecutor () const
 Retrieve the executor function.
 
int32_t getPriority () const
 retrieve the work item priority
 
AbstractServiceSharedPtr getTargetService ()
 retrieve the service this work item is traveling to.
 
int32_t getType () const
 retrieve the work item type identifier
 
int64_t handle () const
 Returns the handle associated with the object.
 
bool hasExecutor () const
 Does the object have custom executor.
 
bool hasTimeout () const
 determines whether object defines a timeout
 
bool invokeWithExecutor ()
 Dispatches the object with executor.
 
bool runInWorkerThread () const
 Should this work item be run in worker thread or main thread.
 
void setExecutor (ConnectWorkItem::Executor executorFunction)
 Setups an executor function to execute the work item.
 
void setTargetService (AbstractServiceSharedPtr service)
 setups the target service
 
void setTimeout (chrono::milliseconds timeout, int64_t handle)
 Sets the timeout for the work item.
 
chrono::milliseconds timeoutUntilDeadline () const
 returns the timeout in milliseconds until this object time(s) out.
 
chrono::milliseconds timeoutUntilDeadline (chrono::time_point< chrono::steady_clock > &now) const
 returns the timeout in milliseconds until this object time(s) out.
 
virtual ~ConnectWorkItem ()
 virtual destructor for cleanup.
 

Protected Attributes

int32_t m_client
 identifies the source of the event.
 
NetworkListenerWeakPtr m_listener
 listener instance used to communicate with the client.
 
- Protected Attributes inherited from kanzi::connect::ConnectWorkItem
ExecutionContext m_executionContext
 Defines whether work item should be executed in main thread or one of the workers.
 
Executor m_executor
 Optional executor function that get(s) invoked to handle the item instead of passing it to the services handler function.
 
int32_t m_priority
 Priority value.
 
AbstractServiceWeakPtr m_service
 defines the service this work item is traveling to.
 
optional< TimerInfom_timerInfo
 Optional object that defines the scheduling information.
 
int32_t m_type
 Type identifier.
 

Additional Inherited Members

- Static Public Member Functions inherited from kanzi::connect::ConnectWorkItem
static ConnectWorkItemSharedPtr create (ExecutionContext executionContext=ExecutionContext::RUN_IN_MAIN_THREAD)
 Creates a default instance of the work item.
 

Detailed Description

Connection manager specific work item definition.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
CONNECTION_MANAGER_WORK_ITEM_TYPE 

Constructor & Destructor Documentation

◆ ConnectionManagerWorkItem()

kanzi::connect::ConnectionManagerWorkItem::ConnectionManagerWorkItem ( int32_t priority,
int32_t client,
NetworkListenerWeakPtr listener )
inline

Constructor.

Parameters
priorityPriority of the work item.
clientInvolved client.
listenerCommunication interface towards the client.

Member Function Documentation

◆ getClientId()

int32_t kanzi::connect::ConnectionManagerWorkItem::getClientId ( ) const
inline

Retrieve client identifier.

Returns
client identifier

◆ getListener()

NetworkListenerSharedPtr kanzi::connect::ConnectionManagerWorkItem::getListener ( )
inline

Retrieve comms interface.

Returns
pointer to communications interface.

Member Data Documentation

◆ m_client

int32_t kanzi::connect::ConnectionManagerWorkItem::m_client
protected

identifies the source of the event.

◆ m_listener

NetworkListenerWeakPtr kanzi::connect::ConnectionManagerWorkItem::m_listener
protected

listener instance used to communicate with the client.


The documentation for this class was generated from the following file: