00001 // $Id: PXXNativeDecoder.h 7166 2005-05-02 05:09:28Z hoshina $ 00002 #ifndef __PXXNativeDecoder__H__ 00003 #define __PXXNativeDecoder__H__ 00004 00012 00013 #include <stdio.h> 00014 #include <string> 00015 #include "payloads-unpacker/unpacker/PXXVDecoder.h" 00016 00017 class PXXNativeDecoder; 00018 00019 #ifdef __USEROOT__ // compile with ROOT 00020 typedef PXXNativeDecoder* PXXNativeDecoderPtr; 00021 #else 00022 typedef shared_ptr<PXXNativeDecoder> PXXNativeDecoderPtr; 00023 #endif 00024 00025 class PXXNativeDecoder : public PXXVDecoder { 00026 00027 public: 00028 00029 SET_LOGGER("PXXNativeDecoder"); 00030 00034 static PXXNativeDecoderPtr GetInstancePtr(); 00035 //------------------------------------------------------------------------------ 00036 00040 virtual ~PXXNativeDecoder(); 00041 //------------------------------------------------------------------------------ 00042 00046 virtual void Initialize(); 00047 //------------------------------------------------------------------------------ 00048 00052 virtual void Dispose(); 00053 //------------------------------------------------------------------------------ 00054 00061 virtual Int32b_t ReadBoolean(Bool8b_t &b); 00062 //------------------------------------------------------------------------------ 00063 00070 virtual Int32b_t ReadByte(Char8b_t &c); 00071 //------------------------------------------------------------------------------ 00072 00083 virtual Int32b_t SkipBytes(Int32b_t n); 00084 //------------------------------------------------------------------------------ 00085 00090 virtual Int32b_t ReadShort(Short16b_t &s); 00091 //------------------------------------------------------------------------------ 00092 00097 virtual Int32b_t ReadInt(Int32b_t &i); 00098 //------------------------------------------------------------------------------ 00099 00104 virtual Int32b_t ReadFloat(Float32b_t &f); 00105 //------------------------------------------------------------------------------ 00106 00111 virtual Int32b_t ReadLong(Long64b_t &l); 00112 //------------------------------------------------------------------------------ 00113 00118 virtual Int32b_t ReadDouble(Double64b_t &d); 00119 //------------------------------------------------------------------------------ 00120 00124 static Char8b_t* GetBuffer() { return fCBuffer_; } 00125 //------------------------------------------------------------------------------ 00126 00127 static void SetBuffer(const Char8b_t* start, Int32b_t length); 00128 //------------------------------------------------------------------------------ 00129 00130 00131 //protected: 00132 00136 PXXNativeDecoder(); 00137 //------------------------------------------------------------------------------ 00138 00142 Int32b_t ReadAByteFromBuffer(Char8b_t *needle); 00143 //------------------------------------------------------------------------------ 00144 00145 00146 private: 00147 00148 static PXXNativeDecoderPtr fInstancePtr_; // pointer to instance 00149 static Char8b_t *fCBuffer_; // pointer to byte buffer 00150 static Int32b_t fIBufferLength_; // length of the byte buffer 00151 static Int32b_t fIByteRead_; // N-byte have read 00152 00153 ClassDef(PXXNativeDecoder, 0) // Native binary decoder 00154 00155 }; 00156 00157 #endif