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

DataServer Class Reference

#include <dataserver.h>

Inheritance diagram for DataServer::

RemoteSocket TCPSocket DataServerMPI List of all members.

Public Methods

 DataServer ()
 Default constructor recommended to be used with Start(port) for correct error handling. More...

 DataServer (int port)
 Constructor to spawn a DataServer thread at port "port". More...

int Start (int port=4096)
 Spawn a DataServer thread at port "port". More...

 ~DataServer ()
 Destructor for cleanup. More...

void RegisterCallback (void(*cb)(char *))
 Register callback function of the form "void callback(char *keyword)" which is executed when any READ-WRITE data is modified by a DataClient. "keyword" contains the handle of the variable/data which has been modified. More...

void RegisterCallback (char *key, void(*cb)(void *), void *data)
 Register callback function of the form "void callback(void *data)" which is executed when READ-WRITE data registered by "keyword" is modified by a DataClient. More...

int isRunning ()
 Returns whether the DataServer is running (or is Dead!). More...

int Stop ()
 Stop the DataServer. It waits for existing DataClient connections to end. More...

int Wait ()
 Get global lock. Wait if any other DataClient is accessing the critical section. More...

int Post ()
 Release/Post global lock. More...

int Wait (char *keyword)
 Get lock on data registered by "keyword". Wait if any other DataClient is accessing the critical section. More...

int Post (char *keyword)
 Release/Post the lock on data registered by "keyword". More...

int SetDirty (char *keyword)
 Mark the data registered by "keyword" as dirty (modified). More...

int IsDirty (int change=1)
 Check whether any READ-WRITE data registered by DataServer has been modified by a DataClient. If "change" is omitted, the lock table is reset after returning the status. Else if "change" is specified as "zero", the lock table is unaltered. More...

int IsDirty (char *keyword, int change=1)
 Check whether the READ-WRITE data registered by "keyword" has been modified by a DataClient. If "change" is omitted, the lock table is reset after returning the status. Else if "change" is specified as "zero", the lock table is unaltered. More...

int IsDirtyID (int id, int change=1)
 Same as above, except that the internal KeyTable handle "id" is specified instead of the keyword. More...

void PrintDirty (ostream &out=cout, int change=0)
 Print modified READ-WRITE variables to the stream "out". If "change" is omitted, the lock table is reset after r eturning the status. Else if "change" is specified as "zero", the lock table is unaltered. More...

int NumKeys ()
 Returns the number of keywords registered by DataServer. More...

char * Key (int i)
 Returns the key pointed to by KeyTable handle "i". More...

char * GetValue (char *keyword)
 Get the value (as a string) of the variable registered by "keyword". More...

char * GetValue (int i)
 Get the value (as a string) of the variable registered by the "keyword" whose internal KeyTable handle is "i". More...

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

double BytesRecd ()
 Total number of bytes received through the DataServer 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...


Protected Methods

virtual bool isMaster ()
virtual void BroadcastData (void *var, int size)
template<class Etype> void BroadcastVariable (Etype *var, int n=1)
virtual void GetKeyword (RemoteSocket *C, char *key)
virtual int AcceptClient ()
virtual bool isRunningMPI ()
int Synchronize (char *filename=NULL)
int RegisterKey (char *key, DataType desc, char *type, int elem_size, int num_elems, char *perm, void *ptr=NULL)
template<class Etype> int Register_Variable (RemoteSocket *C, int &flag, bool register_flag, char *inpkey, char *key, char *perm, Etype &data)
 Functions for data registration. More...

template<class Etype> int Register_Structure (RemoteSocket *C, int &flag, bool register_flag, char *inpkey, char *key, char *perm, Etype &data)
template<class Etype> int Register_Static_Array (RemoteSocket *C, int &flag, bool register_flag, char *inpkey, char *key, char *perm, void *data, Etype &element, int totsize, int dim)
template<class Etype> int Register_Dynamic_1D_Array (RemoteSocket *C, int &flag, bool register_flag, char *inpkey, char *key, char *perm, Etype *data, int &n1)
template<class Etype> int Register_Dynamic_2D_Array (RemoteSocket *C, int &flag, bool register_flag, char *inpkey, char *key, char *perm, Etype **data, int &n1, int &n2)
template<class Etype> int Register_Dynamic_3D_Array (RemoteSocket *C, int &flag, bool register_flag, char *inpkey, char *key, char *perm, Etype ***data, int &n1, int &n2, int &n3)
template<class Etype> int Register_Dynamic_4D_Array (RemoteSocket *C, int &flag, bool register_flag, char *inpkey, char *key, char *perm, Etype ****data, int &n1, int &n2, int &n3, int &n4)

Protected Attributes

KeyTablekeytable
void(* callback )(char *)

Friends

class DataServerMainThread
class DataServerChildThread

Constructor & Destructor Documentation

DataServer::DataServer  
 

Default constructor recommended to be used with Start(port) for correct error handling.

DataServer::DataServer int    port
 

Constructor to spawn a DataServer thread at port "port".

DataServer::~DataServer  
 

Destructor for cleanup.


Member Function Documentation

int DataServer::AcceptClient   [protected, virtual]
 

virtual void DataServer::BroadcastData void *    var,
int    size
[inline, protected, virtual]
 

template<class Etype>
void DataServer::BroadcastVariable Etype *    var,
int    n = 1
[inline, protected]
 

double DataServer::BytesRecd   [inline]
 

Total number of bytes received through the DataServer class.

Reimplemented from TCPSocket.

double DataServer::BytesSent   [inline]
 

Total number of bytes sent through the DataServer class.

Reimplemented from TCPSocket.

virtual void DataServer::GetKeyword RemoteSocket   C,
char *    key
[inline, protected, virtual]
 

char * DataServer::GetValue int    i
 

Get the value (as a string) of the variable registered by the "keyword" whose internal KeyTable handle is "i".

char * DataServer::GetValue char *    keyword
 

Get the value (as a string) of the variable registered by "keyword".

int DataServer::IsDirty char *    key,
int    change = 1
[inline]
 

Check whether the READ-WRITE data registered by "keyword" has been modified by a DataClient. If "change" is omitted, the lock table is reset after returning the status. Else if "change" is specified as "zero", the lock table is unaltered.

int DataServer::IsDirty int    change = 1 [inline]
 

Check whether any READ-WRITE data registered by DataServer has been modified by a DataClient. If "change" is omitted, the lock table is reset after returning the status. Else if "change" is specified as "zero", the lock table is unaltered.

int DataServer::IsDirtyID int    id,
int    change = 1
[inline]
 

Same as above, except that the internal KeyTable handle "id" is specified instead of the keyword.

virtual bool DataServer::isMaster   [inline, protected, virtual]
 

int DataServer::isRunning   [inline]
 

Returns whether the DataServer is running (or is Dead!).

virtual bool DataServer::isRunningMPI   [inline, protected, virtual]
 

char * DataServer::Key int    i [inline]
 

Returns the key pointed to by KeyTable handle "i".

int DataServer::NumKeys   [inline]
 

Returns the number of keywords registered by DataServer.

int DataServer::Post char *    key [inline]
 

Release/Post the lock on data registered by "keyword".

Reimplemented in DataServerMPI.

int DataServer::Post   [inline]
 

Release/Post global lock.

void DataServer::PrintDirty ostream &    out = cout,
int    change = 0
 

Print modified READ-WRITE variables to the stream "out". If "change" is omitted, the lock table is reset after r eturning the status. Else if "change" is specified as "zero", the lock table is unaltered.

double DataServer::RecvRate   [inline]
 

Network bandwidth (in Mbps) for data received.

Reimplemented from TCPSocket.

int DataServer::RecvTime   [inline]
 

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

Reimplemented from TCPSocket.

template<class Etype>
int DataServer::Register_Dynamic_1D_Array RemoteSocket   C,
int &    flag,
bool    reg_flag,
char *    inpkey,
char *    key,
char *    perm,
Etype *    data,
int &    n1
[inline, protected]
 

template<class Etype>
int DataServer::Register_Dynamic_2D_Array RemoteSocket   C,
int &    flag,
bool    reg_flag,
char *    inpkey,
char *    key,
char *    perm,
Etype **    data,
int &    n1,
int &    n2
[inline, protected]
 

template<class Etype>
int DataServer::Register_Dynamic_3D_Array RemoteSocket   C,
int &    flag,
bool    reg_flag,
char *    inpkey,
char *    key,
char *    perm,
Etype ***    data,
int &    n1,
int &    n2,
int &    n3
[inline, protected]
 

template<class Etype>
int DataServer::Register_Dynamic_4D_Array RemoteSocket   C,
int &    flag,
bool    reg_flag,
char *    inpkey,
char *    key,
char *    perm,
Etype ****    data,
int &    n1,
int &    n2,
int &    n3,
int &    n4
[inline, protected]
 

template<class Etype>
int DataServer::Register_Static_Array RemoteSocket   C,
int &    flag,
bool    reg_flag,
char *    inpkey,
char *    key,
char *    perm,
void *    data,
Etype &    element,
int    totsize,
int    dim
[inline, protected]
 

template<class Etype>
int DataServer::Register_Structure RemoteSocket   C,
int &    flag,
bool    reg_flag,
char *    inpkey,
char *    key,
char *    perm,
Etype &    data
[inline, protected]
 

template<class Etype>
int DataServer::Register_Variable RemoteSocket   C,
int &    flag,
bool    reg_flag,
char *    inpkey,
char *    key,
char *    perm,
Etype &    data
[inline, protected]
 

Functions for data registration.

void DataServer::RegisterCallback char *    key,
void(*    cb)(void *),
void *    data
[inline]
 

Register callback function of the form "void callback(void *data)" which is executed when READ-WRITE data registered by "keyword" is modified by a DataClient.

void DataServer::RegisterCallback void(*    cb)(char *)
 

Register callback function of the form "void callback(char *keyword)" which is executed when any READ-WRITE data is modified by a DataClient. "keyword" contains the handle of the variable/data which has been modified.

int DataServer::RegisterKey char *    key,
DataType    desc,
char *    vartype,
int    elem_size,
int    num_elems,
char *    perm,
void *    ptr = NULL
[protected]
 

double DataServer::SendRate   [inline]
 

Network bandwidth (in Mbps) for data sent.

Reimplemented from TCPSocket.

int DataServer::SendTime   [inline]
 

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

Reimplemented from TCPSocket.

int DataServer::SetDirty char *    key [inline]
 

Mark the data registered by "keyword" as dirty (modified).

int DataServer::Start int    port = 4096
 

Spawn a DataServer thread at port "port".

Reimplemented in DataServerMPI.

int DataServer::Stop  
 

Stop the DataServer. It waits for existing DataClient connections to end.

int DataServer::Synchronize char *    filename = NULL [protected]
 

Reimplemented in DataServerMPI.

int DataServer::Wait char *    key [inline]
 

Get lock on data registered by "keyword". Wait if any other DataClient is accessing the critical section.

Reimplemented in DataServerMPI.

int DataServer::Wait   [inline]
 

Get global lock. Wait if any other DataClient is accessing the critical section.


Friends And Related Function Documentation

friend class DataServerChildThread [friend]
 

friend class DataServerMainThread [friend]
 


Member Data Documentation

void(* DataServer::callback)(char*) [protected]
 

KeyTable* DataServer::keytable [protected]
 


The documentation for this class was generated from the following files:
Generated on Sun Jun 16 17:36:48 2002 for Anirudh's Vortex-Wake Simulation Code by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001