Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Using CCirBuffer


Before adding/removing objects

The buffer itself is not allocated until the CCirBufBase::SetLengthL() member function is called. Therefore, the first steps must always be to construct the CCirBuffer object and then call its SetLengthL() member function.

Also note that SetLengthL() can leave so it's useful to call it under a trap harness.

...
CCirBuffer* cbInt=new CCirBuffer;
TRAPD(ret,cbInt->SetLengthL(3));            // max capacity is 3
                                            // and allocates buffer
cbInt->Put(123);     // Can now start adding/removing integersobjects
cbInt->Put(12);
cbInt->Put(1);
...
delete cbInt;