23 #ifndef ADF_FrameBlock
24 #define ADF_FrameBlock
66 virtual Bool_t
Expand(UInt_t) = 0;
84 {
return fMode == mode; }
106 void *current = fOwner; fOwner = owner;
return current;
108 virtual Bool_t
IsOwner(
void * owner = 0x0)
const
110 return fOwner == owner;
137 virtual Bool_t
Reserve(UInt_t, Bool_t =
false, UInt_t = 0u)
194 virtual Bool_t
SetBlock(Char_t * = 0x0, UInt_t = 0u,
char =
'r',
char =
'l', UInt_t = 0u) = 0;
267 virtual Bool_t
Reserve(UInt_t, Bool_t =
false, UInt_t = 0u);
293 virtual Bool_t
SetBlock(Char_t * = 0x0, UInt_t = 0u,
char =
'r',
char =
'l', UInt_t = 0u);
339 virtual Bool_t
Reserve(UInt_t, Bool_t =
false, UInt_t = 0u)
355 virtual Bool_t
Expand(UInt_t);
370 Long64_t fCurrentSize;
373 Long64_t fFileSnapshot;
391 else return fCurrentSize;
409 #if !defined(_MSC_VER)
411 Long64_t c = ::ftell(file);
413 ::fseek(file, 0L, SEEK_END);
414 fMaxSize = ::ftell(file);
416 ::fseek(file, c, SEEK_SET);
420 Long64_t c = _ftelli64(file);
422 _fseeki64(file, __int64(0), SEEK_END);
423 fMaxSize = _ftelli64(file);
425 _fseeki64(file, c, SEEK_SET);
428 else fMaxSize = max_size;
432 virtual Bool_t
Reserve(UInt_t, Bool_t =
false, UInt_t = 0u);
443 fFileSnapshot = fCurrentSize;
449 #if !defined(_MSC_VER)
450 ::fseek(fFile,fFileSnapshot,SEEK_SET);
452 _fseeki64(fFile,fFileSnapshot,SEEK_SET);
454 fCurrentSize = fFileSnapshot;
461 ::fseek(fFile,0u,SEEK_SET);
464 virtual Bool_t
SetBlock(Char_t * = 0x0, UInt_t= 0u,
char =
'r',
char =
'l', UInt_t = 0u)
virtual BufferIO & GetFrame(UInt_t which=0u)=0
the new frame is wrapped in a BufferIO object for transportation between the different classes ...
virtual void * SetOwner(void *owner=0x0)
Name of the block ... used to distinguish several blocks in a topology.
virtual Bool_t Expand(UInt_t)=0
return true if the output is expandable
virtual Bool_t NextFrame(Key *)
return true if there is a new frame available (in reading mode)
virtual BufferIO & GetFrame(UInt_t=0u)
Return a buffer that is linked with the part of the buffer that corresponds to the next frame...
virtual Long64_t GetSize(UInt_t=0u) const
size of the current block
virtual void BackToSnapshot()
back to the last position
virtual void Rewind(ConfAgent::EMode mode=ConfAgent::kRead)
Rewind to be ready to be used again.
virtual Bool_t SetBlock(Char_t *=0x0, UInt_t=0u, char= 'r', char= 'l', UInt_t=0u)
Attach a external block to this.
virtual UInt_t NumberOfChannels() const =0
virtual Bool_t Reserve(UInt_t, Bool_t=false, UInt_t=0u)
check if enough place to write something (writing mode)
virtual Long64_t GetMaxSize(UInt_t=0u) const
max size of the block
virtual ~ExpandableBlock()
Bool_t IsMode(ConfAgent::EMode mode) const
It implements an expandable block of Frame.
FileBlock(UInt_t size=aMByte, ConfAgent::EMode mode=ConfAgent::kRead)
EMode
Operating mode for frame IO.
NullBlock(ConfAgent::EMode mode=ConfAgent::kRead)
virtual Bool_t Expand(UInt_t)
This kind of Block is not expandable.
ConfAgent::EMode GetModeIO() const
Return the operating mode.
virtual void SetModeIO(ConfAgent::EMode mode)
virtual Bool_t AddFrame(const BufferIO &, UInt_t i=0u)
Add a Frame to the block.
virtual Bool_t AddFrame(const Frame &, UInt_t=0u)
virtual void BackToSnapshot()
back to the last position
virtual Long64_t GetOffset(UInt_t=0u) const
Current position.
UInt_t Offset() const
it returns the current position in the buffer
UInt_t Size() const
it returns the maximum number of bytes in this buffer
virtual Bool_t AddFrame(const BufferIO &, UInt_t=0u)
Add a Frame to the block.
ExpandableBlock(UInt_t size=aMByte, ConfAgent::EMode mode=ConfAgent::kRead)
Frames are extracted/added directly, one by one from/to a file.
header file for Frame.cpp
virtual Long64_t GetMaxSize(UInt_t=0u) const
max size of the block
virtual void Snapshot()
keep the position
virtual Bool_t AddFrame(const BufferIO &, UInt_t i=0u)
Add a Frame to the block.
virtual UInt_t NumberOfChannels() const
virtual Long64_t GetMaxSize(UInt_t=0u) const
max size of the block
virtual void Snapshot()
keep the position
virtual void BackToSnapshot()
back to the last position
virtual Long64_t GetOffset(UInt_t=0u) const
Current position.
It implements a black hole for Frames.
virtual BufferIO * GetBufferIO(UInt_t which=0u)=0
To get the address of the underlying buffer.
virtual BufferIO * GetBufferIO(UInt_t=0u)
To get the address of the underlying buffer.
virtual Bool_t IsOwner(void *owner=0x0) const
OneBlock(UInt_t size=aMByte, ConfAgent::EMode mode=ConfAgent::kRead)
virtual Bool_t NextFrame(Key *)=0
true if there is a new frame available in the block
virtual Bool_t AddFrame(const BufferIO &, UInt_t=0u)
Add a Frame to the block.
BufferIO fBuffer
The buffer to look for Frames.
virtual Bool_t NextFrame(Key *)
Read next frame from file.
virtual Long64_t GetSize(UInt_t=0u) const
size of the current block
virtual Bool_t Reserve(UInt_t, Bool_t=false, UInt_t=0u)
check if enough place to write something (writing mode)
BufferIO fFrame
to wrap the current Frame
virtual Bool_t SetBlock(Char_t *=0x0, UInt_t=0u, char= 'r', char= 'l', UInt_t=0u)=0
Attach a external block to this.
UInt_t SetEffectiveSize(UInt_t size=kMaxUInt_t)
in case the buffer is partly filled and you would like to read it again
virtual void Rewind(ConfAgent::EMode=ConfAgent::kRead)
Rewind to be ready to be used again.
header file for ConfAgent.cpp
virtual BufferIO & GetFrame(UInt_t=0u)
Return a buffer that is linked with the part of the buffer that corresponds to the next frame...
virtual void SetFile(FILE *file, Long64_t max_size=kMaxUInt_t)
virtual Bool_t Reserve(UInt_t, Bool_t=false, UInt_t=0u)
Reserve the given size for writing.
FrameBlock(ConfAgent::EMode mode=ConfAgent::kRead)
virtual Bool_t Expand(UInt_t)
implements Expand method
virtual Long64_t GetOffset(UInt_t=0u) const
Current position.
virtual Bool_t NextFrame(Key *)
return true if there is a new frame available (in reading mode)
virtual Long64_t GetSize(UInt_t=0u) const
size of the current block
virtual void Rewind(ConfAgent::EMode mode=ConfAgent::kRead)=0
Rewind to be ready to be used again.
virtual Bool_t Expand(UInt_t)
This kind of Block is not expandable.
virtual void Snapshot()
keep the current position
It implements an in-memory block of Frames.
virtual Bool_t AddFrame(const Frame &, UInt_t=0u)
virtual Bool_t SetBlock(Char_t *=0x0, UInt_t=0u, char= 'r', char= 'l', UInt_t=0u)
Attach a external block to this.
virtual Bool_t Reserve(UInt_t, Bool_t=false, UInt_t=0u)
check if enough place to write something (writing mode)
UInt_t SetOffset(UInt_t off=0u) const
change the current position.