GlobalObjects
Loading...
Searching...
No Matches
glo::ClientThread Class Reference

Objects of this class serve as interface between Base or PrivateBase and Manager. In the documentation the LocalThread is also called client communicator, if NOT the server communicator (ServerThread) is meant. More...

#include <GloClientThread.h>

Inheritance diagram for glo::ClientThread:

Public Member Functions

 ClientThread (const std::string &rstrHostname, unsigned int uiPort, int iSecTimeOut)
 
 ~ClientThread ()
 
virtual int assignDBManager (OrderMsg *pOrderMsg) override
 
virtual void cancel () override
 
const std::map< unsigned long, ClassInfo * > * getSchemaMap ()
 
bool Orderstop () const
 
void setOrderstop (bool bOrderstop=true)
 
void setSchemaMap (std::map< unsigned long, ClassInfo * > *pSchemaMap)
 
ClienttcpClient ()
 
bool operator== (const ClientThread &rT) const
 
bool operator!= (const ClientThread &rT) const
 
- Public Member Functions inherited from glo::Communicator
 Communicator ()
 
virtual ~Communicator ()
 
std::string getClientName () const
 
const std::string & getClientNameAsRef ()
 
unsigned int getCommunicatorID () const
 
virtual void setClientName (const std::string &rstrClientName)
 
virtual void setCommunicatorID (unsigned int uiID)
 
virtual int takeOverResult (OrderMsg *pOrderMsg)
 
bool operator== (const Communicator &rT) const
 
bool operator!= (const Communicator &rT) const
 
- Public Member Functions inherited from eut::RepeatingThread
 RepeatingThread ()
 
virtual ~RepeatingThread ()
 
virtual void finishBreak ()
 
int getBreakCounter ()
 
bool isInExclusiveAccess () const
 
void setExclusiveAccess ()
 
void signalInput ()
 
virtual int start ()
 
RepeatingThread::STATUS status () const
 
virtual void takeABreak ()
 
bool testCancel ()
 
void unsetExclusiveAccess ()
 
void waitForInput ()
 

Protected Member Functions

void deleteSchemaMap ()
 
virtual int sendToDBManager (OrderMsg *pOrderMsg) const override
 
- Protected Member Functions inherited from glo::Communicator
virtual void processServerMsg (OrderMsg *pOrderMsg) const
 
virtual void work () override
 
- Protected Member Functions inherited from eut::RepeatingThread
ORDER getOrder ()
 
STATUS getStatus ()
 
void setStatus (STATUS eStatus)
 
void threadWork ()
 
void toOrder (ORDER eOrder)
 

Private Member Functions

 ClientThread ()
 
 ClientThread (const ClientThread &)
 
int initTcpClient (const std::string &rstrHostname, unsigned int uiPort, int iSecTimeOut)
 
ClientThreadoperator= (const ClientThread &)
 

Private Attributes

bool m_bOrderstop
 
std::map< unsigned long, ClassInfo *, std::less< unsigned long > > * m_pSchemaMap
 
Clientm_pTcpClient
 

Additional Inherited Members

- Public Types inherited from eut::RepeatingThread
enum  EuTHREADERROR { EuTHREAD_ERR_NO_THREAD = -10301 , EuTHREAD_ERR_THREAD_ALREADY_WORKING = -10302 , EuTHREAD_ERR_THREAD_BREAK_COUNT_LESS_THAN_ZERO = -10303 , EuTHREAD_ERR_UNKNOWN = -10400 }
 Error range = -10301 to -10400 More...
 
enum  ORDER { eUNDEFINED , eDO_WORK , eEXIT }
 
enum  STATUS {
  eAT_THE_START , eWORKING , ePAUSING , eENDING ,
  eCOMPLETED
}
 
- Public Attributes inherited from eut::RepeatingThread
std::string m_strDebugInfo
 
- Protected Attributes inherited from glo::Communicator
unsigned int m_uiOrderCounter
 

Detailed Description

Objects of this class serve as interface between Base or PrivateBase and Manager. In the documentation the LocalThread is also called client communicator, if NOT the server communicator (ServerThread) is meant.

Remote station is the ServerThread via the TCP communicators.

The ClientThread sends requests via its Client to the Manager and wait s until the request is executed (or not).

The Manager (as server) passes the processed request via its corresponding ServerThread to the ClientThread, which puts the request into its request list.

Objects of this class are necessary if the Base is called with a server name or IP address and the Manager runs as server.

To allow parallel access to the database, this class is designed as a thread (derived via Communicator from EuEndlessPThread).

See also
ServerThread
Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ ClientThread() [1/3]

glo::ClientThread::ClientThread ( )
private

The standard constructor is not available.

◆ ClientThread() [2/3]

glo::ClientThread::ClientThread ( const std::string & rstrHostname,
unsigned int uiPort,
int iSecTimeOut )

Constructor with parameter passing.

Parameters
[in]rstrHostnameThe host or, server name or the IP address (e.g. "192.165.0.1").
[in]uiPortThe port on which the server can be addressed.
[in]iSecTimeOutThe max. waiting time of the server.
Exceptions
eut::ErrorNExceptionAn exception is thrown if an error occurs.

◆ ~ClientThread()

glo::ClientThread::~ClientThread ( )

Destructor.

◆ ClientThread() [3/3]

glo::ClientThread::ClientThread ( const ClientThread & )
private

The copy constructor is not available.

Member Function Documentation

◆ assignDBManager()

virtual int glo::ClientThread::assignDBManager ( OrderMsg * pOrderMsg)
overridevirtual

Sends an order to the Manager and waits for response.

Parameters
[in]pOrderMsgThe order for the Manager.
Returns
A return value < 0 indicates an error.

Reimplemented from glo::Communicator.

◆ cancel()

virtual void glo::ClientThread::cancel ( )
overridevirtual

Clears memory and terminates an existing connection to a server before the thread is terminated. Is called in the owning PrivateBase before the thread is terminated.

Since virtual, this method cannot be called in the destructor.

Note
This method only exists when not compiled with POSIX threads (defined (__PTHREADS)).

Reimplemented from eut::RepeatingThread.

◆ deleteSchemaMap()

void glo::ClientThread::deleteSchemaMap ( )
protected

Removes the list of class information objects from memory.

◆ getSchemaMap()

const std::map< unsigned long, ClassInfo * > * glo::ClientThread::getSchemaMap ( )

Returns a pointer to the own class information objects.

Returns
. The pointer to the list of the own class information objects.
Attention
The calling instance must not remove the returned container or the class information objects from memory.

◆ initTcpClient()

int glo::ClientThread::initTcpClient ( const std::string & rstrHostname,
unsigned int uiPort,
int iSecTimeOut )
private

Initializes the TCP client, which communicates with a TCP server.

Parameters
[in]rstrHostnameThe host or, server name or the IP address (e.g. "192.165.0.1").
[in]uiPortThe port on which the server can be addressed.
[in]iSecTimeOutThe max. waiting time of the server.
Returns
A return value < 0 indicates an error.

◆ operator!=()

bool glo::ClientThread::operator!= ( const ClientThread & rT) const

Comparison operator.

Parameters
[in]rTThe object to be compared with this one.

◆ operator=()

ClientThread & glo::ClientThread::operator= ( const ClientThread & )
private

The assignment operator is not available.

◆ operator==()

bool glo::ClientThread::operator== ( const ClientThread & rT) const

Comparison operator.

Parameters
[in]rTThe object to be compared with this one.

◆ Orderstop()

bool glo::ClientThread::Orderstop ( ) const

Returns whether there is an order acceptance stop.

Returns
If true, no more orders are accepted.

◆ sendToDBManager()

virtual int glo::ClientThread::sendToDBManager ( OrderMsg * pOrderMsg) const
overrideprotectedvirtual

Sends a job (received from the ClientThread::assignDBManager() ) via its TCP client to the Manager.

Parameters
[in]pOrderMsgThe order for the Manager.
Returns
A return value < 0 indicates an error.

Implements glo::Communicator.

◆ setOrderstop()

void glo::ClientThread::setOrderstop ( bool bOrderstop = true)

Sets the order acceptance stop.

Parameters
[in]bOrderstopIf true, no more orders are accepted.

◆ setSchemaMap()

void glo::ClientThread::setSchemaMap ( std::map< unsigned long, ClassInfo * > * pSchemaMap)

Accepts the class information objects after the current ones have been removed from memory.

Parameters
[in]pSchemaMapThe new class information objects.
Attention
The list of new class information objects becomes owned, meaning that the calling instance may not remove the supplied list or individual class information objects from memory.

◆ tcpClient()

Client * glo::ClientThread::tcpClient ( )

Return m_pTcpClient.

Returns
See above.
Attention
The calling instance must NOT modify or remove the returned object from memory. It only lives as long as this object respectively m_pTcpClient.

Member Data Documentation

◆ m_bOrderstop

bool glo::ClientThread::m_bOrderstop
private

If true, no more orders are accepted.

◆ m_pSchemaMap

std::map< unsigned long, ClassInfo *, std::less<unsigned long> >* glo::ClientThread::m_pSchemaMap
private

The class information of the underlying schema.

◆ m_pTcpClient

Client* glo::ClientThread::m_pTcpClient
private

The TCP client that communicates with a TCP server.


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