|
Libprimis
Imprimis' 3D destroyable world engine
|
Public Types | |
| enum | { OVERREAD = 1<<0 , OVERWROTE = 1<<1 } |
Public Member Functions | |
| template<class U> | |
| databuf (T *buf, U maxlen) | |
| void | reset () |
| void | reset (T *buf_, int maxlen_) |
| const T & | get () |
| Adds an existing value in the underlying buffer to the databuf. | |
| databuf | subbuf (int sz) |
| Returns a databuf<T> object containing the first n entries. | |
| T * | pad (int numvals) |
| Adds N empty elements to the end of the array and returns a pointer. | |
| void | put (const T &val) |
| Adds an entry to the databuf if space is available. | |
| void | put (const T *vals, int numvals) |
| int | get (T *vals, int numvals) |
| void | offset (int n) |
| T * | getbuf () const |
| Returns a pointer to the internal data array. | |
| bool | empty () const |
| Returns whether any entries have been assigned to the array. | |
| int | length () const |
| Returns the number of allocated entries in the databuf. | |
| int | remaining () const |
| Returns the number of values remaining before the databuf overflows. | |
| bool | overread () const |
| Returns whether the databuf has been accessed with too large of an index. | |
| bool | overwrote () const |
| Returns whether the databuf has had invalid writes to it. | |
| bool | check (int n) |
| void | forceoverread () |
Public Attributes | |
| T * | buf |
| int | len |
| int | maxlen |
| uchar | flags |
|
inline |
Returns whether any entries have been assigned to the array.
|
inline |
Adds an existing value in the underlying buffer to the databuf.
Increases the length of the databuf by one and incorporates the value at the address after the end of the databuf's values.
If the length is equal to or greater than the buffer's maximum length, applies the OVERREAD flag and returns a null value.
|
inline |
Returns a pointer to the internal data array.
This is a naked pointer to the internal data array and can therefore be used to potentially break this container, if used carelessly.
|
inline |
Returns the number of allocated entries in the databuf.
Returns the number of entries which have been added to the databuf (not the overall databuf size).
|
inline |
Returns whether the databuf has been accessed with too large of an index.
Returns whether the OVERREAD flag has been set. If the databuf was attempted to be accessed with an index larger than the number of allocated members, this value will be set.
|
inline |
Returns whether the databuf has had invalid writes to it.
Returns whether the OVERWROTE flag has been set. If the databuf was attempted to be wrote to while the databuf is already full, this flag will be set.
|
inline |
Adds N empty elements to the end of the array and returns a pointer.
Creates an array of size sz which is then pointed to and returned as a naked pointer.
| sz | the size of the buffer |
|
inline |
Adds an entry to the databuf if space is available.
If no space is available, applies the OVERWROTE flag to the flags field.
| val | A const reference to the object to add |
|
inline |
Returns the number of values remaining before the databuf overflows.
Returns the allocatable space remaining within the databuf object, in terms of the number of entires which can be put into it before it becomes OVERWROTE.
Returns a databuf<T> object containing the first n entries.
Returns a databuf object of type T which represents the first n elements inside the databuf's array.
If the size passed is larger than the databuf, the entire databuf object is copied and returned.
| sz | the size of the output array (aka get the first sz entries) |