Click
Loading...
Searching...
No Matches
Public Member Functions | List of all members
DynamicNameDB Class Reference

A modifiable database mapping names to arbitrary values. More...

Inheritance diagram for DynamicNameDB:
NameDB

Public Member Functions

 DynamicNameDB (uint32_t type, const String &context, size_t value_size)
 Construct a dynamic name database.
 
bool query (const String &name, void *value, size_t value_size)
 Query this database for a given name.
 
String revquery (const void *value, size_t value_size)
 Query this database for a given value.
 
bool define (const String &name, const void *value, size_t value_size)
 Define a name in this database to a given value.
 
- Public Member Functions inherited from NameDB
 NameDB (uint32_t type, const String &context, size_t value_size)
 Construct a database.
 
virtual ~NameDB ()
 Destroy a database.
 
uint32_t type () const
 Return the database type.
 
const String & context () const
 Return the database's compound element context as a string.
 
NameDB * context_parent () const
 Return the contextual parent database, if any.
 
size_t value_size () const
 Return the database's value size.
 
bool define_int (const String &name, int32_t value)
 Define a name in this database to a 32-bit integer value.
 

Detailed Description

A modifiable database mapping names to arbitrary values.

DynamicNameDB is a NameDB database that maps names to arbitrary values. The database is initially empty. DynamicNameDB supports define() operations; that's how information is added to it.

DynamicNameDB objects are automatically created by NameInfo::getdb().

See also
NameInfo, NameDB

Constructor & Destructor Documentation

◆ DynamicNameDB()

DynamicNameDB::DynamicNameDB ( uint32_t  type,
const String &  context,
size_t  value_size 
)
inline

Construct a dynamic name database.

Parameters
typedatabase type
contextdatabase compound element context, as a String
value_sizedatabase value size

value_size must be greater than 0. The database is initially empty.

Member Function Documentation

◆ query()

bool DynamicNameDB::query ( const String &  name,
void *  value,
size_t  value_size 
)
virtual

Query this database for a given name.

Parameters
namename to look up
valuepoints to value storage
value_sizesize of value storage
Returns
true iff the query succeeded

The value_size parameter must equal this database's value size.

Implements NameDB.

◆ revquery()

String DynamicNameDB::revquery ( const void *  value,
size_t  value_size 
)
virtual

Query this database for a given value.

Parameters
valuepoints to value to look up
value_sizesize of value storage
Returns
the name for the given value, or an empty string if the value has not been defined

The value_size parameter must equal this database's value size.

Reimplemented from NameDB.

◆ define()

bool DynamicNameDB::define ( const String &  name,
const void *  value,
size_t  value_size 
)
virtual

Define a name in this database to a given value.

Parameters
namename to define
valuepoints to value to define
value_sizesize of value storage
Returns
true iff the name was defined

The value_size parameter must equal this database's value size.

Reimplemented from NameDB.


The documentation for this class was generated from the following files: