Logo ROOT   6.18/05
Reference Guide
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&); // Not implemented.
34 TFPBlock &operator=(const TFPBlock&); // 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 ClassDef(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
69 return fLen;
70}
71
72/// Return size of the data in the block.
74{
75 return fDataSize;
76}
77
78/// Return capacity of the block.
80{
81 return fCapacity;
82}
83
84/// Return number of elements in the block.
86{
87 return fNblock;
88}
89
90/// Get position of the element at index i.
92{
93 return fPos[i];
94}
95
96/// Get length of the element at index i.
98{
99 return fLen[i];
100}
101
102/// Get block buffer.
103inline char* TFPBlock::GetBuffer() const
104{
105 return fBuffer;
106}
107
108/// Get block buffer.
109inline char* TFPBlock::GetPtrToPiece(Int_t index) const
110{
111 return (fBuffer + fRelOffset[index]);
112}
113
114#endif
int Int_t
Definition: RtypesCore.h:41
long long Long64_t
Definition: RtypesCore.h:69
#define ClassDef(name, id)
Definition: Rtypes.h:326
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
char * GetPtrToPiece(Int_t index) const
Get block buffer.
Definition: TFPBlock.h:109
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:73
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:85
TFPBlock & operator=(const TFPBlock &)
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:79
char * fBuffer
Content of the block.
Definition: TFPBlock.h:25
TFPBlock(const TFPBlock &)
Int_t fNblock
Number of segment in the block.
Definition: TFPBlock.h:26
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:103
Mother of all ROOT objects.
Definition: TObject.h:37