Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

gov::cca::KeyValueEnumerated Class Reference

This is a generic properties input/output interface which may be supported at the discretion of the concrete class implementer. More...

#include <KeyValueEnumerated.h>

Inheritance diagram for gov::cca::KeyValueEnumerated:

Inheritance graph
[legend]
Collaboration diagram for gov::cca::KeyValueEnumerated:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual int setString (const char *key, const char *value)=0
 Defines a new string property or changes the value of an existing one. More...

virtual int setFloat (const char *key, float value)=0
 Defines a new Float property or changes its value. More...

virtual int setDouble (const char *key, double value)=0
virtual int setLongDouble (const char *key, long double value)=0
virtual int setChar (const char *key, int value)=0
 Defines a new integral property or changes its value. More...

virtual int setShort (const char *key, int value)=0
virtual int setInt (const char *key, int value)=0
virtual int setLong (const char *key, long int value)=0
virtual int setLongLong (const char *key, long long int value)=0
virtual int setUnsignedChar (const char *key, unsigned char value)=0
virtual int setUnsignedShort (const char *key, unsigned short value)=0
virtual int setUnsignedInt (const char *key, unsigned int value)=0
virtual int setUnsignedLong (const char *key, unsigned long int value)=0
virtual int setUnsignedLongLong (const char *key, unsigned long long int value)=0
virtual int setBool (const char *key, bool boolProp)=0
 Defines a new boolean property or changes its value. More...

virtual int setPointer (const char *key, void *objProp)=0
 Defines a new arbitrary object property, or substitutes a new object for the currently stored one. More...

virtual int getString (const char *propName, const char *&value)=0
 Get a C string property value by C string name. More...

virtual int getFloat (const char *propName, Float &value)=0
 Get a Float property value by C string name. More...

virtual int getInt (const char *propName, Int &value)=0
 Get an Int property value by C string name. More...

virtual int getBool (const char *propName, bool &value)=0
 Get a bool property value by C string name. More...

virtual int getPointer (const char *propName, void *&value)=0
 Get a pointer property value by C string name. More...

virtual void unset (const char *propName, void *&pointerOut)=0
 Remove a key from the properties. More...

virtual void getKeys (Argv *keylist)=0
 Produce a list of all the keys in an abstract container. More...

virtual void getKeysSupported (Argv *keylist)=0
 Produce a list of the keys in the main underlying object that the object "supports", i.e. More...


Detailed Description

This is a generic properties input/output interface which may be supported at the discretion of the concrete class implementer.

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.

The usual esi_msg error buffer is omitted from the functions in this interface, as it is particularly simple.

Some properties/control parameters (such as iterationLimit which must be present in all ESI_Solvers) may be represented redundantly in this optional<\em>Properties itnerface.

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 depends on Int and Float, it cannot be in the Object interface. Since some operators/matrices/solvers/vectors/pcs may have no special properties, the interface is not required (by inheritance) into those classes.

We will create a reference implementation of this interface which can be inherited or used as an internal data member (delegated to) to provide this interface.

Probably most implementers will support it by delegation or inheritance of the reference-- no bonus points in the math world for implementing hashes. Those implementers that want to back this interface by an existing resource mechanism are of course free to do so.


Member Function Documentation

virtual int gov::cca::KeyValueEnumerated::setString const char *    key,
const char *    value
[pure virtual]
 

Defines a new string property or changes the value of an existing one.

Because the string arguments are copied, it is okay to call this with string literal arguments.

Parameters:
key  The property name, which will be copied.
value  The property value, which will be copied. A 0 value will cause the key to remain with a NULL value. Use 'unset' to delete keys.
Returns:
0 if ok, -2 if not ok due to a type conflict, and -1 for all other reason.

virtual int gov::cca::KeyValueEnumerated::setFloat const char *    key,
float    value
[pure virtual]
 

Defines a new Float 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 int gov::cca::KeyValueEnumerated::setChar const char *    key,
int    value
[pure virtual]
 

Defines a new integral 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 int gov::cca::KeyValueEnumerated::setBool const char *    key,
bool    boolProp
[pure virtual]
 

Defines a new boolean 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 int gov::cca::KeyValueEnumerated::setPointer const char *    key,
void *    objProp
[pure virtual]
 

Defines a new arbitrary object property, or substitutes a new object for the currently stored one.

Parameters:
key  The property name, which will be copied.
value  If the void pointer given should be reference counted, that is the caller's responsibility. The pointer will be stored until the next set or unset on the same key. The void pointer may be to an object, an array, or anything else.
Returns:
0 if ok, -2 if not ok due to a type conflict, and -1 for all other reasons.

virtual int gov::cca::KeyValueEnumerated::getString const char *    propName,
const char *&    value
[pure virtual]
 

Get a C string property value by C string name.

Parameters:
key  The name of the property desired.
value  output of the value requested.
Returns:
0 if value exists. -2 if it exists and is of the wrong type. -1 does not exist or any other error.

virtual int gov::cca::KeyValueEnumerated::getFloat const char *    propName,
Float &    value
[pure virtual]
 

Get a Float property value by C string name.

Parameters:
key  The string name of the property desired.
value  output of the value requested.
Returns:
0 if value exists. -2 if it exists and is of the wrong type. -1 does not exist or any other error.

virtual int gov::cca::KeyValueEnumerated::getInt const char *    propName,
Int &    value
[pure virtual]
 

Get an Int property value by C string name.

Parameters:
key  The string name of the property desired.
value  output of the value requested.
Returns:
0 if value exists. -2 if it exists and is of the wrong type. -1 does not exist or any other error.

virtual int gov::cca::KeyValueEnumerated::getBool const char *    propName,
bool &    value
[pure virtual]
 

Get a bool property value by C string name.

Parameters:
key  The string name of the property desired.
value  output of the value requested.
Returns:
0 if value exists. -2 if it exists and is of the wrong type. -1 does not exist or any other error.

virtual int gov::cca::KeyValueEnumerated::getPointer const char *    propName,
void *&    value
[pure virtual]
 

Get a pointer property value by C string name.

Parameters:
key  The string name of the property desired.
value  output of the value requested.
Returns:
0 if value exists. -2 if it exists and is of the wrong type. -1 does not exist or any other error.

virtual void gov::cca::KeyValueEnumerated::unset const char *    propName,
void *&    pointerOut
[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 void gov::cca::KeyValueEnumerated::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 Properties are appended.

virtual void gov::cca::KeyValueEnumerated::getKeysSupported Argv *    keylist [pure virtual]
 

Produce a list of the keys in the main underlying object that the object "supports", i.e.

sets or reads during computations. Other keys may be present for use by third parties that have nothing to do with "the algorithm", but these keys will not appear in the getKeysSupported list.

Parameters:
keylist  input/output Argv that should be supplied empty (containing no keys). The names of supported keys in the Properties 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 doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002