CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/CalibFormats/SiPixelObjects/interface/PixelConfigBase.h

Go to the documentation of this file.
00001 #ifndef PixelConfigBase_h
00002 #define PixelConfigBase_h
00003 
00009 //
00010 // Base class for pixel configuration data
00011 // provide a place to implement common interfaces
00012 // for these objects. Any configuration data
00013 // object that is to be accessed from the database
00014 // should derive from this class.
00015 //
00016 
00017 #include <string>
00018 #include "CalibFormats/SiPixelObjects/interface/PixelConfigKey.h"
00019 #include "CalibFormats/SiPixelObjects/interface/PixelBase64.h"
00020 
00021 
00022 namespace pos{
00033   class PixelConfigBase {
00034 
00035   public:
00036 
00037     //A few things that you should provide
00038     //description : purpose of this object
00039     //creator : who created this configuration object
00040     //date : time/date of creation (should probably not be
00041     //       a string, but I have no idea what CMS uses.
00042     PixelConfigBase(std::string description,
00043                     std::string creator,
00044                     std::string date);
00045 
00046     virtual ~PixelConfigBase(){}
00047 
00048     std::string description();
00049     std::string creator();
00050     std::string date();
00051 
00052     //Interface to write out data to ascii file
00053     virtual void writeASCII(std::string dir="") const = 0;
00054     //Interface to write out data to XML file for DB population
00055     virtual void writeXMLHeader(  pos::PixelConfigKey key, 
00056                                   int version, 
00057                                   std::string path, 
00058                                   std::ofstream *out,
00059                                   std::ofstream *out1,
00060                                   std::ofstream *out2)  const {;}
00061     virtual void writeXML(        std::ofstream *out,
00062                                   std::ofstream *out1,
00063                                   std::ofstream *out2 ) const {;}
00064     virtual void writeXMLTrailer( std::ofstream *out,
00065                                   std::ofstream *ou1, 
00066                                   std::ofstream *out2)  const {;}
00067     virtual void writeXML(      pos::PixelConfigKey key, int version, std::string path)                     const {;}
00068     virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const {;}
00069     virtual void writeXML(                                                              std::ofstream *out) const {;}
00070     virtual void writeXMLTrailer(                                                       std::ofstream *out) const {;}
00071 
00072     void setAuthor (std::string author)  {creator_ = author ;} 
00073     void setComment(std::string comment) {comment_ = comment;} 
00074     std::string getAuthor()const         {return creator_   ;}
00075     std::string getComment()const        {return base64_encode((unsigned char *)comment_.c_str(), comment_.length()) ;}
00076     
00077   private:
00078 
00079     std::string description_;
00080     std::string creator_ ;
00081     std::string date_    ;
00082     std::string comment_ ;
00083 
00084   };
00085 
00086 /* @} */
00087 }
00088 
00089 #endif