InterVary.hpp

Go to the documentation of this file.
00001 
00016 #ifndef InterVary_H
00017 #define InterVary_H
00018 
00019 #include <OpenAnalysis/Activity/VaryStandard.hpp>
00020 #include <map>
00021 
00022 namespace OA {
00023   namespace Activity {
00024 
00025 class InterVary {
00026   public:
00027     InterVary() { mNumIter = 0;}
00028     virtual ~InterVary() {}
00029 
00031     OA_ptr<Activity::VaryStandard> getVaryResults(ProcHandle proc)
00032       { if (mProcToVaryMap[proc].ptrEqual(0)) {
00033           OA_ptr<VaryStandard> empty;
00034           empty = new VaryStandard(proc);
00035           mProcToVaryMap[proc] = empty;
00036         }
00037         return mProcToVaryMap[proc];
00038       }
00039 
00041     int getNumIter() { return mNumIter; }
00042 
00043     //*****************************************************************
00044     // Output
00045     //*****************************************************************
00047     void dump(std::ostream& os, OA_ptr<IRHandlesIRInterface> ir)
00048       {
00049         os << "====================== InterVary" << std::endl;
00050         std::map<ProcHandle,OA_ptr<VaryStandard> >::iterator mapIter;
00051         for (mapIter=mProcToVaryMap.begin();
00052              mapIter!=mProcToVaryMap.end();
00053              mapIter++) 
00054         {
00055             OA_ptr<VaryStandard> results = mapIter->second;
00056             results->dump(os,ir);
00057             os << "-------------------------------" << std::endl;
00058         }
00059         os << "\nInterVary Number of Iterations = " << mNumIter
00060            << "\n\n====================== End InterVary\n\n";
00061       }
00062 
00063     
00064     //*****************************************************************
00065     // Construction methods 
00066     //*****************************************************************
00067 
00069     void mapProcToVary(ProcHandle proc, OA_ptr<VaryStandard> vary)
00070       { mProcToVaryMap[proc] = vary; }
00071 
00073     void setNumIter(int n) { mNumIter = n; }
00074 
00075   private:
00076     std::map<ProcHandle,OA_ptr<VaryStandard> > mProcToVaryMap;
00077     int mNumIter;
00078 
00079 };
00080 
00081   } // end of Activity namespace
00082 } // end of OA namespace
00083 
00084 #endif
00085