TcpLib
Loading...
Searching...
No Matches
tcp::Transmitter Class Reference

A class that communicates with a Client or Server via a SOCKET and expects send data of type Message. More...

#include <TcpTransmitter.h>

Inheritance diagram for tcp::Transmitter:
Collaboration diagram for tcp::Transmitter:

Public Member Functions

 Transmitter (SOCKET Socket)
 
virtual ~Transmitter ()
 
virtual void cancel () override
 
int acceptOrder (Message *pTcpMessage)
 
- Public Member Functions inherited from tcp::ReceiverTransmitter
 ReceiverTransmitter (SOCKET Socket)
 
virtual ~ReceiverTransmitter ()
 
virtual void takeABreak () override
 
virtual void finishBreak () override
 
int getPeerName (std::string &rstrIPAdress, unsigned int &ruiPort) const
 
SOCKET Socket () const
 
- Public Member Functions inherited from eut::RepeatingThread
 RepeatingThread ()
 
virtual ~RepeatingThread ()
 
virtual int start ()
 
bool testCancel ()
 
RepeatingThread::STATUS status () const
 
bool isInExclusiveAccess () const
 
void setExclusiveAccess ()
 
void unsetExclusiveAccess ()
 
int getBreakCounter ()
 
void waitForInput ()
 
void signalInput ()
 

Protected Member Functions

 Transmitter ()
 
virtual void work () override
 
- Protected Member Functions inherited from tcp::ReceiverTransmitter
 ReceiverTransmitter ()
 
- Protected Member Functions inherited from eut::RepeatingThread
void threadWork ()
 
void setStatus (STATUS eStatus)
 
STATUS getStatus ()
 
void toOrder (ORDER eOrder)
 
ORDER getOrder ()
 

Private Member Functions

 Transmitter (const Transmitter &)
 
Transmitteroperator= (const Transmitter &)
 

Private Attributes

std::queue< Message * > m_MsgQueue
 

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  STATUS {
  eAT_THE_START , eWORKING , ePAUSING , eENDING ,
  eCOMPLETED
}
 
enum  ORDER { eUNDEFINED , eDO_WORK , eEXIT }
 
- Protected Attributes inherited from tcp::ReceiverTransmitter
SOCKET m_Socket
 

Detailed Description

A class that communicates with a Client or Server via a SOCKET and expects send data of type Message.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ Transmitter() [1/3]

tcp::Transmitter::Transmitter ( )
protected

The standard constructor is not available.

◆ Transmitter() [2/3]

tcp::Transmitter::Transmitter ( SOCKET Socket)

Constructor with parameter passing.

Parameters
[in]SocketThe socket via which communication takes place.
Exceptions
eut::ErrorNExceptionAn exception is thrown if an error occurs.

◆ ~Transmitter()

virtual tcp::Transmitter::~Transmitter ( )
virtual

Destructor.

◆ Transmitter() [3/3]

tcp::Transmitter::Transmitter ( const Transmitter & )
private

The copy constructor is not available.

Member Function Documentation

◆ acceptOrder()

int tcp::Transmitter::acceptOrder ( Message * pTcpMessage)

Includes the message in the list of send messages.

Parameters
[in]pTcpMessageThe message to be sent.
Returns
A return < 0 indicates an error or information.
Attention
The passed object is taken over by this object and must not be changed or removed from memory by the calling instance.

◆ cancel()

virtual void tcp::Transmitter::cancel ( )
overridevirtual

When the thread ends, this virtual method is called. Here the list of send messages is cleaned up.

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

Reimplemented from eut::RepeatingThread.

◆ operator=()

Transmitter & tcp::Transmitter::operator= ( const Transmitter & )
private

The assignment operator is not available.

◆ work()

virtual void tcp::Transmitter::work ( )
overrideprotectedvirtual

Sends the data from the send message list to the socket passed in the constructor.

Implements eut::RepeatingThread.

Member Data Documentation

◆ m_MsgQueue

std::queue<Message *> tcp::Transmitter::m_MsgQueue
private

The queue with the messages to be sent.


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