Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:47

0001 // @(#)root/io:$Id$
0002 // Author: Elvin Sindrilaru   19/05/2011
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2011, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TFPBlock
0013 #define ROOT_TFPBlock
0014 
0015 #include "TObject.h"
0016 
0017 /**
0018 \class TFPBlock
0019 \ingroup IO
0020 */
0021 
0022 class TFPBlock : public TObject{
0023 
0024 private:
0025    char     *fBuffer;       ///< Content of the block
0026    Int_t     fNblock;       ///< Number of segment in the block
0027    Long64_t  fDataSize;     ///< Total size of useful data in the block
0028    Long64_t  fCapacity;     ///< Capacity of the buffer
0029    Int_t    *fLen;          ///< Array of lengths of each segment
0030    Long64_t *fPos;          ///< Array of positions of each segment
0031    Long64_t *fRelOffset;    ///< Relative offset of piece in the buffer
0032 
0033    TFPBlock(const TFPBlock&) = delete;            // Not implemented.
0034    TFPBlock &operator=(const TFPBlock&) = delete; // Not implemented.
0035 
0036 public:
0037 
0038    TFPBlock(Long64_t*, Int_t*, Int_t);
0039    ~TFPBlock() override;
0040 
0041    Long64_t  GetPos(Int_t) const;
0042    Int_t     GetLen(Int_t) const;
0043 
0044    Long64_t *GetPos() const;
0045    Int_t    *GetLen() const;
0046    Long64_t  GetDataSize() const;
0047    Long64_t  GetCapacity() const;
0048    Int_t     GetNoElem() const;
0049    char     *GetBuffer() const;
0050    char     *GetPtrToPiece(Int_t index) const;
0051 
0052    void      SetBuffer(char*);
0053    void      SetPos(Int_t, Long64_t);
0054    void      ReallocBlock(Long64_t*, Int_t*, Int_t);
0055 
0056    ClassDefOverride(TFPBlock, 0);  // File prefetch block
0057 };
0058 
0059 /// Get pointer to the array of postions.
0060 inline Long64_t* TFPBlock::GetPos() const
0061 {
0062    return fPos;
0063 }
0064 
0065 /// Get pointer to the array of lengths.
0066 inline Int_t* TFPBlock::GetLen() const
0067 {
0068    return fLen;
0069 }
0070 
0071 /// Return size of the data in the block.
0072 inline Long64_t TFPBlock::GetDataSize() const
0073 {
0074    return fDataSize;
0075 }
0076 
0077 /// Return capacity of the block.
0078 inline Long64_t TFPBlock::GetCapacity() const
0079 {
0080    return fCapacity;
0081 }
0082 
0083 /// Return number of elements in the block.
0084 inline Int_t TFPBlock::GetNoElem() const
0085 {
0086    return fNblock;
0087 }
0088 
0089 /// Get position of the element at index i.
0090 inline Long64_t TFPBlock::GetPos(Int_t i) const
0091 {
0092    return fPos[i];
0093 }
0094 
0095 /// Get length of the element at index i.
0096 inline Int_t TFPBlock::GetLen(Int_t i) const
0097 {
0098    return fLen[i];
0099 }
0100 
0101 /// Get block buffer.
0102 inline char* TFPBlock::GetBuffer() const
0103 {
0104    return fBuffer;
0105 }
0106 
0107 /// Get block buffer.
0108 inline char* TFPBlock::GetPtrToPiece(Int_t index) const
0109 {
0110   return (fBuffer + fRelOffset[index]);
0111 }
0112 
0113 #endif