OpenADFortTk (including Open64 and OpenAnalysis references)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
InterUseful.hpp
Go to the documentation of this file.
1 
16 #ifndef InterUseful_H
17 #define InterUseful_H
18 
21 #include <map>
22 
23 namespace OA {
24  namespace Activity {
25 
26  class InterUseful : public virtual Annotation {
27  public:
28  InterUseful() { mNumIter = 0; }
29  virtual ~InterUseful() {}
30 
33  { if (mProcToUsefulMap[proc].ptrEqual(0)) {
35  empty = new UsefulStandard(proc);
36  mProcToUsefulMap[proc] = empty;
37  }
38  return mProcToUsefulMap[proc];
39  }
40 
42  int getNumIter() { return mNumIter; }
43 
44  //*****************************************************************
45  // Output
46  //*****************************************************************
48  void dump(std::ostream& os, OA_ptr<IRHandlesIRInterface> ir)
49  {
50  os << "====================== InterUseful" << std::endl;
51  std::map<ProcHandle,OA_ptr<UsefulStandard> >::iterator mapIter;
52  for (mapIter=mProcToUsefulMap.begin();
53  mapIter!=mProcToUsefulMap.end();
54  mapIter++)
55  {
56  OA_ptr<UsefulStandard> results = mapIter->second;
57  results->dump(os,ir);
58  os << "-------------------------------" << std::endl;
59  }
60  os << "\nInterUseful Number of Iterations = " << mNumIter
61  << "\n\n====================== End InterUseful\n\n";
62  }
63 
64 
65 
66  //*****************************************************************
67  // Annotation Interface
68  //*****************************************************************
70 
71  sOutBuild->objStart("InterUseful"); {
72  sOutBuild->mapStart("mProcToUsefulMap","ProcHandle","UsefulStandard");
73  std::map<ProcHandle,OA_ptr<UsefulStandard> >::iterator mapIter;
74  for (mapIter=mProcToUsefulMap.begin();
75  mapIter!=mProcToUsefulMap.end();
76  mapIter++)
77  {
78  ProcHandle proc = mapIter->first;
79  OA_ptr<UsefulStandard> results = mapIter->second;
80 
81  sOutBuild->mapEntryStart(); {
82  sOutBuild->mapKeyStart(); {
83  sOutBuild->outputIRHandle(proc,ir);
84  } sOutBuild->mapKeyEnd();
85  sOutBuild->mapValueStart(); {
86  results->output(ir);
87  } sOutBuild->mapValueEnd();
88  } sOutBuild->mapEntryEnd();
89  }
90  sOutBuild->mapEnd("mProcToUsefulMap");
91  } sOutBuild->objEnd("InterUseful");
92 
93  }
94 
95  //*****************************************************************
96  // Construction methods
97  //*****************************************************************
98 
101  { mProcToUsefulMap[proc] = useful; }
102 
104  void setNumIter(int n) { mNumIter = n; }
105 
106  private:
107  std::map<ProcHandle,OA_ptr<UsefulStandard> > mProcToUsefulMap;
108  int mNumIter;
109 
110 
111 };
112 
113  } // end of Activity namespace
114 } // end of OA namespace
115 
116 #endif
117