Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:21

0001 #ifndef PixelConfigBase_h
0002 #define PixelConfigBase_h
0003 /*! \file CalibFormats/SiPixelObjects/interface/PixelConfigBase.h
0004 *   \brief This file contains the base class for "pixel configuration data" 
0005 *          management
0006 *
0007 *   A longer explanation will be placed here later
0008 */
0009 //
0010 // Base class for pixel configuration data
0011 // provide a place to implement common interfaces
0012 // for these objects. Any configuration data
0013 // object that is to be accessed from the database
0014 // should derive from this class.
0015 //
0016 
0017 #include <string>
0018 #include "CalibFormats/SiPixelObjects/interface/PixelConfigKey.h"
0019 #include "CalibFormats/SiPixelObjects/interface/PixelBase64.h"
0020 
0021 namespace pos {
0022   /*!  \ingroup ConfigurationObjects "Configuration Objects"
0023 *    
0024 *  @{
0025 *
0026 *   \class PixelConfigBase PixelConfigBase.h "interface/PixelConfigBase.h"
0027 *   \brief This file contains the base class for "pixel configuration data" 
0028 *          management
0029 *
0030 *   A longer explanation will be placed here later
0031 */
0032   class PixelConfigBase {
0033   public:
0034     //A few things that you should provide
0035     //description : purpose of this object
0036     //creator : who created this configuration object
0037     //date : time/date of creation (should probably not be
0038     //       a string, but I have no idea what CMS uses.
0039     PixelConfigBase(std::string description, std::string creator, std::string date);
0040 
0041     virtual ~PixelConfigBase() {}
0042 
0043     std::string description();
0044     std::string creator();
0045     std::string date();
0046 
0047     //Interface to write out data to ascii file
0048     virtual void writeASCII(std::string dir = "") const = 0;
0049     //Interface to write out data to XML file for DB population
0050     virtual void writeXMLHeader(pos::PixelConfigKey key,
0051                                 int version,
0052                                 std::string path,
0053                                 std::ofstream *out,
0054                                 std::ofstream *out1,
0055                                 std::ofstream *out2) const {
0056       ;
0057     }
0058     virtual void writeXML(std::ofstream *out, std::ofstream *out1, std::ofstream *out2) const { ; }
0059     virtual void writeXMLTrailer(std::ofstream *out, std::ofstream *ou1, std::ofstream *out2) const { ; }
0060     virtual void writeXML(pos::PixelConfigKey key, int version, std::string path) const { ; }
0061     virtual void writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const { ; }
0062     virtual void writeXML(std::ofstream *out) const {
0063       std::cout << __LINE__ << " " << __PRETTY_FUNCTION__ << "\tUnimplemented method" << std::endl;
0064       ;
0065     }
0066     virtual void writeXMLTrailer(std::ofstream *out) const { ; }
0067 
0068     void setAuthor(std::string author) { creator_ = author; }
0069     void setComment(std::string comment) { comment_ = comment; }
0070     std::string getAuthor() const { return creator_; }
0071     std::string getComment() const { return base64_encode((unsigned char *)comment_.c_str(), comment_.length()); }
0072 
0073   private:
0074     std::string description_;
0075     std::string creator_;
0076     std::string date_;
0077     std::string comment_;
0078   };
0079 
0080   /* @} */
0081 }  // namespace pos
0082 
0083 #endif