Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SAMRAI::tbox::InputManager Class Reference

#include <source/toolbox/inputdb/InputManager.h>

List of all members.

Public Member Functions

virtual Pointer< InputDatabaseparseInputFile (const string &filename)
virtual void parseInputFile (const string &filename, Pointer< InputDatabase > db)

Static Public Member Functions

static InputManagergetManager ()
static void setManager (InputManager *manager)
static void freeManager ()
static bool inputDatabaseExists ()
static Pointer< DatabasegetInputDatabase ()

Protected Member Functions

 InputManager ()
virtual ~InputManager ()


Detailed Description

Class InputManager parses an input file and returns the associated database. This manager class hides the complexity of opening the input file, creating the parser, and populating the database with values. The input manager is simple enough that it did not need to be implemented as a singleton class; however, it was implemented as a singleton to be consistent with the restart manager class.

All processors must call the parsing routines. Any errors are reported to pout and will result in termination of the program.

The input file will generally have the following format. For each object that requires user specified input, an entry of the following format should be included in the input file.

 * Object_entry {
 *    keyword1 = <value1>     // maybe some end line comments
 *    keyword2 = <value2>
 *    nested_input_keyword {
 *       nested_data_keyword1 = <value1> 
 *    }
 *     \ldots
 * }
 * 

For convenience, the input parser also supports C/C++ style comments, "include" files, and some expression evaluation.


Constructor & Destructor Documentation

SAMRAI::tbox::InputManager::InputManager  )  [protected]
 

The constructor is protected, since only subclasses of the singleton may access the constructor. Others may not explicitly create a singleton class.

SAMRAI::tbox::InputManager::~InputManager  )  [protected, virtual]
 

The destructor for the input manager is protected, since only the singleton class and subclasses may destroy the manager objects.


Member Function Documentation

InputManager * SAMRAI::tbox::InputManager::getManager  )  [static]
 

Return a pointer to the single instance of the input manager. All access to the input manager object is through getManager().

void SAMRAI::tbox::InputManager::setManager InputManager manager  )  [static]
 

Set a new input manager. This routine can only be used by subclasses since the constructor and destructor are protected. The manager object will be deleted at program exit.

void SAMRAI::tbox::InputManager::freeManager  )  [static]
 

Deallocate the input manager instance. It is not necessary to call this routine at program termination, since it is automatically called by the SAMRAI shutdown routines.

bool SAMRAI::tbox::InputManager::inputDatabaseExists  )  [static]
 

Return whether or not the manager has read an input database. If so, it returns true. If not, false.

Pointer< Database > SAMRAI::tbox::InputManager::getInputDatabase  )  [static]
 

Accessor method for the root input database held by InputManager. Inputs are read from the input file and held in this database. This method returns a pointer to the database, allowing any class in SAMRAI to access the information inside it using standard database calls. For example, the following could appear in a SAMRAI class:

// get root database Pointer<Database> root_db = InputManager::getManager()->getInputDatabase(); // get class's sub-database Pointer<Database> class_db = root_db->getDatabase("MyClass"); // get parameter(s) from sub-database int dummy = class_db->getInteger("dummy");

where "dummy" was supplied in "MyClass" entry of the input file:

MyClass { dummy = ... }

This function is intended for SAMRAI classes in which there is no easy or efficient way to supply input parameters.

Pointer< InputDatabase > SAMRAI::tbox::InputManager::parseInputFile const string &  filename  )  [virtual]
 

Create a new database named "main" from the specified input file.

void SAMRAI::tbox::InputManager::parseInputFile const string &  filename,
Pointer< InputDatabase db
[virtual]
 

Parse data from the specified file into the existing database.


The documentation for this class was generated from the following files:
Generated on Fri Dec 2 11:33:19 2005 for SAMRAI by  doxygen 1.4.2