25 #define ADF_BUFFERIO_H ADF_BufferIO
27 #ifndef ADF_BaseBuffer
67 UInt_t fRealInnerSize;
69 UInt_t fRealOuterSize;
131 virtual Bool_t
Link(
const Char_t *from, UInt_t from_size);
144 virtual Bool_t
Copy(
const Char_t *from, UInt_t from_size);
174 if ( off_from + size > from.
Size() )
205 {
return Copy(from,to,from.
Size()); }
256 UInt_t
SetOffset(
const Char_t *off)
const;
262 Bool_t
IsAnOffset(
const Char_t *off, UInt_t &pos)
const;
267 virtual void Reset();
284 virtual Bool_t
Expand(UInt_t new_size);
323 virtual UInt_t
FillWith(Char_t c, UInt_t how_many);
330 virtual UInt_t
Export(Char_t *, UInt_t)
const;
331 virtual UInt_t
Export(UShort_t *, UInt_t)
const;
332 virtual UInt_t
Export(Short_t *, UInt_t)
const;
333 virtual UInt_t
Export(UInt_t *, UInt_t)
const;
334 virtual UInt_t
Export(Int_t *, UInt_t)
const;
335 virtual UInt_t
Export(Float_t *, UInt_t)
const;
341 virtual UInt_t
Export(Double_t *, UInt_t)
const;
348 UInt_t
Import(
const Char_t *from, UInt_t size_ext_buf);
354 virtual UInt_t
Import(
const UShort_t *, UInt_t);
355 virtual UInt_t
Import(
const Short_t *, UInt_t);
356 virtual UInt_t
Import(
const UInt_t *, UInt_t);
357 virtual UInt_t
Import(
const Int_t *, UInt_t);
358 virtual UInt_t
Import(
const Float_t *, UInt_t);
363 virtual UInt_t
Import(
const Double_t *, UInt_t);
378 virtual UInt_t
Import(FILE *, UInt_t);
385 virtual UInt_t
Export(FILE *, UInt_t)
const;
388 virtual UInt_t
Import(std::istream &, UInt_t);
391 virtual UInt_t
Export(std::ostream &, UInt_t)
const ;
471 if (
sizeof(Long_t) == 8 ) {
497 if (
sizeof(ULong_t) == 8 ) {
531 if (
FreeSize()>=
sizeof(ULong64_t)) {
540 UShort_t size_string = (UShort_t)data.size();
541 UShort_t size_needed = size_string +
sizeof(size_needed);
635 if (
sizeof(Long_t) == 8)
647 if (
FreeSize()>=
sizeof(ULong64_t)) {
648 if (
sizeof(ULong_t) == 8)
671 if (
FreeSize()>=
sizeof(ULong64_t)) {
681 UShort_t size_string;
682 if (
FreeSize()>=
sizeof(size_string) ){
687 fCurrent += ( size_string +
sizeof(size_string) );
706 UInt_t bread = size*
sizeof(UShort_t);
716 UInt_t bread = size*
sizeof(Short_t);
726 UInt_t bread = size*
sizeof(UInt_t);
736 UInt_t bread = size*
sizeof(Int_t);
746 UInt_t bread = size*
sizeof(Float_t);
756 UInt_t bread = size*
sizeof(Double_t);
776 UInt_t bwritten = size*
sizeof(UShort_t);
786 UInt_t bwritten = size*
sizeof(Short_t);
796 UInt_t bwritten = size*
sizeof(UInt_t);
806 UInt_t bwritten = size*
sizeof(Int_t);
816 UInt_t bwritten = size*
sizeof(Float_t);
826 UInt_t bwritten = size*
sizeof(Double_t);
977 UShort_t size_string = (UShort_t)data.size();
978 UShort_t size_needed = size_string +
sizeof(size_needed);
1045 if (
FreeSize()>=
sizeof(ULong64_t)){
1082 if (
FreeSize()>=
sizeof(ULong64_t)){
1091 UShort_t size_string;
1093 if (
FreeSize()>=
sizeof(size_string)){
1098 fCurrent += ( size_string +
sizeof(size_string) );
virtual Bool_t Reserve(UInt_t size)
to reserve a given size (from the current position) to be sure one are able to write something ...
void SetStatus(BufferIO::EStatus s=BaseBuffer::kGood)
BufferIO::EStatus GetStatus() const
Char_t * fBufferIO
current buffer in which data are read/written
Char_t * CurrentAddress()
for classes that needs it to write directly data into it.
virtual Bool_t Link(const Char_t *from, UInt_t from_size)
Link an external buffer to this class.
virtual BufferIO & operator<<(Char_t)
virtual void Reset()
Reset means set all elements to 0 and the current position is 0.
BufferIO(UInt_t s=aByte)
Default size for a BufferIO is one byte just because it could be used only with an external buffer...
static void Swap(Short_t, Char_t *)
the Swap members
Bool_t IsAnOffset(const Char_t *off, UInt_t &pos) const
check if this address belongs to this buffer
virtual Bool_t IsLinked()
check if this is linked or not
A Endianbuffer is used to read/write raw data buffers from/on files.
virtual Char_t * Unlink()
Unlink the external buffer to this class.
virtual UInt_t FillWith(Char_t c, UInt_t how_many)
add the same character how_many times from the current position
UInt_t fRealSize
Real size of the current buffer.
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
static Bool_t Copy(const BufferIO &from, BufferIO &to, UInt_t size, UInt_t off_from=0u)
copy from a buffer to another one
UInt_t fCurrent
current position in the buffer (mutable so that reading are allowed for constant) ...
Base class for a CompositeFrame.
UInt_t FreeSize() const
it returns the number of free bytes to the end
virtual const BufferIO & operator>>(Char_t &) const
void SetCurrent(const char= 'i')
to switch between inner and outer
const Char_t * GetAddress() const
Pointer to the current underlying array of bytes.
virtual UInt_t Export(Char_t *, UInt_t) const
Export this buffer to an array.
static void Copy(const void *from, void *to, Int_t size)
copy the content from -> to
EndianBufferIO(UInt_t s=aKByte)
virtual Bool_t Copy(const Char_t *from, UInt_t from_size)
copy an external buffer to this.
static BufferIO * New(BaseBuffer::EEndian e, UInt_t s=aByte)
return the right buffer taking Into account the endian argument compared to the underlying endian sys...
static Bool_t Copy(const BufferIO &from, BufferIO &to)
copy a buffer to another one
virtual Bool_t Expand(UInt_t new_size)
Expand the size of the current buffer.
UInt_t SetEffectiveSize(UInt_t size=kMaxUInt_t)
in case the buffer is partly filled and you would like to read it again
void SetEndian(BaseBuffer::EEndian e)
BaseBuffer::EEndian GetEndian() const
UInt_t Import(const Char_t *from, UInt_t size_ext_buf)
Import the given array in this buffer.
virtual const BufferIO & operator>>(Char_t &) const
virtual ~EndianBufferIO()
EStatus
Status for this buffer.
Bool_t IsEndian(BaseBuffer::EEndian e) const
Char_t * Address()
for classes that needs it to write directly data into it.
Bool_t IsStatus(BufferIO::EStatus s) const
EStatus fStatus
current status
UInt_t fSize
effective size of the current buffer
virtual BufferIO & operator<<(Char_t)
EEndian fEndian
current endian
UInt_t SetOffset(UInt_t off=0u) const
change the current position.