classic_gov_cca_KeyValueTyped(3)

classic::gov::cca::KeyValueTyped(3) 'Classic' CCA c++ binding (ccaffeine-only) classic::gov::cca::KeyValueTyped(3)

NAME

classic::gov::cca::KeyValueTyped -

Abstract control parameters and other string named data io interface.

SYNOPSIS

#include <KeyValueTyped.h>

Inherits classic::gov::cca::Port.

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::Typetype, 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::Typetype, 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.

Author

Generated automatically by Doxygen for 'Classic' CCA c++ binding (ccaffeine-only) from the source code.

Tue Nov 12 2013 Version 0.5.7