CBufSeg Class Reference
class CBufSeg : public CBufBase
|
Provides a segmented dynamic buffer.
This class should be used when the object has a long life-time and an unpredictable number of insertions, or there is concern about the performance of insertion and deletion operations into large buffers.
This class is an implementation of the abstract buffer interface provided by
CBufBase
and uses doubly-linked list of heap cells to contain the data; each cell containing a segment of the buffer.
Its (private) data members include an anchor for the doubly-linked list, and also a reference to the buffer position used by the last operation. This reference acts as a cache; if the next operation uses a similar buffer position, then calculation of the pointer corresponding to its buffer position is much faster.
Inherited Functions
|
|
CBase::CBase()
|
|
CBase::Delete(CBase *)
|
|
CBase::Extension_(TUint,TAny *&,TAny *)
|
|
CBase::operator new(TUint)
|
|
CBase::operator new(TUint,TAny *)
|
|
CBase::operator new(TUint,TLeave)
|
|
CBase::operator new(TUint,TLeave,TUint)
|
|
CBase::operator new(TUint,TUint)
|
|
CBase::~CBase()
|
|
CBufBase::CBufBase(TInt)
|
|
CBufBase::ExpandL(TInt,TInt)
|
|
CBufBase::InsertL(TInt,const TAny *,TInt)
|
|
CBufBase::InsertL(TInt,const TDesC8 &)
|
|
CBufBase::InsertL(TInt,const TDesC8 &,TInt)
|
|
CBufBase::Read(TInt,TAny *,TInt)const
|
|
CBufBase::Read(TInt,TDes8 &)const
|
|
CBufBase::Read(TInt,TDes8 &,TInt)const
|
|
CBufBase::Reset()
|
|
CBufBase::ResizeL(TInt)
|
|
CBufBase::Size()const
|
|
CBufBase::Write(TInt,const TAny *,TInt)
|
|
CBufBase::Write(TInt,const TDesC8 &)
|
|
CBufBase::Write(TInt,const TDesC8 &,TInt)
|
|
CBufBase::~CBufBase()
|
Constructor & Destructor Documentation
CBufSeg(TInt)
IMPORT_C
|
CBufSeg
|
(
|
TInt
|
anExpandSize
|
)
|
[protected]
|
~CBufSeg()
Destructor.
Frees all resources owned by the object, prior to its destruction.
Specifically, it frees all segments allocated to the buffer.
Member Functions Documentation
AllocSegL(TBufSegLink *, TInt)
void
|
AllocSegL
|
(
|
TBufSegLink *
|
aSeg,
|
|
TInt
|
aNumber
|
|
)
|
[protected]
|
Parameters
TBufSegLink * aSeg
|
|
TInt
aNumber
|
|
BackPtr(TInt)
IMPORT_C
TPtr8
|
BackPtr
|
(
|
TInt
|
aPos
|
)
|
[virtual]
|
Gets a pointer descriptor to represent the data starting at the beginning of the contiguous region containing that byte through to the byte immediately preceding the specified byte.
The descriptor always points to the beginning of the segment containing the specified byte. The time needed for calculation of the pointer depends on how many segments there are in the buffer, and how near the target segment is to the segment which was last used in the buffer.
CBufBase::BackPtr
Parameters
TInt
aPos
|
Buffer position: must be in range zero to Size().
|
Compress()
IMPORT_C void
|
Compress
|
(
|
)
|
[virtual]
|
Compresses the buffer so as to occupy minimal space.
Fills any space in each segment of the buffer by moving contents from the next segment to the current one. Where this activity results in empty segments, it frees the memory associated with these segments.
CBufBase::Compress
Delete(TInt, TInt)
IMPORT_C void
|
Delete
|
(
|
TInt
|
aPos,
|
|
TInt
|
aLength
|
|
)
|
[virtual]
|
Deletes data from the buffer.
During deletion, shuffling is minimised by deleting intermediate segments and allowing segments to contain less data than the buffer granularity.
CBufBase::Delete
Parameters
TInt
aPos
|
Buffer position where the deletion will begin; must be in the range zero to (Size() minus the length of the data to be deleted).
|
TInt
aLength
|
The number of bytes to be deleted.
|
DeleteFromSegment(TBufSegLink *, TInt, TInt)
void
|
DeleteFromSegment
|
(
|
TBufSegLink *
|
aSeg,
|
|
TInt
|
anOffset,
|
|
TInt
|
aLength
|
|
)
|
[protected]
|
Parameters
TBufSegLink * aSeg
|
|
TInt
anOffset
|
|
TInt
aLength
|
|
DoInsertL(TInt, const TAny *, TInt)
IMPORT_C void
|
DoInsertL
|
(
|
TInt
|
aPos,
|
|
const
TAny
*
|
aPtr,
|
|
TInt
|
aLength
|
|
)
|
[private, virtual]
|
FreeSegment(TBufSegLink *)
void
|
FreeSegment
|
(
|
TBufSegLink *
|
aSeg
|
)
|
[protected]
|
InsertIntoSegment(TBufSegLink *, TInt, const TAny *, TInt)
void
|
InsertIntoSegment
|
(
|
TBufSegLink *
|
aSeg,
|
|
TInt
|
anOffset,
|
|
const
TAny
*
|
aPtr,
|
|
TInt
|
aLength
|
|
)
|
[protected]
|
Parameters
TBufSegLink * aSeg
|
|
TInt
anOffset
|
|
const
TAny
* aPtr
|
|
TInt
aLength
|
|
NewL(TInt)
Allocates and constructs a segmented buffer.
If there is insufficient memory available to allocate the segmented buffer, the function leaves.
-
panic
-
E32USER-CBase 3 if the granularity is negative.
Parameters
TInt
anExpandSize
|
The granularity of the buffer. Each segment contains (in addition to 16 bytes of overhead) this number of bytes for data. Note: although a value of zero is permitted by this interface, it has no meaning, and risks raising panics later during execution. We suggest that you pass a positive value.
|
Ptr(TInt)
Gets a pointer descriptor to represent the data starting at the specified data byte through to the end of the contiguous region containing that byte.
The time needed for calculation of the pointer depends on how many segments there are in the buffer, and how near the target segment is to the segment which was last used in the buffer.
Parameters
TInt
aPos
|
Buffer position: must be in range zero to Size().
|
SetSBO(TInt)
void
|
SetSBO
|
(
|
TInt
|
aPos
|
)
|
[protected]
|
Member Data Documentation
TDblQue< TBufSegLink > iQue
TDblQue
< TBufSegLink >
|
iQue
|
[private]
|
TBufSegLink * iSeg
TBufSegLink *
|
iSeg
|
[private]
|
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.