Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members
gov::cca::KeyValueTyped Class Reference
This is a generic properties input/output Port.
More...
#include <KeyValueTyped.h>
Inheritance diagram for gov::cca::KeyValueTyped:
[legend]Collaboration diagram for gov::cca::KeyValueTyped:
[legend]List of all members.
Public Methods |
| virtual int | set (const char *key, enum RawData::Type type, void *value)=0 |
| | Defines a new single-valued property or changes the value of an existing one. More...
|
| virtual int | get (const char *key, enum RawData::Type type, void *valuePtr)=0 |
| virtual void | unset (const char *propName)=0 |
| | Remove a key from the properties. More...
|
| virtual int | setString (const char *key, const char *value)=0 |
| | Defines a new string property or changes its value. More...
|
| virtual const char * | getString (const char *key)=0 |
| | Fetch a string value. More...
|
| virtual void | getKeys (Argv *keylist)=0 |
| | Produce a list of all the keys in an abstract container. More...
|
Detailed Description
This is a generic properties input/output Port.
It may be backed by a shared database, a private database, or an instance of some numerical object, or anything else for that matter.
This is a Closed hash -- one value (and value type) per key. Setting a new value and type for a key which has a value of another type already is an error.
As an example: If you have a solver that cares about the properties of a Matrix or Operator, simply : esi::Properties *p; err = mtx->getInterface("esi::Properties", (void *)p,msg); bool is_psym = false; if (err >= 0) { // <0 means no properties interface p. err2 = p->getBool("esi.P-Symmetric",psym); // ignore err2 is ok if esi.P-Symmetric unknown, nothing psym is returned unchanged. }
Implementation notes:
Since this version uses an enum-based type-checking scheme, access functions may return errors for data with types not supported on the given platform. It is probable that no 100% complete and native C compiler supported implementation will exist due to the breadth of possible types defined in RawData.h
Member Function Documentation
| virtual int gov::cca::KeyValueTyped::set |
( |
const char * |
key, |
|
|
enum RawData::Type |
type, |
|
|
void * |
value |
|
) |
[pure virtual] |
|
|
|
Defines a new single-valued property or changes the value of an existing one.
-
Parameters:
-
| key |
The property name, which will be copied. |
| type |
The singleton types from the Type enum in RawData.h. String values are supported but not with this function. Ptr* types from RawData are not supported. |
| value |
Pointer to the property value to be copied. A 0 pointer value will cause the key to remain with a NULL value. Use 'unset' to delete key. |
-
Returns:
-
0 if ok, -3 if not ok because type is unsupported in the implementation. -2 if not ok due to a type conflict with existing value, and -1 for all other reason.
|
| virtual int gov::cca::KeyValueTyped::get |
( |
const char * |
key, |
|
|
enum RawData::Type |
type, |
|
|
void * |
valuePtr |
|
) |
[pure virtual] |
|
|
|
-
Parameters:
-
| key |
The name of the value to be fetched. |
| valuePtr |
The slot to fill with the value requested. (can't be 0). |
| type |
The singleton types from the Type enum in RawData.h, per set() in this interface. |
-
Returns:
-
0 if ok, -1 if key unknown. -2 if type conflict.
|
| virtual void gov::cca::KeyValueTyped::unset |
( |
const char * |
propName |
) |
[pure virtual] |
|
|
|
Remove a key from the properties.
All errors are silently ignored. -
Parameters:
-
| pointerOut |
If the key corresponds to a void pointer property, the pointer is returned in pointerOut, otherwise pointerOut is 0. |
|
| virtual int gov::cca::KeyValueTyped::setString |
( |
const char * |
key, |
|
|
const char * |
value |
|
) |
[pure virtual] |
|
|
|
Defines a new string property or changes its value.
-
Parameters:
-
| key |
The property name, which will be copied. |
| value |
The property value to be set. |
-
Returns:
-
0 if ok, -2 if not ok due to a type conflict, and -1 for all other reason.
|
| virtual const char* gov::cca::KeyValueTyped::getString |
( |
const char * |
key |
) |
[pure virtual] |
|
|
|
Fetch a string value.
-
Parameters:
-
| key |
The name of the string value to be fetched. |
-
Returns:
-
0 if ok, -1 if key unknown. -2 if type conflict (key is not for a string).
|
| virtual void gov::cca::KeyValueTyped::getKeys |
( |
Argv * |
keylist |
) |
[pure virtual] |
|
|
|
Produce a list of all the keys in an abstract container.
-
Parameters:
-
| keylist |
input/output Argv that should be supplied empty (containing no keys). The names of keys in the KeyValueTyped are appended. |
|
The documentation for this class was generated from the following file:
Generated on Tue Aug 20 14:30:32 2002 for CCA Specification/Proposals by
1.2.14 written by Dimitri van Heesch,
© 1997-2002