A Hopf, Skip and a Jump
|
A Segment is an aggregation of base data with a SlidingBuffer. More...
#include <slidingbuffer.h>
Public Member Functions | |
Segment (const std::size_t size, const std::size_t origin, P &sp) | |
Construct a Segment. More... | |
virtual | ~Segment () |
Destroy this object and all the entities it contains. | |
T & | operator[] (std::size_t idx) |
Access an entity, waiting for it to be constructed if deferred construction is still taking place. More... | |
std::size_t | get_size (void) const |
Get the Segment's size. More... | |
Protected Attributes | |
T * | seg |
Dynamic array of entities in storage. | |
bool | valid |
Indicates entities have been constructed (for deferred initialisation: not yet implemented). More... | |
std::size_t | size |
Number of entities held. | |
const std::size_t | origin |
Index of the first entity in this Segment from the point of view of the SlidingBuffer. More... | |
P & | sp |
The producer invoked to fill this Segment. | |
A Segment is an aggregation of base data with a SlidingBuffer.
It is the underlying blocksize which is required of a SegmentProducer.
Segements provide an implementation of the []
operator; however, access to the underlying data would normally be via the aggregating class SlidingBuffer. Classes derived from SlidingBuffer may need to access the segements' data directly, however.
T | The type of each entity stored in the Segment. |
P | The type of the Segment's Producer. |
Definition at line 137 of file slidingbuffer.h.
|
inline |
Construct a Segment.
size | The number of base entities to be held in the segment. |
origin | The offset with in the aggregating SlidingBuffer of the first element in this Segment |
sp | The Producer for this Segment |
Definition at line 153 of file slidingbuffer.h.
|
inline |
Get the Segment's size.
Definition at line 190 of file slidingbuffer.h.
|
inline |
Access an entity, waiting for it to be constructed if deferred construction is still taking place.
Since deferred construction is not yet implemented, this method currently returns the entity reference immediately.
idx | Index of the entity within this segment. |
Definition at line 176 of file slidingbuffer.h.
|
protected |
Index of the first entity in this Segment from the point of view of the SlidingBuffer.
Definition at line 143 of file slidingbuffer.h.
|
protected |
Indicates entities have been constructed (for deferred initialisation: not yet implemented).
Definition at line 140 of file slidingbuffer.h.