Kanzi Connect  3.9.8
Kanzi Connect C++ API
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  ExecutionContext { ExecutionContext::RUN_IN_MAIN_THREAD, ExecutionContext::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. More...
 
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. More...
 
int32_t getClientId () const
 Retrieve client identifier. More...
 
NetworkListenerSharedPtr getListener ()
 Retrieve comms interface. More...
 
- 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. More...
 
bool deadlineIsEarlierThan (const ConnectWorkItem &workItem) const
 Checks whether this object(s) deadline is earlier than with the "other" item. More...
 
ConnectWorkItem::Executor getExecutor () const
 Retrieve the executor function. More...
 
int32_t getPriority () const
 retrieve the work item priority More...
 
AbstractServiceSharedPtr getTargetService ()
 retrieve the service this work item is traveling to. More...
 
int32_t getType () const
 retrieve the work item type identifier More...
 
int64_t handle () const
 Returns the handle associated with the object. More...
 
bool hasExecutor () const
 Does the object have custom executor. More...
 
bool hasTimeout () const
 determines whether object defines a timeout More...
 
bool invokeWithExecutor ()
 Dispatches the object with executor. More...
 
bool runInWorkerThread () const
 Should this work item be run in worker thread or main thread. More...
 
void setExecutor (ConnectWorkItem::Executor executorFunction)
 Setups an executor function to execute the work item. More...
 
void setTargetService (AbstractServiceSharedPtr service)
 setups the target service More...
 
void setTimeout (chrono::milliseconds timeout, int64_t handle)
 Sets the timeout for the work item. More...
 
chrono::milliseconds timeoutUntilDeadline (chrono::time_point< chrono::steady_clock > &now) const
 returns the timeout in milliseconds until this object time(s) out. More...
 
chrono::milliseconds timeoutUntilDeadline () const
 returns the timeout in milliseconds until this object time(s) out. More...
 
virtual ~ConnectWorkItem ()
 virtual destructor for cleanup. More...
 

Protected Attributes

int32_t m_client
 identifies the source of the event. More...
 
NetworkListenerWeakPtr m_listener
 listener instance used to communicate with the client. More...
 
- 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. More...
 
Executor m_executor
 Optional executor function that get(s) invoked to handle the item instead of passing it to the services handler function. More...
 
int32_t m_priority
 Priority value. More...
 
AbstractServiceWeakPtr m_service
 defines the service this work item is traveling to. More...
 
optional< TimerInfom_timerInfo
 Optional object that defines the scheduling information. More...
 
int32_t m_type
 Type identifier. More...
 

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. More...
 

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: