In file /home/blah/darwin2k/src/ddcore/misc/paramParser.h:

class paramParser

parser for C-like parameter files, or 'p-files'.

Inheritance:


Public Methods

[more]int parseFile(const char* filename)
parses the given file
[more]int getInt(const char* varName, int &val, int quiet = 0)
Gets the value of an integer variable from a parsed p-file.
[more]int getFloat(const char* varName, float &val, int quiet = 0)
Gets the value of a float variable from a parsed p-file.
[more]int getDouble(const char* varName, double &val, int quiet = 0)
Gets the value of an double variable from a parsed p-file.
[more]int getChar(const char* varName, char &val, int quiet = 0)
Gets the value of an char variable from a parsed p-file.
[more]int getString(const char* varName, const char* &val, int quiet = 0)
Gets the value of a string variable from a parsed p-file.
[more]int getEnum(const char* varName, int &val, int quiet = 0)
Gets the value of an enum variable from a parsed p-file.
[more]int getTriple(const char* varName, triple &val, int quiet = 0)
Gets the value of a triple variable from a parsed p-file.
[more]int getQuaternion(const char* varName, quaternion &val, int quiet = 0)
Gets the value of a quaternion variable from a parsed p-file.
[more]int pushContext(const char* context, int quiet = 0)
pushes the current context and sets the context to the given value.
[more]int popContext(void)
pops the top context off the context stack and sets the current context to it.


Inherited from paramEnv:

Public Members

Wrappers for paramEnv::get*() methods


Documentation

parser for C-like parameter files, or 'p-files'.
oint parseFile(const char* filename)
parses the given file

oint getInt(const char* varName, int &val, int quiet = 0)
Gets the value of an integer variable from a parsed p-file. If an integer variable with the given name was in the p-file, the value of the variable is returned in val and the function returns 1. If not then a message will be printed if quiet is non-zero, and the function returns 0.

oint getFloat(const char* varName, float &val, int quiet = 0)
Gets the value of a float variable from a parsed p-file. If a float variable with the given name was in the p-file, the value of the variable is returned in val and the function returns 1. If not then a message will be printed if quiet is non-zero, and the function returns 0.

oint getDouble(const char* varName, double &val, int quiet = 0)
Gets the value of an double variable from a parsed p-file. If an double variable with the given name was in the p-file, the value of the variable is returned in val and the function returns 1. If not then a message will be printed if quiet is non-zero, and the function returns 0.

oint getChar(const char* varName, char &val, int quiet = 0)
Gets the value of an char variable from a parsed p-file. If an char variable with the given name was in the p-file, the value of the variable is returned in val and the function returns 1. If not then a message will be printed if quiet is non-zero, and the function returns 0.

oint getString(const char* varName, const char* &val, int quiet = 0)
Gets the value of a string variable from a parsed p-file. If an char[] variable with the given name was in the p-file, val is set to a pointer to an internal buffer containing the string, and the function returns 1. NOTE: the user should either use the value the pointer before the next call to paramEnv::get*, or copy the string to other storage for later use. If there was no string with the given name, then a message will be printed (if quiet is non-zero), and the function returns 0.

oint getEnum(const char* varName, int &val, int quiet = 0)
Gets the value of an enum variable from a parsed p-file. If an enum variable with the given name was in the p-file, the value of the variable is returned in val and the function returns 1. If not then a message will be printed if quiet is non-zero, and the function returns 0.

oint getTriple(const char* varName, triple &val, int quiet = 0)
Gets the value of a triple variable from a parsed p-file. If varName is 'myTriple', then in the p-file the value for myTriple should be specified as:

double myTripleX = 1.0; double myTripleY = 2.0; double myTripleZ = 3.0;

Any of the components specified in the file will be copied into val, but the function will return 1 only if all three components were specified.
Returns:
Returns 1 if all three components were read, 0 if not.

oint getQuaternion(const char* varName, quaternion &val, int quiet = 0)
Gets the value of a quaternion variable from a parsed p-file. If varName is 'myQuaternion', then in the p-file the value for myQuaternion should be specified as:

double myQuaternionR = 0.7071; double myQuaternionI = 0.7071; double myQuaternionJ = 0; double myQuaternionK = 0;

Any of the components specified in the file will be copied into val, but the function will return 1 only if all four components were specified. The quaternion is normalized before returning.
Returns:
Returns 1 if all four components were read, 0 if not.

oint pushContext(const char* context, int quiet = 0)
pushes the current context and sets the context to the given value. Subsequent calls to one of the get* methods will only look up symbols in the supplied context and the global context. To define a context in the p-file, the syntax is:
#myContext
All variable definition until the next context definition will then belong to the indicated context (myContext in this example). The global context consist of all variables declared between the beginning of the file and the first context definition.
Returns:
s Returns 1 if the specified context was found, 0 if not.

oint popContext(void)
pops the top context off the context stack and sets the current context to it. Returns 1 if there was a context on the stack, or 0 if not.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.