CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PixelConfig.h
Go to the documentation of this file.
1 #ifndef PixelConfig_h
2 #define PixelConfig_h
3 
9 namespace pos{
15  class PixelConfig {
16 
17  public:
18 
19  void write(std::ofstream& out){
20  for (unsigned int i=0;i<versions_.size();i++){
21  out << versions_[i].first<<" "<<versions_[i].second<<std::endl;
22  }
23  }
24 
25  void add(std::string dir, unsigned int version){
26  std::pair<std::string,unsigned int> aPair(dir,version);
27  versions_.push_back(aPair);
28  }
29  //returns -1 if it can not find the dir.
30  int find(std::string dir, unsigned int &version){
31 // std::cout << "[pos::PixelConfig::find()] versions_.size() = " << versions_.size() << std::endl ;
32  for(unsigned int i=0;i<versions_.size();i++){
33 // std::cout << "Looking :"<<versions_[i].first
34 // <<" "<<versions_[i].second<<std::endl;
35  if (versions_[i].first==dir) {
36  version=versions_[i].second;
37  return 0;
38  }
39  }
40  return -1;
41  }
42 
43  //returns -1 if it can not find the dir.
44  int update(std::string dir, unsigned int &version, unsigned int newversion){
45  for(unsigned int i=0;i<versions_.size();i++){
46  //std::cout << "Looking :"<<versions_[i].first
47  // <<" "<<versions_[i].second<<std::endl;
48  if (versions_[i].first==dir) {
49  version=versions_[i].second;
50  versions_[i].second=newversion;
51  return 0;
52  }
53  }
54  return -1;
55  }
56 
57  std::vector<std::pair<std::string,unsigned int> > versions(){
58  return versions_;
59  }
60 
61  private:
62 
63  std::vector<std::pair<std::string,unsigned int> > versions_;
64 
65  };
66 }
67 #endif
int i
Definition: DBlmapReader.cc:9
std::vector< std::pair< std::string, unsigned int > > versions()
Definition: PixelConfig.h:57
std::vector< std::pair< std::string, unsigned int > > versions_
Definition: PixelConfig.h:63
void add(std::string dir, unsigned int version)
Definition: PixelConfig.h:25
int find(std::string dir, unsigned int &version)
Definition: PixelConfig.h:30
void write(std::ofstream &out)
Definition: PixelConfig.h:19
int update(std::string dir, unsigned int &version, unsigned int newversion)
Definition: PixelConfig.h:44
bool first
Definition: L1TdeRCT.cc:94
tuple out
Definition: dbtoconf.py:99
dbl *** dir
Definition: mlp_gen.cc:35
This class implements..
Definition: PixelConfig.h:15