OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Trace.h
Go to the documentation of this file.
1 #ifndef __TRACE_H__
2 #define __TRACE_H__
3 
4 #include <string>
5 #include <sstream>
6 #include <vector>
7 #include <map>
8 
9 #include "boost/smart_ptr.hpp"
10 
12 
13 class Trace {
14 
15 public:
16 
17  Trace(std::string name)
18  : name_(name)
19  {}
20 
22  {}
23 
24  void registerComponent(std::string name,
25  boost::shared_ptr<TraceComponent> component) {
26  nameToIdx_.insert(
27  std::pair<std::string, size_t>(name, pipeline_.size()));
28  pipeline_.push_back(component);
29  }
30 
31  void unregisterComponent(std::string name) {
32  //TODO: set null @ idx
33  }
34 
35  void log(std::ostringstream &dump) {
36  for(boost::shared_ptr<TraceComponent> component : pipeline_) {
37  component->execute(dump);
38  }
39  }
40 
41 private:
42 
43  std::string name_;
44 
45  std::vector< boost::shared_ptr<TraceComponent> > pipeline_;
46  std::map< std::string, size_t > nameToIdx_;
47 
48 };
49 
50 #endif
~Trace()
Definition: Trace.h:21
std::vector< boost::shared_ptr< TraceComponent > > pipeline_
Definition: Trace.h:45
void registerComponent(std::string name, boost::shared_ptr< TraceComponent > component)
Definition: Trace.h:24
void log(std::ostringstream &dump)
Definition: Trace.h:35
Definition: Trace.h:13
Trace(std::string name)
Definition: Trace.h:17
std::string name_
Definition: Trace.h:43
std::map< std::string, size_t > nameToIdx_
Definition: Trace.h:46
const std::string name
void unregisterComponent(std::string name)
Definition: Trace.h:31