#include <dataserver.h>
Inheritance diagram for DataServer::

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 | |
| KeyTable * | keytable |
| void(* | callback )(char *) |
Friends | |
| class | DataServerMainThread |
| class | DataServerChildThread |
|
|
Default constructor recommended to be used with Start(port) for correct error handling.
Definition at line 13 of file dataserver.cc. References callback, DataServerMainThread, and keytable. |
|
|
Constructor to spawn a DataServer thread at port "port".
Definition at line 21 of file dataserver.cc. References callback, DataServerMainThread, keytable, and Start(). |
|
|
Destructor for cleanup.
Definition at line 30 of file dataserver.cc. References keytable. |
|
|
Definition at line 141 of file dataserver.cc. References TCPSocket::Accept(), ChildThreadStruct::client, ChildThreadStruct::ID, ChildThreadStruct::isRunning, keytable, mySleep(), ChildThreadStruct::server, ChildThreadStruct::th, and VERIFICATION_NUMBER. |
|
||||||||||||
|
Definition at line 77 of file dataserver.h. Referenced by BroadcastVariable(), and DataServerMPI::Synchronize(). |
|
||||||||||||||||
|
Definition at line 79 of file dataserver.h. References BroadcastData(). Referenced by DataServerMPI::Synchronize(), and DataServerMPI::Update(). |
|
|
Total number of bytes received through the DataServer class.
Reimplemented from TCPSocket. Definition at line 174 of file dataserver.h. References TCPSocket::BytesRecd(). Referenced by RecvRate(). |
|
|
Total number of bytes sent through the DataServer class.
Reimplemented from TCPSocket. Definition at line 171 of file dataserver.h. References TCPSocket::BytesSent(). Referenced by SendRate(). |
|
||||||||||||
|
Definition at line 81 of file dataserver.h. References RemoteSocket::RecvLine(). |
|
|
Get the value (as a string) of the variable registered by the "keyword" whose internal KeyTable handle is "i".
Definition at line 357 of file dataserver.cc. |
|
|
Get the value (as a string) of the variable registered by "keyword".
Definition at line 362 of file dataserver.cc. References CHAR, DOUBLE, FLOAT, KeyTable::getKeyHandle(), INT, KeyTable::isCharArray(), KeyTable::isViewableVar(), KeyTable::key, LONG, KeyTable::n, SHORT, UNKNOWN, and VariableType. Referenced by GetValue(), PrintDirty(), and RegisterKey(). |
|
||||||||||||
|
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.
Definition at line 296 of file dataserver.h. References KeyTable::key. |
|
|
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.
Definition at line 306 of file dataserver.h. References KeyTable::key, and KeyTable::n. Referenced by DataServerMPI::Synchronize(). |
|
||||||||||||
|
Same as above, except that the internal KeyTable handle "id" is specified instead of the keyword.
Definition at line 287 of file dataserver.h. References KeyTable::key. Referenced by PrintDirty(), and DataServerMPI::Synchronize(). |
|
|
Definition at line 75 of file dataserver.h. Referenced by DataServerMPI::Post(), DataServerMPI::Start(), DataServerMPI::Synchronize(), and DataServerMPI::Wait(). |
|
|
Returns whether the DataServer is running (or is Dead!).
Definition at line 200 of file dataserver.h. |
|
|
Definition at line 84 of file dataserver.h. References DataType. |
|
|
Returns the key pointed to by KeyTable handle "i".
Definition at line 195 of file dataserver.h. References KeyTable::key. Referenced by GetValue(), PrintDirty(), and DataServerMPI::Synchronize(). |
|
|
Returns the number of keywords registered by DataServer.
Definition at line 190 of file dataserver.h. References KeyTable::n. Referenced by PrintDirty(), and DataServerMPI::Synchronize(). |
|
|
Release/Post the lock on data registered by "keyword".
Reimplemented in DataServerMPI. Definition at line 238 of file dataserver.h. References Semaphore::Post(). |
|
|
Release/Post global lock.
Definition at line 226 of file dataserver.h. References Semaphore::Post(). Referenced by DataServerMPI::Post(), Register_Dynamic_1D_Array(), Register_Dynamic_2D_Array(), Register_Dynamic_3D_Array(), Register_Dynamic_4D_Array(), Register_Static_Array(), and Register_Variable(). |
|
||||||||||||
|
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.
Definition at line 430 of file dataserver.cc. References ERR_BAD_DATA, ERR_BAD_SOCKET, ERR_RECV_MESG, ERR_SEND_MESG, ERR_SIGPIPE, GetValue(), IsDirtyID(), Key(), and NumKeys(). Referenced by Synchronize(). |
|
|
Network bandwidth (in Mbps) for data received.
Reimplemented from TCPSocket. Definition at line 186 of file dataserver.h. |
|
|
Time to receive BytesRecd() bytes of data (in ms).
Reimplemented from TCPSocket. Definition at line 180 of file dataserver.h. References TCPSocket::RecvTime(). Referenced by RecvRate(). |
|
||||||||||||||||||||||||||||||||||||||||
|
Definition at line 113 of file dataserver_register.h. References DYNAMIC_1D_ARRAY, gotWriteRequest(), keyType, Post(), RemoteSocket::RecvArray1D(), Register_Variable(), RegisterKey(), RemoteSocket::SendArray1D(), RemoteSocket::SendVar(), SetDirty(), and Wait(). |
|
||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 145 of file dataserver_register.h. References DYNAMIC_2D_ARRAY, gotWriteRequest(), keyType, Post(), RemoteSocket::RecvArray2D(), Register_Variable(), RegisterKey(), RemoteSocket::SendArray2D(), RemoteSocket::SendVar(), SetDirty(), and Wait(). |
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 182 of file dataserver_register.h. References DYNAMIC_3D_ARRAY, gotWriteRequest(), keyType, Post(), RemoteSocket::RecvArray3D(), Register_Variable(), RegisterKey(), RemoteSocket::SendArray3D(), RemoteSocket::SendVar(), SetDirty(), and Wait(). |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 223 of file dataserver_register.h. References DYNAMIC_4D_ARRAY, gotWriteRequest(), keyType, Post(), RemoteSocket::RecvArray4D(), Register_Variable(), RegisterKey(), RemoteSocket::SendArray4D(), RemoteSocket::SendVar(), SetDirty(), and Wait(). |
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 82 of file dataserver_register.h. References DataType, gotWriteRequest(), keyType, Post(), RemoteSocket::RecvArrayGeneric(), RegisterKey(), RemoteSocket::SendArrayGeneric(), RemoteSocket::SendVar(), SetDirty(), STATIC_1D_ARRAY, and Wait(). |
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 59 of file dataserver_register.h. References CUSTOM_STRUCTURE, gotWriteRequest(), keyType, RemoteSocket::RecvStruct(), RegisterKey(), RemoteSocket::SendStruct(), and SetDirty(). |
|
||||||||||||||||||||||||||||||||||||
|
Functions for data registration.
Definition at line 30 of file dataserver_register.h. References gotWriteRequest(), keyType, Post(), RemoteSocket::RecvVar(), RegisterKey(), RemoteSocket::SendVar(), SetDirty(), VARIABLE, and Wait(). Referenced by Register_Dynamic_1D_Array(), Register_Dynamic_2D_Array(), Register_Dynamic_3D_Array(), and Register_Dynamic_4D_Array(). |
|
||||||||||||||||
|
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.
Definition at line 122 of file dataserver.h. References KeyTable::RegisterCallback(). |
|
|
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.
Definition at line 38 of file dataserver.cc. References callback. |
|
||||||||||||||||||||||||||||||||
|
Definition at line 260 of file dataserver.cc. References KeyTable::Add(), CHAR, DataType, DOUBLE, FLOAT, GetValue(), INT, KeyTable::key, KEY_READ_ONLY, KEY_READ_WRITE, keytable, LONG, KeyTable::n, SHORT, UNKNOWN, and VariableType. Referenced by Register_Dynamic_1D_Array(), Register_Dynamic_2D_Array(), Register_Dynamic_3D_Array(), Register_Dynamic_4D_Array(), Register_Static_Array(), Register_Structure(), and Register_Variable(). |
|
|
Network bandwidth (in Mbps) for data sent.
Reimplemented from TCPSocket. Definition at line 183 of file dataserver.h. |
|
|
Time to send BytesSent() bytes of data (in ms).
Reimplemented from TCPSocket. Definition at line 177 of file dataserver.h. References TCPSocket::SendTime(). Referenced by SendRate(). |
|
|
Mark the data registered by "keyword" as dirty (modified).
Definition at line 275 of file dataserver.h. References KeyTable::key. Referenced by Register_Dynamic_1D_Array(), Register_Dynamic_2D_Array(), Register_Dynamic_3D_Array(), Register_Dynamic_4D_Array(), Register_Static_Array(), Register_Structure(), and Register_Variable(). |
|
|
Spawn a DataServer thread at port "port".
Reimplemented in DataServerMPI. Definition at line 91 of file dataserver.cc. References TCPSocket::Bind(), TCPSocket::Listen(), mySleep(), myTimer(), POSSE_FAILURE, and POSSE_SUCCESS. Referenced by DataServer(), and DataServerMPI::Start(). |
|
|
Stop the DataServer. It waits for existing DataClient connections to end.
Definition at line 74 of file dataserver.cc. References mySleep(). |
|
|
Reimplemented in DataServerMPI. Definition at line 486 of file dataserver.cc. References POSSE_SUCCESS, and PrintDirty(). Referenced by DataServerMPI::Synchronize(). |
|
|
Get lock on data registered by "keyword". Wait if any other DataClient is accessing the critical section.
Reimplemented in DataServerMPI. Definition at line 232 of file dataserver.h. References Semaphore::Wait(). |
|
|
Get global lock. Wait if any other DataClient is accessing the critical section.
Definition at line 220 of file dataserver.h. References Semaphore::Wait(). Referenced by Register_Dynamic_1D_Array(), Register_Dynamic_2D_Array(), Register_Dynamic_3D_Array(), Register_Dynamic_4D_Array(), Register_Static_Array(), Register_Variable(), and DataServerMPI::Wait(). |
|
|
Definition at line 40 of file dataserver.h. |
|
|
Definition at line 39 of file dataserver.h. Referenced by DataServer(). |
|
|
Referenced by DataServer(), RegisterCallback(), and DataServerMPI::Synchronize(). |
|
|
Definition at line 73 of file dataserver.h. Referenced by AcceptClient(), DataServer(), RegisterKey(), DataServerMPI::Synchronize(), and ~DataServer(). |
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001