AMROC Main     Blockstructured Adaptive Mesh Refinement in object-oriented C++


Main Page   Class Hierarchy   Compound List   File List  

read-parameters.h

Go to the documentation of this file.
00001 #ifndef NMWR_GB_READ_PARAMETERS_H
00002 #define NMWR_GB_READ_PARAMETERS_H
00003 
00049 #include "stl_CompConf.h"
00050 #include "string_CompConf.h"
00051 
00052 #include "IO/mutator.h"
00053 
00054 // this is basically a dictionary that maps strings
00055 // to placeholders for a variable reference.
00056 // pointers to the abstract base class are used in order to profit
00057 // from polymorphism (derived classes are automatically
00058 // generated via templates in class TypedMutator).
00059 
00060 class string_table_1;
00061 class string_list;
00062 class Mutator;
00063 
00064 class MutableVars {
00065 private:
00066   //  typedef map<string, Mutator*, less<string> > table_type;
00067   //table_type table;
00068   typedef string_table_1 table_type;
00069   table_type * table;
00070   string_list* unrecognized;
00071 public:
00072   MutableVars();
00073   ~MutableVars();
00074 
00075   void AddVariable(const string& name, Mutator* m);
00076   void AddVariable(const char*   name, Mutator* m);
00077   void ReadVariable(istream& is);
00078   void ReadValues(istream& in);
00079   void PrintValues(ostream& out,
00080                    const string& prefix = "",
00081                    const string& sep = " ") const;
00082   bool HasUnrecognized() const;
00083   void PrintUnrecognized(ostream& out) const;
00084 };
00085 
00086 // this function is necessary, because MutableVars::AddVariable
00087 // (as a member function) is not (yet) allowed to be a template function
00088 
00089 template<class T> 
00090 inline void AddVar(MutableVars& MV, const string& name, T& v)
00091 { MV.AddVariable(name,GetMutator(v));}
00092 
00093 
00094 template<class T> 
00095 inline void AddVar(MutableVars& MV, const char* name, T& v)
00096 { AddVar(MV,string(name),v);}
00097 
00098 
00099 #endif


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



AMROC Main      Home      Contact
last update: 06/01/04