Provide a protocol (or pure interface) for managing record handles (specifically instances of bsl::shared_ptr<Record>).

Synopsis

Declared in <ball_recordbuffer.h>

class RecordBuffer;

Member Functions

Name

Description

~RecordBuffer [destructor] [virtual]

Remove all record handles stored in this record buffer and destroy this record buffer.

back [virtual]

Return a reference of the shared pointer referring to the record positioned at the back of this record buffer. The behavior is undefined unless this record buffer has been locked by the beginSequence method and 0 < length().

beginSequence [virtual]

Lock this record buffer so that a sequence of method invocations on this record buffer can occur uninterrupted by other threads. The buffer will remain locked until endSequence is called.

endSequence [virtual]

Unlock this record buffer, thus allowing other threads to access it. The behavior is undefined unless the buffer is already locked by beginSequence method.

front [virtual]

Return a reference of the shared pointer referring to the record positioned at the front of this record buffer. The behavior is undefined unless this record buffer has been locked by the beginSequence method and 0 < length().

length [virtual]

Return the number of record handles in this record buffer.

popBack [virtual]

Remove from this record buffer the record handle positioned at the back of the buffer. The behavior is undefined unless 0 < length().

popFront [virtual]

Remove from this record buffer the record handle positioned at the front of the buffer. The behavior is undefined unless 0 < length().

pushBack [virtual]

Append the specified handle to the back of this record buffer. Return 0 on success, and a non‐zero value otherwise. Note that concrete implementations are permitted to remove records from the buffer in order to attempt to accommodate a pushBack request (which implies that, after a successful call to pushBack, length is not guaranteed to be more than one, and an unsuccessful call to pushBack is permitted to leave the buffer empty).

pushFront [virtual]

Insert the specified handle at the front of this record buffer. Return 0 on success, and a non‐zero value otherwise. Note that concrete implementations are permitted to remove records from the buffer in order to attempt to accommodate a pushFront request (which implies that, after a successful call to pushFront, length is not guaranteed to be more than one, and an unsuccessful call to pushFront is permitted to leave the buffer empty).

removeAll [virtual]

Remove all record handles stored in this record buffer. Note that length() is now 0.

Derived Classes

Name

Description

FixedSizeRecordBuffer

This class provides a concrete, thread‐safe implementation of the RecordBuffer protocol. This class is a mechanism. At any time, the sum of sizes of all records contained in a FixedSizeRecordBuffer object plus the amount of memory allocated by the FixedSizeRecordBuffer object itself is guaranteed to be less than or equal to an upper bound specified at creation. The class is thread‐safe, except that the methods front and back must be called after locking the buffer by invoking beginSequence. In order to accommodate a pushBack request, the records from the front end of the buffer may be removed. Similarly, in order to accommodate a pushFront request, the records from the back end of the buffer may be removed. If a record can not accommodate in the buffer, it is silently (but otherwise safely) discarded.

Created with MrDocs