Bayonne2 / Common C++ 2 Framework
|
Bayonnne specific static keydata class. More...
#include <bayonne.h>
Public Member Functions | |
StaticKeydata (const char *path, Keydata::Define *defkeys=NULL, const char *homepath=NULL) | |
const char * | getString (const char *id) |
long | getValue (const char *id) |
bool | getBoolean (const char *id) |
unsigned | getIndex (char **data, unsigned max) |
Get an index array of ALL keywords that are stored by the current keydata object. More... | |
void | load (const char *keypath) |
Load additional key values into the currrent object from the specfied config source (a config file/section pair). More... | |
void | load (Define *pairs) |
Load default keywords into the current object. More... | |
void | loadPrefix (const char *prefix, const char *keypath) |
Load additional key values into the currrent object from the specfied config source (a config file/section pair). More... | |
void | loadFile (const char *filepath, const char *keys=NULL, const char *pre=NULL) |
Load additional keys into the current object using a real filename that is directly passed rather than a computed key path. More... | |
void | unlink (void) |
Unlink the keydata object from the cache file stream. More... | |
int | getCount (const char *sym) |
Get a count of the number of data "values" that is associated with a specific keyword. More... | |
unsigned | getCount (void) |
Get the count of keyword indexes that are actually available so one can allocate a table to receive getIndex. More... | |
const char * | getFirst (const char *sym) |
Get the first data value for a given keyword. More... | |
const char * | getLast (const char *sym) |
Get the last (most recently set) value for a given keyword. More... | |
bool | isKey (const char *sym) |
Find if a given key exists. More... | |
const char * | getString (const char *sym, const char *def=NULL) |
Get a string value, with an optional default if missing. More... | |
long | getLong (const char *sym, long def=0) |
Get a long value, with an optional default if missing. More... | |
bool | getBool (const char *key) |
Get a bool value. More... | |
double | getDouble (const char *key, double def=0.) |
Get a floating value. More... | |
void | setValue (const char *sym, const char *data) |
Set (replace) the value of a given keyword. More... | |
const char *const * | getList (const char *sym) |
Return a list of all values set for the given keyword returned in order. More... | |
void | clrValue (const char *sym) |
Clear all values associated with a given keyword. More... | |
const char * | operator[] (const char *keyword) |
A convient notation for accessing the keydata as an associative array of keyword/value pairs through the [] operator. More... | |
Static Public Member Functions | |
static void | end (void) |
static member to end keydata i/o allocations. More... | |
Protected Member Functions | |
Keysym * | getSymbol (const char *sym, bool create) |
virtual void * | first (size_t size) |
Allocate first workspace from paged memory. More... | |
char * | first (char *str) |
Allocate a string from the memory pager pool and copy the string into it's new memory area. More... | |
virtual void * | alloc (size_t size) |
Allocate memory from either the currently active page, or allocate a new page for the object. More... | |
char * | alloc (const char *str) |
Allocate a string from the memory pager pool and copy the string inti it's new memory area. More... | |
void | purge (void) |
purge the current memory pool. More... | |
void | clean (void) |
Clean for memory cleanup before exiting. More... | |
int | getPages (void) |
Return the total number of pages that have been allocated for this memory pool. More... | |
Bayonnne specific static keydata class.
This is used for configuration keys which cannot be reloaded at runtime.
ost::StaticKeydata::StaticKeydata | ( | const char * | path, |
Keydata::Define * | defkeys = NULL , |
||
const char * | homepath = NULL |
||
) |
|
protectedvirtualinherited |
Allocate memory from either the currently active page, or allocate a new page for the object.
size | size of memory to allocate. |
Reimplemented in SharedMemPager.
|
protectedinherited |
Allocate a string from the memory pager pool and copy the string inti it's new memory area.
This checks only the last active page for available space before allocating a new page.
str | string to allocate and copy into paged memory pool. |
|
protectedinherited |
Clean for memory cleanup before exiting.
|
inherited |
Clear all values associated with a given keyword.
This does not de-allocate the keyword from memory, however.
|
staticinherited |
static member to end keydata i/o allocations.
|
protectedvirtualinherited |
Allocate first workspace from paged memory.
This method scans all currently allocated blocks for available space before adding new pages and hence is both slower and more efficient.
size | size of memory to allocate. |
Reimplemented in SharedMemPager.
|
protectedinherited |
Allocate a string from the memory pager pool and copy the string into it's new memory area.
This method allocates memory by first searching for an available page, and then allocating a new page if no space is found.
str | string to allocate and copy into paged memory pool. |
|
inherited |
Get a bool value.
sym | keyword name. |
|
inline |
|
inherited |
Get a count of the number of data "values" that is associated with a specific keyword.
Each value is from an accumulation of "<code>load()</code>" requests.
sym | keyword symbol name. |
|
inherited |
Get the count of keyword indexes that are actually available so one can allocate a table to receive getIndex.
|
inherited |
Get a floating value.
sym | keyword name. |
default | if not set. |
|
inherited |
Get the first data value for a given keyword.
This will typically be the /etc
set global default.
sym | keyword symbol name. |
|
inherited |
Get an index array of ALL keywords that are stored by the current keydata object.
data | pointer of array to hold keyword strings. |
max | number of entries the array can hold. |
|
inherited |
Get the last (most recently set) value for a given keyword.
This is typically the value actually used.
sym | keyword symbol name. |
|
inherited |
Return a list of all values set for the given keyword returned in order.
sym | keyword name to fetch. |
|
inherited |
Get a long value, with an optional default if missing.
sym | keyword name. |
default | if not present. |
|
inlineinherited |
|
inline |
|
inherited |
Get a string value, with an optional default if missing.
sym | keyword name. |
default | if not present. |
|
protectedinherited |
|
inline |
|
inherited |
Find if a given key exists.
sym | keyword to find. |
|
inherited |
Load additional key values into the currrent object from the specfied config source (a config file/section pair).
These values will overlay the current keywords when matches are found. This can be used typically in a derived config object class constructor to first load a /etc
section, and then load a matching user specific entry from ~/.
to override default system values with user specific keyword values.
keypath | (filepath/section) |
|
inherited |
Load default keywords into the current object.
This only loads keyword entries which have not already been defined to reduce memory usage. This form of Load is also commonly used in the constructor of a derived Keydata class.
pairs | list of NULL terminated default keyword/value pairs. |
|
inherited |
Load additional keys into the current object using a real filename that is directly passed rather than a computed key path.
This also uses a [keys] section as passed to the object.
filepath | to load from |
keys | section to parse from, or NULL to parse from head |
pre | optional key prefix |
|
inherited |
Load additional key values into the currrent object from the specfied config source (a config file/section pair).
These values will overlay the current keywords when matches are found. This can be used typically in a derived config object class constructor to first load a /etc
section, and then load a matching user specific entry from ~/.
to override default system values with user specific keyword values. This varient puts a prefix in front of the key name.
prefix | |
keypath | (filepath/section) |
|
inlineinherited |
|
protectedinherited |
purge the current memory pool.
|
inherited |
|
inherited |
Unlink the keydata object from the cache file stream.
This should be used if you plan to keepa Keydata object after it is loaded once all keydata objects have been loaded, otherwise the cfgFile stream will remain open. You can also use endKeydata().