![]() |
![]()
| ![]() |
![]()
NAMEsc::KeyVal - The KeyVal class is designed to simplify the process of allowing a user to specify keyword/value associations to a C++ program. SYNOPSIS#include <keyval.h> Inherits sc::RefCount. Inherited by sc::AggregateKeyVal, sc::AssignedKeyVal, sc::PrefixKeyVal, and sc::StringKeyVal. Public Typesenum { MaxKeywordLength = 256 }
Public Member Functionsint exists (const char *)
Reading Vectors.
This is equivalent to getting a value for a keyword named '<i>key</i>:<i>i</i>'. The routines that do not take key arguments get the value for the keyword named '<i>i</i>'.
Reading 2D Arrays.
This is equivalent to getting a value for a keyword named '<i>key</i>:<i>i</i>:<i>j</i>'. The routines that do not take key arguments get the value for the keyword named '<i>i</i>:<i>j</i>'.
Reading 3D Arrays.
The nindex argument is the number of indices in the array. It is followed by an int giving the value of each index.
Public Member Functions inherited from sc::RefCount
Public Member Functions inherited from sc::Identity
Protected Member Functionsvoid seterror (KeyValError err)
Protected Member Functions inherited from sc::RefCount
Protected Attributesint verbose_
Friendsclass AggregateKeyVal
Detailed DescriptionThe KeyVal class is designed to simplify the process of allowing a user to specify keyword/value associations to a C++ program. A flexible input style and ease of use for the programmer is achieved with this method. Keywords are represented by null terminated character arrays. The keywords are organized hierarchially, in a manner similar to the way that many file systems are organized. One character is special, ':', which is used to separate the various hierarchial labels, which are referred to as 'segments', in the keyword. A convention for specifying arrays is provided by KeyVal. Each index of the array is given by appending a segment containing the character representation of the index. Thus, 'array:3:4' would be a the keyword corresponding to fourth row and fifth column of 'array', since indexing starts at zero. To allow the KeyVal class to have associations that can represent data for classes, the keyword can be associated with a class as well as a value. This permits polymorphic data to be unambiguously represented by keyword/value associations. Most use of KeyVal need not be concerned with this. Member Function Documentationint sc::KeyVal::count (const char * = 0)If the value of a keyword is an array, then return its length. If no arguments are given then the top level will be checked to see if it is an array and, if so, the number of elements will be counted. virtual void sc::KeyVal::dump (std::ostream & fp = ExEnv::err0()) [virtual]Write a message to fp describing the error. Reimplemented in sc::StringKeyVal, sc::AggregateKeyVal, sc::PrefixKeyVal, and sc::ParsedKeyVal. virtual void sc::KeyVal::errortrace (std::ostream & fp = ExEnv::err0()) [virtual]Write a message to fp describing the error. Reimplemented in sc::StringKeyVal, sc::AggregateKeyVal, sc::PrefixKeyVal, and sc::ParsedKeyVal. int sc::KeyVal::exists (const char *)This takes as its only argument a keyword. Returns 1 if the keyword has a value and 0 otherwise. virtual int sc::KeyVal::have_unseen () [virtual]Return 1 if there were unseen keywords, 0 if there are none, or -1 this keyval doesn't keep track of unseen keywords. Reimplemented in sc::ParsedKeyVal. virtual int sc::KeyVal::key_exists (const char *) [protected], [pure virtual]Ultimately called by exists. Implemented in sc::AssignedKeyVal, sc::StringKeyVal, and sc::AggregateKeyVal. virtual Ref< KeyValValue > sc::KeyVal::key_value (const char *, const KeyValValue & def) [protected], [pure virtual]Ultimately called by value. Implemented in sc::AssignedKeyVal, sc::StringKeyVal, and sc::AggregateKeyVal. char * sc::KeyVal::pcharvalue (const char * key = 0, const KeyValValue & def = KeyValValuepchar())Returns a copy of the string representation of the key's value. Storage for the copy is obtained with new. virtual void sc::KeyVal::print_unseen (std::ostream & fp = ExEnv::out0()) [virtual]Print keywords that were never looked at, if possible. Reimplemented in sc::ParsedKeyVal. AuthorGenerated automatically by Doxygen for MPQC from the source code.
|