xc
Public Member Functions | Friends | List of all members
XC::Message Class Reference

Message between processes. More...

#include <Message.h>

Public Member Functions

 Message (void)
 Construct an empty message.
 
 Message (double *, int)
 Construct a message for sending/receiving an array containing size doubles. More...
 
 Message (int *, int)
 Construct a message for sending/receiving an array containing size ints. More...
 
 Message (char *, int)
 To construct a message for sending/receiving a string of size characters or a struct. More...
 
virtual int putData (char *theData, int startLoc, int endLoc)
 Will put the data given by the character pointer theData of size endLoc -startLoc into the data array pointed to by the Message starting at location $startLoc$ in this array. More...
 
virtual const char * getData (void)
 Returns a const char * pointer to the messages data.
 
virtual int getSize (void)
 Get the size of the array. More...
 

Friends

class TCP_Socket
 
class TCP_SocketNoDelay
 
class UDP_Socket
 
class MPI_Channel
 

Detailed Description

Message between processes.

Messages are objects that can be sent between Channels. They are provided to allow data of arbitrary length and type, e.g. structs, to be sent between processes running on similar machine architectures. WARNING Sending Messages between machines with different architectures can result in erroneuos data being received. Each Message object keeps a pointer to the data it represents and an integer outlining the data size. There is no copy of the data kept by the Message.

Constructor & Destructor Documentation

◆ Message() [1/3]

XC::Message::Message ( double *  Ptr,
int  size 
)

Construct a message for sending/receiving an array containing size doubles.

◆ Message() [2/3]

XC::Message::Message ( int *  Ptr,
int  size 
)

Construct a message for sending/receiving an array containing size ints.

◆ Message() [3/3]

XC::Message::Message ( char *  Ptr,
int  size 
)

To construct a message for sending/receiving a string of size characters or a struct.

Member Function Documentation

◆ getSize()

int XC::Message::getSize ( void  )
virtual

Get the size of the array.

The unit of size is that of a character.

◆ putData()

int XC::Message::putData ( char *  theData,
int  startLoc,
int  endLoc 
)
virtual

Will put the data given by the character pointer theData of size endLoc -startLoc into the data array pointed to by the Message starting at location $startLoc$ in this array.

Returns 0 if successful; an error message is printed and a -1 is returned if not. The routine bcopy() is used to copy the data.


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