CMS 3D CMS Logo

PixelConfigBase.h
Go to the documentation of this file.
1 #ifndef PixelConfigBase_h
2 #define PixelConfigBase_h
3 
9 //
10 // Base class for pixel configuration data
11 // provide a place to implement common interfaces
12 // for these objects. Any configuration data
13 // object that is to be accessed from the database
14 // should derive from this class.
15 //
16 
17 #include <string>
20 
21 namespace pos {
33  public:
34  //A few things that you should provide
35  //description : purpose of this object
36  //creator : who created this configuration object
37  //date : time/date of creation (should probably not be
38  // a string, but I have no idea what CMS uses.
40 
41  virtual ~PixelConfigBase() {}
42 
45  std::string date();
46 
47  //Interface to write out data to ascii file
48  virtual void writeASCII(std::string dir = "") const = 0;
49  //Interface to write out data to XML file for DB population
51  int version,
53  std::ofstream *out,
54  std::ofstream *out1,
55  std::ofstream *out2) const {
56  ;
57  }
58  virtual void writeXML(std::ofstream *out, std::ofstream *out1, std::ofstream *out2) const { ; }
59  virtual void writeXMLTrailer(std::ofstream *out, std::ofstream *ou1, std::ofstream *out2) const { ; }
60  virtual void writeXML(pos::PixelConfigKey key, int version, std::string path) const { ; }
61  virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const { ; }
62  virtual void writeXML(std::ofstream *out) const {
63  std::cout << __LINE__ << " " << __PRETTY_FUNCTION__ << "\tUnimplemented method" << std::endl;
64  ;
65  }
66  virtual void writeXMLTrailer(std::ofstream *out) const { ; }
67 
68  void setAuthor(std::string author) { creator_ = author; }
69  void setComment(std::string comment) { comment_ = comment; }
70  std::string getAuthor() const { return creator_; }
71  std::string getComment() const { return base64_encode((unsigned char *)comment_.c_str(), comment_.length()); }
72 
73  private:
78  };
79 
80  /* @} */
81 } // namespace pos
82 
83 #endif
This file contains the base class for "pixel configuration data" management.
void setAuthor(std::string author)
std::string description()
virtual void writeXML(pos::PixelConfigKey key, int version, std::string path) const
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
std::string getComment() const
std::string base64_encode(unsigned char const *, unsigned int len)
Definition: PixelBase64.cc:38
virtual void writeXMLTrailer(std::ofstream *out, std::ofstream *ou1, std::ofstream *out2) const
void setComment(std::string comment)
virtual void writeXML(std::ofstream *out) const
This class implements..
std::string date()
virtual void writeXMLTrailer(std::ofstream *out) const
This class implements the configuration key which actually just is an integer.
virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out, std::ofstream *out1, std::ofstream *out2) const
std::string creator()
virtual void writeXML(std::ofstream *out, std::ofstream *out1, std::ofstream *out2) const
virtual void writeASCII(std::string dir="") const =0
std::string getAuthor() const
PixelConfigBase(std::string description, std::string creator, std::string date)
std::string description_