IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
ipsdk::core::SocketsPool Class Reference

Singleton used for socket pool management. More...

#include <SocketsPool.h>

Inheritance diagram for ipsdk::core::SocketsPool:

Public Member Functions

void init (const LocalNetworkDescription &localNetworkDescription)
 initializes connections from network description passed as argument, and callback object More...
 
bool isInit () const
 returns true if the object is initialized (ie. init has been called)
 
void asyncConnect (const tcpip::Address &remoteAddress)
 method allowing to connect to a given remote computer More...
 
void asyncClose (const Guid &socketGuid)
 closes connection identified by 'socketGuid' More...
 
ipUInt64 asyncDeliver (const SerializationObjectPtr &pObj)
 delivers the object 'pObj' through all the established connections More...
 
ipUInt64 asyncDeliver (const Guid &socketGuid, const SerializationObjectPtr &pObj, const ipsdk::tcpip::DlvCbFun &f=0)
 delivers the object 'pObj' through the connection identified by 'socketGuid' More...
 
Guid addCnxLossCB (const Guid &socketGuid, const tcpip::CnxLossCbFun &f)
 adds callback function'f' to collection of functions that will automatically be called when the socket 'socketGuid' will be disconnected More...
 
void clearCnxLossCB (const Guid &socketGuid)
 clear callback functions for event "socket 'socketGuid' disconnected" More...
 
void removeCnxLossCB (const Guid &socketGuid, const Guid &cbId)
 remove callback functions from collection of functions that will automatically called when the socket 'socketGuid' will be disconnected More...
 
void clear ()
 
boost::optional< tcpip::SocketDescgetSocketDesc (const Guid &socketGuid) const
 returns SocketDesc object associated to identifier 'socketGuid' if 'socketGuid' identifies an existing active connection More...
 
boost::optional< GuidgetGuid (const tcpip::Address &remoteAddress) const
 
const tcpip::AddressgetLocalAddress () const
 retrieve tcpip address informations associated to local computer More...
 
const SocketsPoolCBgetSocketsPoolCB () const
 retrieve socket pool callback More...
 
SocketsPoolCBgetSocketsPoolCB ()
 retrieve socket pool callback More...
 

Static Public Member Functions

static SocketsPoolgetInstance ()
 retrieve single instance of object
 

Protected Member Functions

Constructors and destructors
 SocketsPool ()
 
 ~SocketsPool ()
 

Protected Attributes

tcpip::CollPeersPtr _pCollPeers
 pointer to implementation object
 
boost::shared_ptr< SocketsPoolCB_pSocketsPoolCB
 pointer to used call back object
 
tcpip::Address _localAddress
 tcpip address informations associated to local computer
 
ipUInt16 _portNumber
 used socket port number
 

Detailed Description

Singleton used for socket pool management.

Author
H. Delestre
Date
2013/12/4

Member Function Documentation

◆ init()

void ipsdk::core::SocketsPool::init ( const LocalNetworkDescription localNetworkDescription)

initializes connections from network description passed as argument, and callback object

Note
this method is asynchronous (returns immediately, without waiting for the connections to be established)
Exceptions
ipsdk::core::IPSDKCoreExceptionif remote processing license feature is not available

◆ getSocketsPoolCB() [1/2]

const SocketsPoolCB& ipsdk::core::SocketsPool::getSocketsPoolCB ( ) const

retrieve socket pool callback

Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false

◆ getSocketsPoolCB() [2/2]

SocketsPoolCB& ipsdk::core::SocketsPool::getSocketsPoolCB ( )

retrieve socket pool callback

Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false

◆ asyncConnect()

void ipsdk::core::SocketsPool::asyncConnect ( const tcpip::Address remoteAddress)

method allowing to connect to a given remote computer

Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false

◆ asyncClose()

void ipsdk::core::SocketsPool::asyncClose ( const Guid socketGuid)

closes connection identified by 'socketGuid'

Parameters
socketGuididentifier of the connection
Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false
Note
this method is asynchronous (returns immediately, without waiting for the connection to be closed)

◆ asyncDeliver() [1/2]

ipUInt64 ipsdk::core::SocketsPool::asyncDeliver ( const SerializationObjectPtr pObj)

delivers the object 'pObj' through all the established connections

Parameters
pObjobject to send
Returns
identifier of the delivery
Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false
Note
this method is asynchronous (returns immediately, without waiting for the object to be sent)

◆ asyncDeliver() [2/2]

ipUInt64 ipsdk::core::SocketsPool::asyncDeliver ( const Guid socketGuid,
const SerializationObjectPtr pObj,
const ipsdk::tcpip::DlvCbFun f = 0 
)

delivers the object 'pObj' through the connection identified by 'socketGuid'

Parameters
socketGuididentifier of the connection
pObjobject to send
fcallback function to call once the delivery operation is complete (optional)
Returns
identifier of the delivery
Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false
Note
this method is asynchronous (returns immediately, without waiting for the object to be sent)

◆ addCnxLossCB()

Guid ipsdk::core::SocketsPool::addCnxLossCB ( const Guid socketGuid,
const tcpip::CnxLossCbFun f 
)

adds callback function'f' to collection of functions that will automatically be called when the socket 'socketGuid' will be disconnected

Parameters
socketGuidsocket unique id
fcallback function
Returns
identifier of the callback function
Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false
Note
this method is asynchronous (returns immediately, without waiting for the object to be sent)

◆ clearCnxLossCB()

void ipsdk::core::SocketsPool::clearCnxLossCB ( const Guid socketGuid)

clear callback functions for event "socket 'socketGuid' disconnected"

Parameters
socketGuidsocket unique id
Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false
Note
this method is asynchronous (returns immediately, without waiting for the object to be sent)

◆ removeCnxLossCB()

void ipsdk::core::SocketsPool::removeCnxLossCB ( const Guid socketGuid,
const Guid cbId 
)

remove callback functions from collection of functions that will automatically called when the socket 'socketGuid' will be disconnected

Parameters
socketGuidsocket unique id
cbIdcallback function id, returned by addCnxLossCB method
Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false
Note
this method is asynchronous (returns immediately, without waiting for the object to be sent)

◆ clear()

void ipsdk::core::SocketsPool::clear ( )

if isInit()==true, close all opened connections and wait for all the threads to terminate

◆ getSocketDesc()

boost::optional<tcpip::SocketDesc> ipsdk::core::SocketsPool::getSocketDesc ( const Guid socketGuid) const

returns SocketDesc object associated to identifier 'socketGuid' if 'socketGuid' identifies an existing active connection

Parameters
socketGuidunique identifier of the connection
Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false

◆ getGuid()

boost::optional<Guid> ipsdk::core::SocketsPool::getGuid ( const tcpip::Address remoteAddress) const
Returns
the 'socketGuid' associated to a remote address
Note
returned 'socketGuid' is not initialized if remote address is not found in the collection of active connections
Parameters
remoteAddressremote address informations
Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false

◆ getLocalAddress()

const tcpip::Address& ipsdk::core::SocketsPool::getLocalAddress ( ) const

retrieve tcpip address informations associated to local computer

Exceptions
ipsdk::core::IPSDKCoreExceptionif isInit() == false

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