Sandia Home Sandia Home
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

APPSPACK::Parameter::Entry Class Reference

#include <APPSPACK_Parameter_Entry.hpp>

Collaboration diagram for APPSPACK::Parameter::Entry:

Collaboration graph
[legend]
List of all members.

Detailed Description

Stores a List of parameters or a single parameter, which can be a bool, int, double, string, APPSPACK::Value, APPSPACK::Vector. For any single parameter, two attributes are tracked:
  1. Used (isGotten): True if it has been accessed by a "get" function (mutable)
  2. Default (isSetByGet): True if it was set by a "get" function

The "Used" parameter is mutable, which means it can be changed even for a const Entry.

Definition at line 64 of file APPSPACK_Parameter_Entry.hpp.

Public Member Functions

Constructors / Destructor
The "Used" paraemeter is set to false. The "Default" pareameter is set to false, unless the optional second argument is true.

 Entry ()
 Create an empty Entry that doesn't contain anything.
 Entry (const Entry &source)
 Copy constructor.
 Entry (bool value, bool isCreatedByGet=false)
 Create an Entry containing a bool.
 Entry (int value, bool isCreatedByGet=false)
 Create an Entry containing an int.
 Entry (double value, bool isCreatedByGet=false)
 Create an Entry containing a double.
 Entry (const string &value, bool isCreatedByGet=false)
 Create an Entry containing a string.
 Entry (const Value &value, bool isCreatedByGet=false)
 Create an Entry containing a Value.
 Entry (const Vector &value, bool isCreatedByGet=false)
 Create an Entry containing a Vector.
 ~Entry ()
 Destructor.
Copy
Entryoperator= (const Entry &source)
 Copy an entry.
Sublists
Functions for handling parameters that are themselves lists.

ListsetList (bool isCreatedByGet=false)
 Create a sublist. Sets "Default" according to the optional argument. Sets "Used" to false.
ListgetListValue ()
 Extract the reference to the list that is stored in the Entry. Set "Used" to true.
const ListgetListValue () const
 Extract the reference to the list that is stored in the Entry. Set "Used" to true.
Set functions.
Similar to the corresponding constructors. Completely erases the old entry. The "Used" paraemeter is (re-)set to false. The "Default" pareameter is set to false, unless the optional second argument is true.

void setValue (bool value, bool isCreatedByGet=false)
 Set bool value.
void setValue (int value, bool isCreatedByGet=false)
 Set int value.
void setValue (double value, bool isCreatedByGet=false)
 Set double value.
void setValue (const char *value, bool isCreatedByGet=false)
 Set string value.
void setValue (const string &value, bool isCreatedByGet=false)
 Set string value.
void setValue (const Value &value, bool isCreatedByGet=false)
 Set Value value.
void setValue (const Vector &value, bool isCreatedByGet=false)
 Set Vector value.
Is functions.
Return true if the parameter is of the specified type; otherwise, return false. Has no affect on "Default" or "Used" status.

bool isBool () const
 Return true for bool entry.
bool isInt () const
 Return true for int entry.
bool isDouble () const
 Return true for double entry.
bool isString () const
 Return true for string entry.
bool isList () const
 Return true for list entry (i.e., a sublist).
bool isValue () const
 Return true for Value entry.
bool isVector () const
 Return true for Vector entry.
Get functions.
Returns the value of the Entry. Sets "Used" to true. Does not affect "Default" bit.

Note:
This will not thrown an error if the type of get does not match the type of Entry. Use with caution.


bool getBoolValue () const
 Get bool value.
int getIntValue () const
 Get int value.
double getDoubleValue () const
 Get double value.
const string & getStringValue () const
 Get string value.
const ValuegetValueValue () const
 Get Value value.
const VectorgetVectorValue () const
 Get Vector value.
Pack/Unpack
Used by parallel version of APPSPACK to pack and unpack parameter lists for message passing. Uses APPSPACK::GCI functionality.

Note:
Only works if MPI is enabled at configure time; see MPI Configure Options.


void pack () const
 Pack the Entry.
void unpack ()
 Unpack the Entry.
Printing
ostream & leftshift (ostream &stream) const
 Output the parameter to the given stream.

Private Types

enum  EntryType {
  APPSPACK_NONE, APPSPACK_BOOL, APPSPACK_INT, APPSPACK_DOUBLE,
  APPSPACK_STRING, APPSPACK_LIST, APPSPACK_VALUE, APPSPACK_VECTOR
}
 All possible parameter types that this class can store. More...

Private Member Functions

void reset ()
 Reset the entry.

Private Attributes

EntryType type
 Type of parameter stored in this object.
bool bval
 Boolean value, if this is of type BOOL.
int ival
 Integer value, if this is of type INT.
double dval
 Double value, if this is of type DOUBLE.
string sval
 String value, if this is of type STRING.
Listlval
 Pointer to list, if this is of type LIST.
Value valueval
 Value value.
Vector vectorval
 Vector value.
bool isGotten
 True if this parameter been accessed by a "get" function.
bool isSetByGet
 True if this parameter is a nominal value assigned by a "get" function.


Member Enumeration Documentation

enum APPSPACK::Parameter::Entry::EntryType [private]
 

All possible parameter types that this class can store.

Enumeration values:
APPSPACK_NONE  No entry type set yet (will be set later by setValue().
APPSPACK_BOOL  Boolean.
APPSPACK_INT  Integer.
APPSPACK_DOUBLE  Double.
APPSPACK_STRING  String.
APPSPACK_LIST  Sublist (APPSPACK::Parameter::List).
APPSPACK_VALUE  APPSPACK::Value.
APPSPACK_VECTOR  APPSPACK::Vector.
Definition at line 230 of file APPSPACK_Parameter_Entry.hpp.


Constructor & Destructor Documentation

Entry::Entry  ) 
 

Create an empty Entry that doesn't contain anything.

Definition at line 44 of file APPSPACK_Parameter_Entry.cpp.

Entry::Entry const Entry source  ) 
 

Copy constructor.

Definition at line 58 of file APPSPACK_Parameter_Entry.cpp.

References operator=().

Entry::Entry bool  value,
bool  isCreatedByGet = false
 

Create an Entry containing a bool.

Definition at line 100 of file APPSPACK_Parameter_Entry.cpp.

Entry::Entry int  value,
bool  isCreatedByGet = false
 

Create an Entry containing an int.

Definition at line 114 of file APPSPACK_Parameter_Entry.cpp.

Entry::Entry double  value,
bool  isCreatedByGet = false
 

Create an Entry containing a double.

Definition at line 128 of file APPSPACK_Parameter_Entry.cpp.

Entry::Entry const string &  value,
bool  isCreatedByGet = false
 

Create an Entry containing a string.

Definition at line 142 of file APPSPACK_Parameter_Entry.cpp.

Entry::Entry const Value value,
bool  isCreatedByGet = false
 

Create an Entry containing a Value.

Definition at line 156 of file APPSPACK_Parameter_Entry.cpp.

Entry::Entry const Vector value,
bool  isCreatedByGet = false
 

Create an Entry containing a Vector.

Definition at line 170 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK::Vector.

Entry::~Entry  ) 
 

Destructor.

Definition at line 184 of file APPSPACK_Parameter_Entry.cpp.

References reset().


Member Function Documentation

Entry & Entry::operator= const Entry source  ) 
 

Copy an entry.

Definition at line 73 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_LIST, bval, dval, isGotten, isSetByGet, ival, lval, reset(), sval, type, valueval, and vectorval.

Referenced by Entry().

APPSPACK::Parameter::List & Entry::setList bool  isCreatedByGet = false  ) 
 

Create a sublist. Sets "Default" according to the optional argument. Sets "Used" to false.

Definition at line 256 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_LIST, isGotten, isSetByGet, lval, reset(), and type.

APPSPACK::Parameter::List & Entry::getListValue  ) 
 

Extract the reference to the list that is stored in the Entry. Set "Used" to true.

Definition at line 326 of file APPSPACK_Parameter_Entry.cpp.

References isGotten, and lval.

Referenced by APPSPACK::Parameter::List::print(), and APPSPACK::Parameter::List::sublist().

const APPSPACK::Parameter::List & Entry::getListValue  )  const
 

Extract the reference to the list that is stored in the Entry. Set "Used" to true.

Definition at line 332 of file APPSPACK_Parameter_Entry.cpp.

References isGotten, and lval.

void Entry::setValue bool  value,
bool  isCreatedByGet = false
 

Set bool value.

Definition at line 200 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_BOOL, bval, isSetByGet, reset(), and type.

void Entry::setValue int  value,
bool  isCreatedByGet = false
 

Set int value.

Definition at line 208 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_INT, isSetByGet, ival, reset(), and type.

void Entry::setValue double  value,
bool  isCreatedByGet = false
 

Set double value.

Definition at line 216 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_DOUBLE, dval, isSetByGet, reset(), and type.

void Entry::setValue const char *  value,
bool  isCreatedByGet = false
 

Set string value.

Definition at line 224 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_STRING, isSetByGet, reset(), sval, and type.

void Entry::setValue const string &  value,
bool  isCreatedByGet = false
 

Set string value.

Definition at line 232 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_STRING, isSetByGet, reset(), sval, and type.

void Entry::setValue const Value value,
bool  isCreatedByGet = false
 

Set Value value.

Definition at line 240 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_VALUE, isSetByGet, reset(), type, and valueval.

void Entry::setValue const Vector value,
bool  isCreatedByGet = false
 

Set Vector value.

Definition at line 248 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_VECTOR, isSetByGet, reset(), type, APPSPACK::Vector, and vectorval.

bool Entry::isBool  )  const
 

Return true for bool entry.

Definition at line 267 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_BOOL, and type.

Referenced by APPSPACK::Parameter::List::getParameter(), APPSPACK::Parameter::List::isParameterBool(), and APPSPACK::Parameter::List::isParameterEqual().

bool Entry::isInt  )  const
 

Return true for int entry.

Definition at line 272 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_INT, and type.

Referenced by APPSPACK::Parameter::List::getParameter(), APPSPACK::Parameter::List::isParameterEqual(), and APPSPACK::Parameter::List::isParameterInt().

bool Entry::isDouble  )  const
 

Return true for double entry.

Definition at line 277 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_DOUBLE, and type.

Referenced by APPSPACK::Parameter::List::getDoubleParameter(), APPSPACK::Parameter::List::getParameter(), APPSPACK::Parameter::List::isParameterDouble(), and APPSPACK::Parameter::List::isParameterEqual().

bool Entry::isString  )  const
 

Return true for string entry.

Definition at line 282 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_STRING, and type.

Referenced by APPSPACK::Parameter::List::getParameter(), APPSPACK::Parameter::List::isParameterEqual(), and APPSPACK::Parameter::List::isParameterString().

bool Entry::isList  )  const
 

Return true for list entry (i.e., a sublist).

Definition at line 287 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_LIST, and type.

Referenced by APPSPACK::Parameter::List::isParameterSublist(), APPSPACK::Parameter::List::print(), and APPSPACK::Parameter::List::sublist().

bool Entry::isValue  )  const
 

Return true for Value entry.

Definition at line 292 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_VALUE, and type.

Referenced by APPSPACK::Parameter::List::getParameter(), APPSPACK::Parameter::List::getValueParameter(), APPSPACK::Parameter::List::isParameterEqual(), and APPSPACK::Parameter::List::isParameterValue().

bool Entry::isVector  )  const
 

Return true for Vector entry.

Definition at line 297 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_VECTOR, and type.

Referenced by APPSPACK::Parameter::List::getParameter(), APPSPACK::Parameter::List::getVectorParameter(), APPSPACK::Parameter::List::isParameterEqual(), and APPSPACK::Parameter::List::isParameterVector().

bool Entry::getBoolValue  )  const
 

Get bool value.

Definition at line 302 of file APPSPACK_Parameter_Entry.cpp.

References bval, and isGotten.

Referenced by APPSPACK::Parameter::List::getParameter(), and APPSPACK::Parameter::List::isParameterEqual().

int Entry::getIntValue  )  const
 

Get int value.

Definition at line 308 of file APPSPACK_Parameter_Entry.cpp.

References isGotten, and ival.

Referenced by APPSPACK::Parameter::List::getParameter(), and APPSPACK::Parameter::List::isParameterEqual().

double Entry::getDoubleValue  )  const
 

Get double value.

Definition at line 314 of file APPSPACK_Parameter_Entry.cpp.

References dval, and isGotten.

Referenced by APPSPACK::Parameter::List::getDoubleParameter(), APPSPACK::Parameter::List::getParameter(), and APPSPACK::Parameter::List::isParameterEqual().

const string & Entry::getStringValue  )  const
 

Get string value.

Definition at line 320 of file APPSPACK_Parameter_Entry.cpp.

References isGotten, and sval.

Referenced by APPSPACK::Parameter::List::getParameter(), and APPSPACK::Parameter::List::isParameterEqual().

const APPSPACK::Value & Entry::getValueValue  )  const
 

Get Value value.

Definition at line 338 of file APPSPACK_Parameter_Entry.cpp.

References isGotten, and valueval.

Referenced by APPSPACK::Parameter::List::getParameter(), APPSPACK::Parameter::List::getValueParameter(), and APPSPACK::Parameter::List::isParameterEqual().

const APPSPACK::Vector & Entry::getVectorValue  )  const
 

Get Vector value.

Definition at line 344 of file APPSPACK_Parameter_Entry.cpp.

References isGotten, APPSPACK::Vector, and vectorval.

Referenced by APPSPACK::Parameter::List::getParameter(), APPSPACK::Parameter::List::getVectorParameter(), and APPSPACK::Parameter::List::isParameterEqual().

void Entry::pack  )  const
 

Pack the Entry.

Definition at line 388 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_BOOL, APPSPACK_DOUBLE, APPSPACK_INT, APPSPACK_LIST, APPSPACK_STRING, APPSPACK_VALUE, APPSPACK_VECTOR, bval, dval, APPSPACK::Value::getIsValue(), APPSPACK::Value::getValue(), isGotten, isSetByGet, ival, lval, APPSPACK::Parameter::List::pack(), APPSPACK::GCI::pack(), sval, type, valueval, and vectorval.

Referenced by APPSPACK::Parameter::List::pack().

void Entry::unpack  ) 
 

Unpack the Entry.

Definition at line 434 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_BOOL, APPSPACK_DOUBLE, APPSPACK_INT, APPSPACK_LIST, APPSPACK_STRING, APPSPACK_VALUE, APPSPACK_VECTOR, bval, dval, isGotten, isSetByGet, ival, lval, APPSPACK::Value::setValueTo(), sval, type, APPSPACK::Parameter::List::unpack(), APPSPACK::GCI::unpack(), valueval, and vectorval.

ostream & Entry::leftshift ostream &  stream  )  const
 

Output the parameter to the given stream.

Formats the output as "<type,value>", except in the case of a list which just outputs "\<sublist\>". If the parameter has not yet been set, it outputs "\<NONE\>". This is the function called by the ostream operator<<. Definition at line 350 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_BOOL, APPSPACK_DOUBLE, APPSPACK_INT, APPSPACK_LIST, APPSPACK_STRING, APPSPACK_VALUE, APPSPACK_VECTOR, bval, dval, isGotten, isSetByGet, ival, sval, type, valueval, and vectorval.

void Entry::reset  )  [private]
 

Reset the entry.

Definition at line 189 of file APPSPACK_Parameter_Entry.cpp.

References APPSPACK_NONE, isGotten, isSetByGet, lval, and type.

Referenced by operator=(), setList(), setValue(), and ~Entry().


Member Data Documentation

EntryType APPSPACK::Parameter::Entry::type [private]
 

Type of parameter stored in this object.

Definition at line 250 of file APPSPACK_Parameter_Entry.hpp.

Referenced by isBool(), isDouble(), isInt(), isList(), isString(), isValue(), isVector(), leftshift(), operator=(), pack(), reset(), setList(), setValue(), and unpack().

bool APPSPACK::Parameter::Entry::bval [private]
 

Boolean value, if this is of type BOOL.

Definition at line 253 of file APPSPACK_Parameter_Entry.hpp.

Referenced by getBoolValue(), leftshift(), operator=(), pack(), setValue(), and unpack().

int APPSPACK::Parameter::Entry::ival [private]
 

Integer value, if this is of type INT.

Definition at line 256 of file APPSPACK_Parameter_Entry.hpp.

Referenced by getIntValue(), leftshift(), operator=(), pack(), setValue(), and unpack().

double APPSPACK::Parameter::Entry::dval [private]
 

Double value, if this is of type DOUBLE.

Definition at line 259 of file APPSPACK_Parameter_Entry.hpp.

Referenced by getDoubleValue(), leftshift(), operator=(), pack(), setValue(), and unpack().

string APPSPACK::Parameter::Entry::sval [private]
 

String value, if this is of type STRING.

Definition at line 262 of file APPSPACK_Parameter_Entry.hpp.

Referenced by getStringValue(), leftshift(), operator=(), pack(), setValue(), and unpack().

List* APPSPACK::Parameter::Entry::lval [private]
 

Pointer to list, if this is of type LIST.

Definition at line 265 of file APPSPACK_Parameter_Entry.hpp.

Referenced by getListValue(), operator=(), pack(), reset(), setList(), and unpack().

Value APPSPACK::Parameter::Entry::valueval [private]
 

Value value.

Definition at line 268 of file APPSPACK_Parameter_Entry.hpp.

Referenced by getValueValue(), leftshift(), operator=(), pack(), setValue(), and unpack().

Vector APPSPACK::Parameter::Entry::vectorval [private]
 

Vector value.

Definition at line 271 of file APPSPACK_Parameter_Entry.hpp.

Referenced by getVectorValue(), leftshift(), operator=(), pack(), setValue(), and unpack().

bool APPSPACK::Parameter::Entry::isGotten [mutable, private]
 

True if this parameter been accessed by a "get" function.

Definition at line 274 of file APPSPACK_Parameter_Entry.hpp.

Referenced by getBoolValue(), getDoubleValue(), getIntValue(), getListValue(), getStringValue(), getValueValue(), getVectorValue(), leftshift(), operator=(), pack(), reset(), setList(), and unpack().

bool APPSPACK::Parameter::Entry::isSetByGet [mutable, private]
 

True if this parameter is a nominal value assigned by a "get" function.

Definition at line 277 of file APPSPACK_Parameter_Entry.hpp.

Referenced by leftshift(), operator=(), pack(), reset(), setList(), setValue(), and unpack().


The documentation for this class was generated from the following files:

 

© Sandia Corporation | Site Contact | Privacy and Security

Generated on Wed Dec 14 18:41:05 2005 for APPSPACK 4.0.2 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2002