KrisLibrary  1.0.0
Public Member Functions | List of all members
SocketReadWorker Class Reference

Launches a thread for asynchronous reading from a socket. More...

#include <AsyncIO.h>

Inheritance diagram for SocketReadWorker:
AsyncReaderThread AsyncReaderQueue

Public Member Functions

 SocketReadWorker (const char *addr, bool asServer=false, double timeout=Math::Inf)
 
- Public Member Functions inherited from AsyncReaderThread
 AsyncReaderThread (double timeout=Math::Inf)
 
virtual void Reset ()
 Resets the queue and history.
 
virtual void Work ()
 Do some work to read messages from sender – must be done by subclass.
 
virtual bool Start ()
 Subclasses: override these to implement custom starting and stopping routines.
 
virtual void Stop ()
 
- Public Member Functions inherited from AsyncReaderQueue
 AsyncReaderQueue (size_t queueMax=1000)
 This will keep only the newest queueMax messages.
 
void OnRead (const std::string &msg)
 Called by subclass to add a message onto the queue.
 
void OnRead_NoLock (const std::string &msg)
 
int MessageCount ()
 
int UnreadCount ()
 
std::string PeekNewest ()
 
std::string Newest ()
 
std::vector< std::string > New ()
 

Additional Inherited Members

- Public Attributes inherited from AsyncReaderThread
std::unique_ptr< TransportBasetransport
 
bool initialized
 
Thread thread
 
double timeout
 
Timer timer
 
double lastReadTime
 
- Public Attributes inherited from AsyncReaderQueue
Mutex mutex
 
size_t queueMax
 
size_t msgCount
 
std::string msgLast
 
std::list< std::string > msgQueue
 
size_t numDroppedMsgs
 

Detailed Description

Launches a thread for asynchronous reading from a socket.

Calling thread can safely use the AsyncReaderQueue methods e.g., NewMessageCount, NewMessage, NewestMessage while the thread is running.


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