AGXDynamics  2.31.1.0
agxNet::CoSimulationBase Class Referenceabstract

Base class for multi threaded transferring simulation between a server and a client using sockets. More...

#include <CoSimulationBase.h>

+ Inheritance diagram for agxNet::CoSimulationBase:

Classes

struct  Header
 Header used for sending data over sockets. More...
 

Public Member Functions

 CoSimulationBase ()
 Default constructor. More...
 
virtual void dropConnection ()
 Drop the connection to the remote host and wait for a new one. More...
 
virtual bool isConnected ()
 
virtual bool waitForConnection ()=0
 

Protected Member Functions

virtual ~CoSimulationBase ()
 
virtual void handleConnectionDrop ()
 
size_t receiveData (uint8_t *data, size_t numBytes)
 Receive data from remote party. More...
 
void receivePacket (Header &header)
 
size_t sendData (const uint8_t *data, size_t numBytes)
 Transmit data to remote party. More...
 
void sendPacket (Header &header)
 

Protected Attributes

agx::Vector< char > m_buffer
 
agx::Mutex m_connectionMutex
 
bool m_isShutdown
 
TCPSocketRef m_socket
 

Detailed Description

Base class for multi threaded transferring simulation between a server and a client using sockets.

Definition at line 38 of file CoSimulationBase.h.

Constructor & Destructor Documentation

◆ CoSimulationBase()

agxNet::CoSimulationBase::CoSimulationBase ( )

Default constructor.

◆ ~CoSimulationBase()

virtual agxNet::CoSimulationBase::~CoSimulationBase ( )
protectedvirtual

Member Function Documentation

◆ dropConnection()

virtual void agxNet::CoSimulationBase::dropConnection ( )
virtual

Drop the connection to the remote host and wait for a new one.

Reimplemented in agxNet::CoSimulationServer.

◆ handleConnectionDrop()

virtual void agxNet::CoSimulationBase::handleConnectionDrop ( )
protectedvirtual

Reimplemented in agxNet::CoSimulationClient.

◆ isConnected()

virtual bool agxNet::CoSimulationBase::isConnected ( )
virtual
Returns
true if we are connected to a remote party

◆ receiveData()

size_t agxNet::CoSimulationBase::receiveData ( uint8_t *  data,
size_t  numBytes 
)
protected

Receive data from remote party.

Parameters
data- pointer to address where data will be written
numBytes- size of memory storage.
Returns
number of bytes read.

◆ receivePacket()

void agxNet::CoSimulationBase::receivePacket ( Header &  header)
protected

◆ sendData()

size_t agxNet::CoSimulationBase::sendData ( const uint8_t *  data,
size_t  numBytes 
)
protected

Transmit data to remote party.

Data block can be chopped up into smaller chunks.

Parameters
data- bit stream that should be transmitted to remote client
numBytes- number of bytes to be transmitted.
Returns
number of bytes sent

◆ sendPacket()

void agxNet::CoSimulationBase::sendPacket ( Header &  header)
protected

◆ waitForConnection()

virtual bool agxNet::CoSimulationBase::waitForConnection ( )
pure virtual

Member Data Documentation

◆ m_buffer

agx::Vector<char> agxNet::CoSimulationBase::m_buffer
protected

Definition at line 112 of file CoSimulationBase.h.

◆ m_connectionMutex

agx::Mutex agxNet::CoSimulationBase::m_connectionMutex
protected

Definition at line 114 of file CoSimulationBase.h.

◆ m_isShutdown

bool agxNet::CoSimulationBase::m_isShutdown
protected

Definition at line 116 of file CoSimulationBase.h.

◆ m_socket

TCPSocketRef agxNet::CoSimulationBase::m_socket
protected

Definition at line 115 of file CoSimulationBase.h.


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