00001 // $Id: PXXVDecoder.h 7166 2005-05-02 05:09:28Z hoshina $ 00002 #ifndef __PXXVDecoder__H__ 00003 #define __PXXVDecoder__H__ 00004 00013 00014 #include "payloads-unpacker/base/PXXObject.h" 00015 #include <string> 00016 00017 class PXXVDecoder; 00018 00019 #ifdef __USEROOT__ // compile with ROOT 00020 typedef PXXVDecoder* PXXVDecoderPtr; 00021 #else // compile with IceTray 00022 typedef shared_ptr<PXXVDecoder> PXXVDecoderPtr; 00023 #endif 00024 00025 class PXXVDecoder : public PXXObject { 00026 00027 public: 00028 00029 SET_LOGGER("PXXVDecoder"); 00030 00034 virtual ~PXXVDecoder(); 00035 //------------------------------------------------------------------------------ 00036 00040 static PXXVDecoderPtr GetDecoderPtr() { return fDecoderPtr_; } 00041 //------------------------------------------------------------------------------ 00042 00047 static void OnByteSwap () { fIsByteSwapOn_ = true; } 00048 static void OffByteSwap() { fIsByteSwapOn_ = false; } 00049 static Bool8b_t IsByteSwapOn() { return fIsByteSwapOn_; } 00050 //------------------------------------------------------------------------------ 00051 00055 static void SwitchByteSwap(){fIsByteSwapOn_ = (fIsByteSwapOn_ ? false : true);} 00056 //------------------------------------------------------------------------------ 00057 00062 virtual void Initialize() = 0; 00063 //------------------------------------------------------------------------------ 00064 00068 virtual void Dispose() = 0; 00069 //------------------------------------------------------------------------------ 00070 00077 virtual Int32b_t ReadBoolean(Bool8b_t &b) = 0; 00078 //------------------------------------------------------------------------------ 00079 00086 virtual Int32b_t ReadByte(Char8b_t &c) = 0; 00087 //------------------------------------------------------------------------------ 00088 00099 virtual Int32b_t SkipBytes(Int32b_t n) = 0; 00100 //------------------------------------------------------------------------------ 00101 00106 virtual Int32b_t ReadShort(Short16b_t &s) = 0; 00107 //------------------------------------------------------------------------------ 00108 00113 virtual Int32b_t ReadInt(Int32b_t &i) = 0; 00114 //------------------------------------------------------------------------------ 00115 00120 virtual Int32b_t ReadFloat(Float32b_t &f) = 0; 00121 //------------------------------------------------------------------------------ 00122 00127 virtual Int32b_t ReadLong(Long64b_t &l) = 0; 00128 //------------------------------------------------------------------------------ 00129 00134 virtual Int32b_t ReadDouble(Double64b_t &d) = 0; 00135 //------------------------------------------------------------------------------ 00136 00142 virtual void ActivateTheDecoder(); 00143 //------------------------------------------------------------------------------ 00144 00148 virtual std::string GetDecoderName() const { return GetTypeName(); } 00149 //------------------------------------------------------------------------------ 00150 00151 protected: 00152 00156 PXXVDecoder(); 00157 //------------------------------------------------------------------------------ 00158 00159 private: 00160 00161 static PXXVDecoderPtr fDecoderPtr_ ; // pointer to current decoder 00162 static Bool8b_t fIsByteSwapOn_; // byte swap switch 00163 00164 ClassDef(PXXVDecoder, 0) // abstract base class for decoder 00165 00166 }; 00167 00168 #endif