Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

DataClient Class Reference

#include <dataclient.h>

Inheritance diagram for DataClient::

RemoteSocket List of all members.

Public Methods

 DataClient ()
 Default constructor recommended to be used with Connect(host, port) for correct error handling. More...

 DataClient (char *host, int port=4096)
 Constructor to connect to server "host" at port "port". More...

 ~DataClient ()
 Destructor (calls Disconnect()). More...

int Connect (char *host, int port=4096)
 Connect to server "host" at port "port" Returns POSSE_SUCCESS on success. More...

int Disconnect ()
 Disconect from server. More...

char * ServerName ()
 Returns the name cf the server connected to. More...

int Port ()
 Returns the port number cf the server connected to. More...

bool isBigEndian ()
 Returns whether DataServer is running on Big Endian architecture. More...

bool isValidKeyword (char *keyword, int *handle=NULL)
 Returns whether "keyword" is registered by DataServer. Returns the integer "handle" corresponding to the keyword. More...

int SetPrintFlag (int flag)
 Set Print Flag for miscellaneous output. More...

KeyTableGetTable ()
 Get the keytable. More...

bool isWritable (char *keyword)
 Returns whether the data pointed by "keyword" is READ-WRITE. More...

int RecvKeyTable (KeyTable *K=NULL)
 Receives keytable from DataServer into "K", else updates the copy within the class. More...

VariableType VarType (char *keyword)
 Returns type of variable "keyword". Possible types: UNKNOWN, CHAR, SHORT, INT, LONG, FLOAT, DOUBLE. More...

char * RecvValue (char *keyword)
 Retuns value (as a string) for "keyword" if it is a valid variable. More...

int SendValue (char *keyword, char *value)
 Send string "value" for "keyword" if it is a valid variable. More...

void ListKeywords ()
 List the keywords registered by DataServer on standard output. More...

void ListValues ()
 List variable and their values registered by DataServer. More...

template<class Etype> int SendVariable (char *keyword, Etype a)
 Send variable value for "keyword". More...

template<class Etype> int RecvVariable (char *keyword, Etype *a)
 Receive variable value registered by "keyword". More...

template<class Etype> Etype RecvVariable (char *keyword)
 Receive variable value registered by "keyword". More...

int SendArray (char *keyword, void *a)
 Send 1D/2D/3D/4D static array registered by "keyword". More...

int RecvArray (char *keyword, void *a)
 Receive 1D/2D/3D/4D static array registered by "keyword". More...

int getArrayDim (char *keyword, int dim)
 Get the "dim"th dimension for the dynamic array registered by "keyword". More...

template<class Etype> int SendArray1D (char *keyword, Etype *a)
 Send 1D dynamic array registered by "keyword". More...

template<class Etype> int RecvArray1D (char *keyword, Etype *a)
 Receive 1D dynamic array registered by "keyword". More...

template<class Etype> int RecvArray1D (char *keyword, Etype **ptr)
 Receive 1D dynamic array registered by "keyword" after allocating the correct dimensions (memory) to "ptr". It assumes that "ptr" has not been allocated any memory prior to this call. More...

template<class Etype> int SendArray2D (char *keyword, Etype **a)
 Send 2D dynamic array registered by "keyword". More...

template<class Etype> int RecvArray2D (char *keyword, Etype **a)
 Receive 2D dynamic array registered by "keyword". More...

template<class Etype> int RecvArray2D (char *keyword, Etype ***ptr)
 Receive 2D dynamic array registered by "keyword" after allocating the correct dimensions (memory) to "ptr". It assumes that "ptr" has not been allocated any memory prior to this call. More...

template<class Etype> int SendArray3D (char *keyword, Etype ***a)
 Send 3D dynamic array registered by "keyword". More...

template<class Etype> int RecvArray3D (char *keyword, Etype ***a)
 Receive 3D dynamic array registered by "keyword". More...

template<class Etype> int RecvArray3D (char *keyword, Etype ****ptr)
 Receive 3D dynamic array registered by "keyword" after allocating the correct dimensions (memory) to "ptr". It assumes that "ptr" has not been allocated any memory prior to this call. More...

template<class Etype> int SendArray4D (char *keyword, Etype ****a)
 Send 4D dynamic array registered by "keyword". More...

template<class Etype> int RecvArray4D (char *keyword, Etype ****a)
 Receive 4D dynamic array registered by "keyword". More...

template<class Etype> int RecvArray4D (char *keyword, Etype *****ptr)
 Receive 4D dynamic array registered by "keyword" after allocating the correct dimensions (memory) to "ptr". It assumes that "ptr" has not been allocated any memory prior to this call. More...

template<class myStruct> int SendStruct (char *keyword, myStruct *S, Semaphore *sem=NULL)
 Send User-Defined Structure registered by "keyword". Assumes that fuction packStruct(myStruct *S, unsigned char **dataptr, int &totsize) is defined. More...

template<class myStruct> double RecvStruct (char *keyword, myStruct *S, Semaphore *sem=NULL)
 Receive User-Defined Structure registered by "keyword". Assumes that fuction unpackStruct(myStruct *S, unsigned char *dataptr, int size) is defined. More...

int SendFile (char *filename, char *destfile=NULL)
 Send local file "filename" to DataServer as "destfile". If "destfile" is not specifed, destination file name is same as "filename". More...

int RecvFile (char *filename, char *destfile=NULL)
 Receive remote file "filename" from DataServer as "destfile". If "destfile" is not specifed, the received file is same as "filename". More...

double BytesSent ()
 Total number of bytes sent through the DataClient class. More...

double BytesRecd ()
 Total number of bytes received through the DataClient class. More...

int SendTime ()
 Time to send BytesSent() bytes of data (in ms). More...

int RecvTime ()
 Time to receive BytesRecd() bytes of data (in ms). More...

double SendRate ()
 Network bandwidth (in Mbps) for data sent. More...

double RecvRate ()
 Network bandwidth (in Mbps) for data received. More...


Constructor & Destructor Documentation

DataClient::DataClient  
 

Default constructor recommended to be used with Connect(host, port) for correct error handling.

Definition at line 8 of file dataclient.cc.

DataClient::DataClient char *    host,
int    port = 4096
 

Constructor to connect to server "host" at port "port".

Definition at line 16 of file dataclient.cc.

References Connect().

DataClient::~DataClient  
 

Destructor (calls Disconnect()).

Definition at line 25 of file dataclient.cc.

References Disconnect().


Member Function Documentation

double DataClient::BytesRecd   [inline]
 

Total number of bytes received through the DataClient class.

Reimplemented from TCPSocket.

Definition at line 200 of file dataclient.h.

References TCPSocket::BytesRecd().

Referenced by RecvRate().

double DataClient::BytesSent   [inline]
 

Total number of bytes sent through the DataClient class.

Reimplemented from TCPSocket.

Definition at line 197 of file dataclient.h.

References TCPSocket::BytesSent().

Referenced by SendRate().

int DataClient::Connect char *    host,
int    port = 4096
 

Connect to server "host" at port "port" Returns POSSE_SUCCESS on success.

Reimplemented from TCPSocket.

Definition at line 31 of file dataclient.cc.

References TCPSocket::Connect(), ERR_RECV_MESG, POSSE_FAILURE, POSSE_RETRY, POSSE_SUCCESS, RecvKeyTable(), and VERIFICATION_NUMBER.

Referenced by DataClient().

int DataClient::Disconnect  
 

Disconect from server.

Definition at line 81 of file dataclient.cc.

References TCPSocket::Close().

Referenced by ~DataClient().

int DataClient::getArrayDim char *    keyword,
int    dim
 

Get the "dim"th dimension for the dynamic array registered by "keyword".

Definition at line 418 of file dataclient.cc.

References KeyTable::Description(), DYNAMIC_1D_ARRAY, ERR_BAD_DATA, isValidKeyword(), and KeyTable::key.

KeyTable * DataClient::GetTable  
 

Get the keytable.

Definition at line 273 of file dataclient.cc.

bool DataClient::isBigEndian  
 

Returns whether DataServer is running on Big Endian architecture.

Definition at line 389 of file dataclient.cc.

References DYNAMIC_1D_ARRAY.

bool DataClient::isValidKeyword char *    keyword,
int *    handle = NULL
 

Returns whether "keyword" is registered by DataServer. Returns the integer "handle" corresponding to the keyword.

Definition at line 278 of file dataclient.cc.

References KeyTable::getKeyHandle(), and KeyTable::n.

Referenced by getArrayDim().

bool DataClient::isWritable char *    keyword
 

Returns whether the data pointed by "keyword" is READ-WRITE.

Definition at line 305 of file dataclient.cc.

References KeyTable::getKeyHandle(), and KeyTable::n.

Referenced by SendValue().

void DataClient::ListKeywords  
 

List the keywords registered by DataServer on standard output.

Definition at line 262 of file dataclient.cc.

References KeyTable::List().

void DataClient::ListValues  
 

List variable and their values registered by DataServer.

Definition at line 267 of file dataclient.cc.

References KeyTable::ListValues(), and RecvKeyTable().

int DataClient::Port   [inline]
 

Returns the port number cf the server connected to.

Definition at line 56 of file dataclient.h.

int DataClient::RecvArray char *    keyword,
void *    a
 

Receive 1D/2D/3D/4D static array registered by "keyword".

Referenced by RecvValue().

template<class Etype>
int DataClient::RecvArray1D char *    keyword,
Etype **    ptr
 

Receive 1D dynamic array registered by "keyword" after allocating the correct dimensions (memory) to "ptr". It assumes that "ptr" has not been allocated any memory prior to this call.

template<class Etype>
int DataClient::RecvArray1D char *    keyword,
Etype *    a
 

Receive 1D dynamic array registered by "keyword".

template<class Etype>
int DataClient::RecvArray2D char *    keyword,
Etype ***    ptr
 

Receive 2D dynamic array registered by "keyword" after allocating the correct dimensions (memory) to "ptr". It assumes that "ptr" has not been allocated any memory prior to this call.

template<class Etype>
int DataClient::RecvArray2D char *    keyword,
Etype **    a
 

Receive 2D dynamic array registered by "keyword".

template<class Etype>
int DataClient::RecvArray3D char *    keyword,
Etype ****    ptr
 

Receive 3D dynamic array registered by "keyword" after allocating the correct dimensions (memory) to "ptr". It assumes that "ptr" has not been allocated any memory prior to this call.

template<class Etype>
int DataClient::RecvArray3D char *    keyword,
Etype ***    a
 

Receive 3D dynamic array registered by "keyword".

template<class Etype>
int DataClient::RecvArray4D char *    keyword,
Etype *****    ptr
 

Receive 4D dynamic array registered by "keyword" after allocating the correct dimensions (memory) to "ptr". It assumes that "ptr" has not been allocated any memory prior to this call.

template<class Etype>
int DataClient::RecvArray4D char *    keyword,
Etype ****    a
 

Receive 4D dynamic array registered by "keyword".

int DataClient::RecvFile char *    filename,
char *    destfile = NULL
 

Receive remote file "filename" from DataServer as "destfile". If "destfile" is not specifed, the received file is same as "filename".

int DataClient::RecvKeyTable KeyTable   K = NULL
 

Receives keytable from DataServer into "K", else updates the copy within the class.

Definition at line 100 of file dataclient.cc.

References RemoteSocket::RecvStruct().

Referenced by Connect(), and ListValues().

double DataClient::RecvRate   [inline]
 

Network bandwidth (in Mbps) for data received.

Reimplemented from TCPSocket.

Definition at line 212 of file dataclient.h.

References BytesRecd(), and RecvTime().

template<class myStruct>
double DataClient::RecvStruct char *    keyword,
myStruct *    S,
Semaphore   sem = NULL
 

Receive User-Defined Structure registered by "keyword". Assumes that fuction unpackStruct(myStruct *S, unsigned char *dataptr, int size) is defined.

int DataClient::RecvTime   [inline]
 

Time to receive BytesRecd() bytes of data (in ms).

Reimplemented from TCPSocket.

Definition at line 206 of file dataclient.h.

References TCPSocket::RecvTime().

Referenced by RecvRate().

char * DataClient::RecvValue char *    keyword
 

Retuns value (as a string) for "keyword" if it is a valid variable.

Definition at line 121 of file dataclient.cc.

References CHAR, DOUBLE, FLOAT, KeyTable::getKeyHandle(), INT, KeyTable::isCharArray(), KeyTable::isViewableVar(), KeyTable::key, LONG, KeyTable::n, RecvArray(), RecvVariable(), SHORT, UNKNOWN, and VariableType.

template<class Etype>
Etype DataClient::RecvVariable char *    keyword
 

Receive variable value registered by "keyword".

template<class Etype>
int DataClient::RecvVariable char *    keyword,
Etype *    a
 

Receive variable value registered by "keyword".

Referenced by RecvValue().

int DataClient::SendArray char *    keyword,
void *    a
 

Send 1D/2D/3D/4D static array registered by "keyword".

Referenced by SendValue().

template<class Etype>
int DataClient::SendArray1D char *    keyword,
Etype *    a
 

Send 1D dynamic array registered by "keyword".

template<class Etype>
int DataClient::SendArray2D char *    keyword,
Etype **    a
 

Send 2D dynamic array registered by "keyword".

template<class Etype>
int DataClient::SendArray3D char *    keyword,
Etype ***    a
 

Send 3D dynamic array registered by "keyword".

template<class Etype>
int DataClient::SendArray4D char *    keyword,
Etype ****    a
 

Send 4D dynamic array registered by "keyword".

int DataClient::SendFile char *    filename,
char *    destfile = NULL
 

Send local file "filename" to DataServer as "destfile". If "destfile" is not specifed, destination file name is same as "filename".

double DataClient::SendRate   [inline]
 

Network bandwidth (in Mbps) for data sent.

Reimplemented from TCPSocket.

Definition at line 209 of file dataclient.h.

References BytesSent(), and SendTime().

template<class myStruct>
int DataClient::SendStruct char *    keyword,
myStruct *    S,
Semaphore   sem = NULL
 

Send User-Defined Structure registered by "keyword". Assumes that fuction packStruct(myStruct *S, unsigned char **dataptr, int &totsize) is defined.

int DataClient::SendTime   [inline]
 

Time to send BytesSent() bytes of data (in ms).

Reimplemented from TCPSocket.

Definition at line 203 of file dataclient.h.

References TCPSocket::SendTime().

Referenced by SendRate().

int DataClient::SendValue char *    keyword,
char *    value
 

Send string "value" for "keyword" if it is a valid variable.

Definition at line 186 of file dataclient.cc.

References CHAR, DOUBLE, FLOAT, KeyTable::getKeyHandle(), INT, KeyTable::isCharArray(), KeyTable::isViewableVar(), isWritable(), KeyTable::key, LONG, KeyTable::n, POSSE_INVALID_KEY, POSSE_INVALID_VARIABLE, POSSE_READONLY_KEY, POSSE_SUCCESS, SendArray(), SendVariable(), and SHORT.

template<class Etype>
int DataClient::SendVariable char *    keyword,
Etype    a
 

Send variable value for "keyword".

Referenced by SendValue().

char* DataClient::ServerName   [inline]
 

Returns the name cf the server connected to.

Definition at line 53 of file dataclient.h.

int DataClient::SetPrintFlag int    flag [inline]
 

Set Print Flag for miscellaneous output.

Reimplemented from RemoteSocket.

Definition at line 66 of file dataclient.h.

References RemoteSocket::SetPrintFlag(), and VariableType.

VariableType DataClient::VarType char *    keyword
 

Returns type of variable "keyword". Possible types: UNKNOWN, CHAR, SHORT, INT, LONG, FLOAT, DOUBLE.

Definition at line 109 of file dataclient.cc.

References KeyTable::getKeyHandle(), KeyTable::key, KeyTable::n, UNKNOWN, and VariableType.


The documentation for this class was generated from the following files:
Generated on Sun Jun 16 17:36:51 2002 for POSSE: Portable Object-oriented Scientific Steering Environment by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001