classic::gov::cca::KeyValueTyped Class Reference

Abstract control parameters and other string named data io interface. More...

#include <KeyValueTyped.h>

Inheritance diagram for classic::gov::cca::KeyValueTyped:

Inheritance graph
[legend]
Collaboration diagram for classic::gov::cca::KeyValueTyped:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual int set (const char *key, enum RawData::Type type, void *value) CLASSIC_CCA_PURE
 Defines a new single-valued property or changes the value of an existing one.
virtual int get (const char *key, enum RawData::Type type, void *valuePtr) CLASSIC_CCA_PURE
virtual void unset (const char *propName) CLASSIC_CCA_PURE
 Remove a key from the properties.
virtual int setString (const char *key, const char *value) CLASSIC_CCA_PURE
 Defines a new string property or changes its value.
virtual const char * getString (const char *key) CLASSIC_CCA_PURE
 Fetch a string value.
virtual void getKeys (Argv *keylist) CLASSIC_CCA_PURE
 Produce a list of all the keys in an abstract container.


Detailed Description

Abstract control parameters and other string named data io interface.

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 classic::gov::cca::KeyValueTyped::set ( const char *  key,
enum RawData::Type  type,
void *  value 
) [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 classic::gov::cca::KeyValueTyped::get ( const char *  key,
enum RawData::Type  type,
void *  valuePtr 
) [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 classic::gov::cca::KeyValueTyped::unset ( const char *  propName  )  [virtual]

Remove a key from the properties.

All errors are silently ignored.

Parameters:
propName key. otherwise pointerOut is 0.

virtual int classic::gov::cca::KeyValueTyped::setString ( const char *  key,
const char *  value 
) [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* classic::gov::cca::KeyValueTyped::getString ( const char *  key  )  [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 classic::gov::cca::KeyValueTyped::getKeys ( Argv *  keylist  )  [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 Mon Sep 14 18:23:27 2009 for 'Classic' CCA c++ binding (ccaffeine-only) by  doxygen 1.5.9