Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

RawDataBlock.h

Go to the documentation of this file.
00001 
00002 // $Id: RawDataBlock.h,v 1.23 2005/06/02 06:49:05 rhatcher Exp $
00003 // 
00004 // RawDataBlock 
00005 // 
00006 // RawDataBlock is the base class for a block of raw MINOS data 
00007 // The block is an unstructured collection of raw bytes
00008 // Derived versions specialize how to unpack that data
00009 //
00010 // Author:  R. Hatcher 2000.04.19
00011 //
00013 
00014 #ifndef RAWDATABLOCK_H
00015 #define RAWDATABLOCK_H
00016 
00017 #include "TObject.h"
00018 
00019 #include "RawData/RawBlockId.h"
00020 #include "OnlineUtil/rdChecksum.h"
00021 
00022 #include <iosfwd>
00023 
00024 class RawDataBlock;
00025 std::ostream& operator<<(std::ostream& os, const RawDataBlock& r);
00026 
00027 class RawDataBlock : public TObject {
00028 
00029  public:
00030 
00031    RawDataBlock();                        // necessary for streamer io
00032    RawDataBlock(const Int_t *block);
00033    RawDataBlock(const RawDataBlock &rhs); // deep copy ctor
00034    virtual ~RawDataBlock();
00035 
00036    RawDataBlock& operator=(const RawDataBlock& rhs);  // deep copy assignment
00037 
00038    // unfettered read-only access to the unadulterated data
00039    inline  const Int_t*     GetData() const { return fRawBlock; }
00040    inline  Int_t            GetSize() const { return fSize; }
00041 
00042    // components that are always there within the fRawBlock
00043            RawBlockId       GetBlockId() const;
00044            Int_t            GetMinorId() const;
00045            Int_t            GetChecksum() const;
00046                             // Test returns TRUE if there is an error
00047            Bool_t           TestChecksum() const;
00048 
00049    virtual void             Print(Option_t *option = "") const;
00050    virtual std::ostream&    FormatToOStream(std::ostream& os,
00051                                             Option_t *option="") const;
00052    static  void             SetForceHexDump(Bool_t force) 
00053                                             {fgForceHexDump=force;}
00054    static  Bool_t           GetForceHexDump() { return fgForceHexDump; }
00055 
00056    // append this data to a buffer
00057    Int_t*                   AppendToBuffer(Int_t* bstart) const;
00058 
00059  protected:
00060 
00061    // make the data elements "protected" so derived classes have access
00062 
00063    Int_t      fSize;        // number of long words stored
00064    Int_t     *fRawBlock;    //[fSize]   the unstructured data (rawest of raw)
00065 
00066  private:
00067 
00068    // a global option
00069    static Bool_t fgForceHexDump;
00070 
00071    ClassDef(RawDataBlock,1)  // RawDataBlock version 1
00072 };
00073 
00074 #if !defined(__CINT__) || defined(__MAKECINT__)
00075 
00076 // second word of stored array is checksum
00077 inline Int_t RawDataBlock::GetChecksum() const
00078 { return (fSize>1) ? fRawBlock[1] : 0; } 
00079 
00080 // third word of stored array is block-id
00081 inline RawBlockId RawDataBlock::GetBlockId() const
00082 { return (fSize>2) ? RawBlockId(fRawBlock[2]) : RawBlockId(0); } 
00083 
00084 inline Int_t RawDataBlock::GetMinorId() const 
00085 { return GetBlockId().GetMinor(); }
00086 
00087 inline Bool_t RawDataBlock::TestChecksum() const
00088 {
00089    // TestChecksum returns TRUE if there is an error
00090    return rdxsum_test((long*)fRawBlock);
00091 }
00092 #endif // !__CINT__
00093 
00094 #endif // RAWDATABLOCK_H

Generated on Sat Nov 21 22:47:29 2009 for loon by  doxygen 1.3.9.1