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

DBEntry Class Reference
[Database (Blackboard) Facilities]

#include <DBEntry.hh>

Inherited by RemoteDBEntry.

List of all members.


Detailed Description

Fundamental class for entries in the database.

The DBEntry class is the fundamental class for entries in the distributed database. Each entry has a byte array of data which can be queried and set. Each entry has a name by which it is entered in the database's entry dictionary and a description key, which is the string hash of a description of the entries contents, usually the name of the structure which best defines the entry. In addition, each entry as a list of "monitors" which get updated whenever the entry gets set (to invoke callbacks or send changes to remote clients if necessary) and a list of "change sources" which get updated whenever the entry value is gotten. Each change source is defined to return a "new" change message or NULL. The set will use the most recent change, if any. If no change source is "new", the entry returns the current data.

Entries can be "locally owned" which means only the local process can change the value. Entries can also be "exclusively owned" by a remote process, which means that only that remote process can change the value, although currently the local process can still change it.

Note that database entries can be even more expensive than communication mailboxes and streams, and thus it is imperative that the database not be simply a bunch of named integers and doubles. Data that is meant to be used together should be grouped together into structures as much as possible.


Public Member Functions

 DBEntry (const char *name, int max_size, unsigned int description_key, bool locally_owned=false)
virtual Messageget ()
void release (Message *)
MessagecreateData ()
virtual bool set (Message *)
int getInt ()
double getDouble ()
bool setInt (int i)
bool setDouble (double d)
template<class T> bool getStruct (T *val)
template<class T> bool setStruct (T *val)
const char * getName () const
unsigned int getDescriptionKey () const
int getMaxSize ()
bool compatible (int size, unsigned int key)
bool locallyOwned () const
void getExclusiveOwner (com_id_t &id, RemoteManager *&owner) const
void setExclusiveOwner (RemoteManager *owner)
void addMonitor (DBMonitor *)
void removeMonitor (DBMonitor *)
void removeMonitors (RemoteManager *remote)
void addChangeSource (DBChangeSource *)


Member Function Documentation

Message* DBEntry::createData  ) 
 

This method returns a pointer to a message to use to set the entry data.

virtual Message* DBEntry::get  )  [virtual]
 

This method returns a pointer to the message which contains the entry's data. It uses Message system from communications manager to reduce the amount of copying and allocating.

unsigned int DBEntry::getDescriptionKey  )  const [inline]
 

This method returns the result of running a hash function on the entry's description string.

double DBEntry::getDouble  ) 
 

This is a convenience method for accessing data entries which just contain double precision floating point numbers.

int DBEntry::getInt  ) 
 

This is a convenience method for accessing data entries which just contain integers.

int DBEntry::getMaxSize  )  [inline]
 

This method returns the maximum size of the entry data.

const char* DBEntry::getName  )  const [inline]
 

This method returns the name of the entry as it is entered in the database.

template<class T>
bool DBEntry::getStruct T *  val  ) 
 

This is a templated convenience method for accessing data entries which contain a flat structure of type "T".

void DBEntry::release Message  ) 
 

This method releases the message gotten by the get method (or, if necessary by the createData method, although that will be very uncommon).

virtual bool DBEntry::set Message  )  [virtual]
 

This method sets the entry data using the data in "msg";

bool DBEntry::setDouble double  d  ) 
 

This is a convenience method for setting data entries which just contain double precision floating point numbers.

bool DBEntry::setInt int  i  ) 
 

This is a convenience method for setting data entries which just contain integers.

template<class T>
bool DBEntry::setStruct T *  val  ) 
 

This is a templated convenience method for setting data entries which contain a flat structure of type "T".


RHexLib Reference Documentation