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


Main Page   Class Hierarchy   Compound List   File List  

istream-control-device.h

Go to the documentation of this file.
00001 #ifndef NMWR_GB_ISTREAM_CONTROL_DEVICE_H
00002 #define NMWR_GB_ISTREAM_CONTROL_DEVICE_H
00003 
00004 
00010 #include <iostream.h>
00011 #include "string_CompConf.h"
00012 #include "IO/control-device.h"
00013 #include "IO/read-parameters.h"
00014 
00015 class istream_control_device_impl : public control_device_impl {
00016   typedef istream_control_device_impl self;
00017 public:
00018   istream_control_device_impl(istream* i, const string& nm, const string& ind = "")
00019     : in(i), name_(nm), indent_(ind) {}
00020 
00021   istream_control_device_impl* get_sub_device(const string& nm) 
00022     { return new istream_control_device_impl(in,nm, indent_+" "); }
00023 
00024   virtual string name() const { return name_ ;}
00025 
00026   virtual void update()        {  MV.ReadValues(*in);}
00027   
00028   virtual void add(const string& name,Mutator* value) 
00029     { MV.AddVariable(name,value);}
00030 
00031   virtual void register_at(ControlDevice& Ctrl) { register_at(Ctrl,"");}
00032   virtual void register_at(ControlDevice& Ctrl, const string& prefix) {
00033     Ctrl.add( (prefix == "" ? prefix : prefix + "-") +name(), 
00034               GetMutator(*this));
00035   }
00036 
00037   virtual void attach_to(istream& in_new) { in = &in_new;}
00038   virtual void print_values(ostream& out) const { MV.PrintValues(out);}
00039   virtual void print_values(ostream& out, const string& ind) const 
00040     { MV.PrintValues(out, ind, " ");}
00041 
00042   virtual void read(istream& in);
00043   virtual void print(ostream& out) const;
00044   virtual void print_unrecognized(ostream& out) const;
00045 
00046   friend istream& operator>>(istream& in,  self& rhs) 
00047     { rhs.read(in);   return in;}
00048   friend ostream& operator<<(ostream& out, const self& rhs) 
00049     { rhs.print(out); return out;}
00050 
00051 protected:
00052  istream* in;
00053  string name_;
00054  string indent_;
00055  MutableVars MV;
00056 };
00057 
00058 
00059 
00060 #endif


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



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