|
| DataBase () |
| create an empty database
|
|
| DataBase (const DataBase &d) |
| copy a database
|
|
virtual | ~DataBase () |
| destroy a database and its information
|
|
virtual void | clear () |
| destroy a databae and its information
|
|
template<typename T > |
T & | put (std::string name, const T &entry, void(*entry_destructor)(T &)=0) |
| put an item into the database, return a reference to the data
|
|
template<typename T > |
T & | put (std::string name, void(*entry_destructor)(T &)=0) |
| This version of put does not initialize the entry.
|
|
template<typename T > |
T & | get (std::string name) |
| get a reference to something in the database
|
|
template<typename T > |
const T & | get (std::string name) const |
| get a const reference to something in the database
|
|
const KK::sptr< Entry > | getEntry (std::string name) const |
|
void | remove (std::string name) |
| remove an item from the database
|
|
void | toggleTrait (std::string name, int t) |
| toggle a trait for a particular entry, default state is off
|
|
bool | traitActive (std::string name, int t) |
| return true if the trait t is active for entry name
|
|
bool | has_key (std::string name) const |
| return true if the database has an entry with this name
|
|
size_t | size () const |
| return the number of entries in the database
|
|
void | processEntries (EntryProcessingFunction func) |
| process all entries with the function func
|
|
template<class F > |
void | processEntries (F &func) |
| process all entries with a function class
|
|
template<class F > |
void | processEntries (const F &func) |
| process all entries with a function class
|
|
void | merge (DataBase &db_in) throw (DBErr) |
| merge the contents of a database into this one; if there is a name conflict throw an error
|
|
void | link (DataBase &from, std::string from_nm, std::string to_nm) |
| link an entry of one database to an entry in the current database with a new name.
|
|
void | link (DBase::EntryP &from, std::string to_nm) |
| link an entry pointer to an entry in the current database with a new name.
|
|
iterator | begin () |
|
const_iterator | begin () const |
|
iterator | end () |
|
const_iterator | end () const |
|
the actual database class, uses a stl map for actual data storage/retrieval
template<typename T >
T& DBase::DataBase::put |
( |
std::string |
name, |
|
|
const T & |
entry, |
|
|
void(*)(T &) |
entry_destructor = 0 |
|
) |
| |
|
inline |
put an item into the database, return a reference to the data
- Parameters
-
name | the name of the entry in the database |
entry | a COPY of this data will be stored in the database |
entry_destructor | an optional callback to destroy the data |
An entry containing a COPY of the data is placed into the database. If entry is not provided, a new instance of the specified type is created using the type's default constructor. An optional destructor callback for entry can be provided by passing a pointer to a function returning void and taking one argument of type reference to T.
The method returns a reference to the data stored in the database.
sample usage: DBase::DataBase db; int &i = db.put("i",10); // create an int entry named "i" with value 10 int &j = db.put<int>("j"); // create an uninitialized int at entry "j" // below, place a pointer to a Foo object and provide a destructor db.put("a foo object ptr", aFooObjectPtr, fooOpjectDestructor);
References KK::sptr_dynamic_cast().
Referenced by BodyForce::BodyForce(), BodyForceRegionParameters::BodyForceRegionParameters(), BodyForce::get(), ShowFilePlotter::plot(), and BodyForce::plotForcingRegions().