Superclass of LocalThread, ClientThread and ServerThread, because they can act as senders and receivers (communicators) of requests and inherit a send and receive method for this.
More...
#include <GloCommunicator.h>
Superclass of LocalThread, ClientThread and ServerThread, because they can act as senders and receivers (communicators) of requests and inherit a send and receive method for this.
To allow parallel access to the database, this class is designed as a thread (derived from EuEndlessPThread).
- Copyright
- © 2010 Helmut Jakoby
- Author
- Helmut Jakoby
◆ Communicator() [1/2]
glo::Communicator::Communicator |
( |
| ) |
|
◆ ~Communicator()
virtual glo::Communicator::~Communicator |
( |
| ) |
|
|
virtual |
◆ Communicator() [2/2]
The copy constructor is not available.
◆ assignDBManager()
virtual int glo::Communicator::assignDBManager |
( |
OrderMsg * | pOrderMsg | ) |
|
|
virtual |
◆ getClientName()
std::string glo::Communicator::getClientName |
( |
| ) |
const |
Returns the name of the communicator.
- Returns
- The name of the communicator.
◆ getClientNameAsRef()
const std::string & glo::Communicator::getClientNameAsRef |
( |
| ) |
|
Returns the name of the communicator as reference.
- Returns
- The name of the communicator.
◆ getCommunicatorID()
unsigned int glo::Communicator::getCommunicatorID |
( |
| ) |
const |
Returns the unique ID of the communicator.
- Returns
- The unique ID of the communicator.
◆ operator!=()
bool glo::Communicator::operator!= |
( |
const Communicator & | rT | ) |
const |
Comparison operator.
- Parameters
-
[in] | rT | The object to be compared with this one. |
◆ operator=()
The assignment operator is not available.
◆ operator==()
bool glo::Communicator::operator== |
( |
const Communicator & | rT | ) |
const |
Comparison operator.
- Parameters
-
[in] | rT | The object to be compared with this one. |
◆ processServerMsg()
virtual void glo::Communicator::processServerMsg |
( |
OrderMsg * | pOrderMsg | ) |
const |
|
protectedvirtual |
Processes only one notification order here (Orderstayp == OrderMsg::eNOTIFY_CLIENT).
Each order is removed from memory here, so it must be called by the overwritten methods in the subclasses.
- Parameters
-
Reimplemented in glo::ServerThread.
◆ sendToDBManager()
virtual int glo::Communicator::sendToDBManager |
( |
OrderMsg * | pOrderMsg | ) |
const |
|
protectedpure virtual |
◆ setClientName()
virtual void glo::Communicator::setClientName |
( |
const std::string & | rstrClientName | ) |
|
|
virtual |
Sets the name of the communicator.
- Parameters
-
[in] | rstrClientName | The name of the communicator. |
◆ setCommunicatorID()
virtual void glo::Communicator::setCommunicatorID |
( |
unsigned int | uiID | ) |
|
|
virtual |
- Parameters
-
[in] | uiID | The unique ID of the communicator. |
- Attention
- The calling instance must ensure that the ID is unique.
◆ takeOverResult()
virtual int glo::Communicator::takeOverResult |
( |
OrderMsg * | pOrderMsg | ) |
|
|
virtual |
Adopts a message into its message queue for processing.
- Parameters
-
[in] | pOrderMsg | The message to be processed. |
- Returns
- A return value < 0 indicates an error.
- See also
- signalInput()
Reimplemented in glo::ServerThread.
◆ work()
virtual void glo::Communicator::work |
( |
| ) |
|
|
overrideprotectedvirtual |
This method is executed as a thread. The message queue is queried for requests and replies to its own requests (the system 'sleeps' until a message is placed in the queue).
- See also
- waitForInput()
Implements eut::RepeatingThread.
◆ m_MsgQueue
std::queue<OrderMsg *> glo::Communicator::m_MsgQueue |
|
private |
The notification queue; notifications such as information from monitored objects are set.
◆ m_sClientName
std::string glo::Communicator::m_sClientName |
|
private |
Every communicator can have a name.
◆ m_uiID
unsigned int glo::Communicator::m_uiID |
|
private |
A unique ID of the (derived) communicator.
◆ m_uiOrderCounter
unsigned int glo::Communicator::m_uiOrderCounter |
|
protected |
Orders to the Manager get a unique order number. The answers from the Manager are referenced by this order number, so they can be assigned to an order.
The documentation for this class was generated from the following file: