Main Page | Modules | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

DBClient Class Reference
[Database (Blackboard) Facilities]

#include <DBClient.hh>

Inherits DBBase.

List of all members.


Detailed Description

Interface class for a database client.

This class encapsulates a database client which contacts a database manager using the communications library, signs up for access to entrys, and then sets and gets those entry values appropriately. In addition, remote entries can go invalid if the database manager dies and is reborn. The client can "reestablish", i.e., sign up for the entry again, for an entry.


Public Member Functions

 DBClient (CommManager *mgr, const char *spec, int id, int fundamental_rate, int priority=-1)
 DBClient (CommManager *mgr, RemoteManager *dest, int id, int fundamental_rate)
RemoteDBEntryaccess (bool periodic, const char *name, int max_size, const char *description, unsigned int access_flags, int rate, int timeout=500)
RemoteDBEntrycreate (bool periodic, const char *name, int max_size, const char *description, unsigned int access_flags, int rate, int timeout=500)
RemoteDBEntryaccessInt (bool periodic, const char *name, unsigned int access_flags, int rate, int timeout=500)
RemoteDBEntryaccessDouble (bool periodic, const char *name, unsigned int access_flags, int rate, int timeout=500)
RemoteDBEntrycreateInt (bool periodic, const char *name, unsigned int access_flags, int rate, int timeout=500)
RemoteDBEntrycreateDouble (bool periodic, const char *name, unsigned int access_flags, int rate, int timeout=500)
RemoteManagergetDBManager () const
void shutdown ()
bool query (RemoteDBEntry *, int timeout)
void close (RemoteDBEntry *)

Related Functions

(Note that these are not member functions.)

 ACCESS(periodic, name, type, access_flags, rate, timeout)
 CREATE(periodic, name, type, access_flags, rate, timeout)


Constructor & Destructor Documentation

DBClient::DBClient CommManager mgr,
const char *  spec,
int  id,
int  fundamental_rate,
int  priority = -1
 

This constructor creates a database client whose manager is specified by spec. (all periodic operations will happen at an integer multiple of fundamental_rate milliseconds).


Member Function Documentation

RemoteDBEntry* DBClient::access bool  periodic,
const char *  name,
int  max_size,
const char *  description,
unsigned int  access_flags,
int  rate,
int  timeout = 500
 

This method attaches to entry on manager, return 0 if there, -1 if not access_flags is the OR'd value of the following flags

  • DB_PUBLISH - if there, we will be writing this value, if not write will always fail.
  • DB_SUBSCRIBE - if there, we will be reading this value, if not read will always fail.
  • DB_EXCLUSIVE - If possible, then no other remote client will be able to write this database element

If periodic is true, then

  • When DB_PUBLISH is true, the value of this entry will be sent to the manager approximately every rate milliseconds

  • When DB_SUBSCRIBE is true, the value of this entry will be sent from the manager to the client every rate milliseconds.

If periodic is false, then

  • When DB_PUBLISH is true, a "write" to this entry will be propagated to the manager immediately, unless the last write was less than rate milliseconds ago. Quick changes will be delayed for rate milliseconds.

  • When DB_SUBSCRIBE is true, changes made by the manager will be propagated to the client immediately, unless the last change was less than rate milliseconds ago.

Note rate for non-periodic can be 0, which means changes are immediately propagated no matter what, but this should be used with caution for high-priority entries that will _probably_ not change often (e-stops for example).

You cannot have both the DB_PUBLISH flag and the DB_SUBSCRIBE flag true at the same time. If this is the case, the entry request will be rejected and NULL will be returned.

RemoteDBEntry* DBClient::accessDouble bool  periodic,
const char *  name,
unsigned int  access_flags,
int  rate,
int  timeout = 500
 

This method is a convenience function for accessing an double precision floating point entry

RemoteDBEntry* DBClient::accessInt bool  periodic,
const char *  name,
unsigned int  access_flags,
int  rate,
int  timeout = 500
 

This method is a convenience function for accessing an integer entry

RemoteDBEntry* DBClient::create bool  periodic,
const char *  name,
int  max_size,
const char *  description,
unsigned int  access_flags,
int  rate,
int  timeout = 500
 

This method subscribes to an entry on manager, create if not there. Return 0 if successful, -1 if not. Otherwise, this has the same semantics as access

RemoteDBEntry* DBClient::createDouble bool  periodic,
const char *  name,
unsigned int  access_flags,
int  rate,
int  timeout = 500
 

This method is a convenience function for creating an double precision floating point entry

RemoteDBEntry* DBClient::createInt bool  periodic,
const char *  name,
unsigned int  access_flags,
int  rate,
int  timeout = 500
 

This method is a convenience function for creating an integer entry


Friends And Related Function Documentation

ACCESS periodic,
name,
type,
access_flags,
rate,
timeout   )  [related]
 

This is a convenience macro for accessing entries using the same calling semantics as the create and access methods, but whose size and descriptions are are extracted using macro magic from the type name type.

CREATE periodic,
name,
type,
access_flags,
rate,
timeout   )  [related]
 

This is a convenience macro for creating entries using the same calling semantics as the create and access methods, but whose size and descriptions are are extracted using macro magic from the type name type.


RHexLib Reference Documentation