Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TFPBlock.h
Go to the documentation of this file.
1// @(#)root/io:$Id$
2// Author: Elvin Sindrilaru 19/05/2011
3
4/*************************************************************************
5 * Copyright (C) 1995-2011, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TFPBlock
13#define ROOT_TFPBlock
14
15#include "TObject.h"
16
17/**
18\class TFPBlock
19\ingroup IO
20*/
21
22class TFPBlock : public TObject{
23
24private:
25 char *fBuffer; ///< Content of the block
26 Int_t fNblock; ///< Number of segment in the block
27 Long64_t fDataSize; ///< Total size of useful data in the block
28 Long64_t fCapacity; ///< Capacity of the buffer
29 Int_t *fLen; ///< Array of lengths of each segment
30 Long64_t *fPos; ///< Array of positions of each segment
31 Long64_t *fRelOffset; ///< Relative offset of piece in the buffer
32
33 TFPBlock(const TFPBlock&) = delete; // Not implemented.
34 TFPBlock &operator=(const TFPBlock&) = delete; // Not implemented.
35
36public:
37
39 virtual ~TFPBlock();
40
41 Long64_t GetPos(Int_t) const;
42 Int_t GetLen(Int_t) const;
43
44 Long64_t *GetPos() const;
45 Int_t *GetLen() const;
46 Long64_t GetDataSize() const;
47 Long64_t GetCapacity() const;
48 Int_t GetNoElem() const;
49 char *GetBuffer() const;
50 char *GetPtrToPiece(Int_t index) const;
51
52 void SetBuffer(char*);
53 void SetPos(Int_t, Long64_t);
55
56 ClassDefOverride(TFPBlock, 0); // File prefetch block
57};
58
59/// Get pointer to the array of postions.
61{
62 return fPos;
63}
64
65/// Get pointer to the array of lengths.
66inline Int_t* TFPBlock::GetLen() const
67{
68 return fLen;
69}
70
71/// Return size of the data in the block.
73{
74 return fDataSize;
75}
76
77/// Return capacity of the block.
79{
80 return fCapacity;
81}
82
83/// Return number of elements in the block.
85{
86 return fNblock;
87}
88
89/// Get position of the element at index i.
91{
92 return fPos[i];
93}
94
95/// Get length of the element at index i.
97{
98 return fLen[i];
99}
100
101/// Get block buffer.
102inline char* TFPBlock::GetBuffer() const
103{
104 return fBuffer;
105}
106
107/// Get block buffer.
109{
110 return (fBuffer + fRelOffset[index]);
111}
112
113#endif
long long Long64_t
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
This class represents the encapsulation of a block request.
Definition TFPBlock.h:22
Long64_t fDataSize
Total size of useful data in the block.
Definition TFPBlock.h:27
Long64_t * GetPos() const
Get pointer to the array of postions.
Definition TFPBlock.h:60
TFPBlock & operator=(const TFPBlock &)=delete
char * GetPtrToPiece(Int_t index) const
Get block buffer.
Definition TFPBlock.h:108
void SetPos(Int_t, Long64_t)
Set pos value for index idx.
Definition TFPBlock.cxx:72
void SetBuffer(char *)
Set block buffer.
Definition TFPBlock.cxx:81
Long64_t GetDataSize() const
Return size of the data in the block.
Definition TFPBlock.h:72
void ReallocBlock(Long64_t *, Int_t *, Int_t)
Reallocate the block's buffer based on the length of the elements it will contain.
Definition TFPBlock.cxx:94
Long64_t * fPos
Array of positions of each segment.
Definition TFPBlock.h:30
Int_t GetNoElem() const
Return number of elements in the block.
Definition TFPBlock.h:84
Long64_t * fRelOffset
Relative offset of piece in the buffer.
Definition TFPBlock.h:31
Int_t * GetLen() const
Get pointer to the array of lengths.
Definition TFPBlock.h:66
Long64_t GetCapacity() const
Return capacity of the block.
Definition TFPBlock.h:78
char * fBuffer
Content of the block.
Definition TFPBlock.h:25
Int_t fNblock
Number of segment in the block.
Definition TFPBlock.h:26
TFPBlock(const TFPBlock &)=delete
Int_t * fLen
Array of lengths of each segment.
Definition TFPBlock.h:29
Long64_t fCapacity
Capacity of the buffer.
Definition TFPBlock.h:28
virtual ~TFPBlock()
Destructor.
Definition TFPBlock.cxx:60
char * GetBuffer() const
Get block buffer.
Definition TFPBlock.h:102
Mother of all ROOT objects.
Definition TObject.h:41