CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/DataFormats/SiStripCommon/interface/SiStripKey.h

Go to the documentation of this file.
00001 // Last commit: $Id: SiStripKey.h,v 1.6 2008/02/06 14:32:48 bainbrid Exp $
00002 
00003 #ifndef DataFormats_SiStripCommon_SiStripKey_H
00004 #define DataFormats_SiStripCommon_SiStripKey_H
00005 
00006 #include "DataFormats/SiStripCommon/interface/ConstantsForGranularity.h"
00007 #include <boost/cstdint.hpp>
00008 #include <ostream>
00009 #include <sstream>
00010 #include <string>
00011 
00012 class SiStripKey;
00013 
00015 std::ostream& operator<< ( std::ostream&, const SiStripKey& );
00016 
00024 class SiStripKey {
00025   
00026  public:
00027   
00028   // ---------- Constructors ----------
00029   
00031   SiStripKey( const uint32_t& key );
00032   
00034   SiStripKey( const std::string& directory_path );
00035   
00037   SiStripKey( const SiStripKey& );
00038 
00040   const SiStripKey& operator=( const SiStripKey& );
00041   
00043   SiStripKey();
00044 
00046   virtual ~SiStripKey() {;}
00047   
00048   // ---------- Public interface to member data ----------
00049   
00051   inline const uint32_t& key() const;
00052 
00054   inline const std::string& path() const;
00055 
00057   inline const sistrip::Granularity& granularity() const;
00058 
00060   inline const uint16_t& channel() const;
00061 
00062   // ---------- Virtual utility methods ---------- 
00063   
00065   virtual bool isEqual( const SiStripKey& ) const;
00066   
00068   virtual bool isConsistent( const SiStripKey& ) const;
00069 
00071   virtual bool isValid() const;
00072   
00075   virtual bool isValid( const sistrip::Granularity& ) const;
00076   
00078   virtual bool isInvalid() const;
00079 
00082   virtual bool isInvalid( const sistrip::Granularity& ) const;
00083 
00084   // ---------- Print methods ----------
00085 
00087   virtual void print( std::stringstream& ss ) const;
00088   
00090   virtual void terse( std::stringstream& ss ) const {;}
00091   
00092  protected: 
00093 
00094   // ---------- Protected methods ----------
00095 
00096   virtual void initFromValue() {;}
00097   virtual void initFromKey() {;}
00098   virtual void initFromPath() {;}
00099   virtual void initGranularity() {;}
00100   
00101   inline void key( const uint32_t& );
00102   inline void path( const std::string& );
00103   inline void granularity( const sistrip::Granularity& );
00104   inline void channel( const uint16_t& );
00105 
00106  private: 
00107   
00108   // ---------- Private member data ----------
00109   
00111   uint32_t key_; 
00112 
00114   std::string path_;
00115 
00117   sistrip::Granularity granularity_;
00118 
00120   uint16_t channel_;
00121   
00122 };
00123 
00124 // ---------- Inline methods ----------
00125 
00126 const uint32_t& SiStripKey::key() const { return key_; }
00127 const std::string& SiStripKey::path() const { return path_; }
00128 const sistrip::Granularity& SiStripKey::granularity() const { return granularity_; }
00129 const uint16_t& SiStripKey::channel() const { return channel_; }
00130 
00131 void SiStripKey::key( const uint32_t& key ) { key_ = key; }
00132 void SiStripKey::path( const std::string& path ) { path_ = path; }
00133 void SiStripKey::granularity( const sistrip::Granularity& gran ) { granularity_ = gran; }
00134 void SiStripKey::channel( const uint16_t& chan ) { channel_ = chan; }
00135 
00136 #endif // DataFormats_SiStripCommon_SiStripKey_H
00137 
00138