21 #ifndef LUNCHBOX_LFVECTOR_H
22 #define LUNCHBOX_LFVECTOR_H
24 #include <lunchbox/bitOperation.h>
25 #include <lunchbox/debug.h>
26 #include <lunchbox/os.h>
27 #include <lunchbox/scopedMutex.h>
28 #include <lunchbox/serializable.h>
29 #include <lunchbox/spinLock.h>
52 template<
class T,
int32_t nSlots = 32 >
class LFVector
65 LFVector(
const size_t n,
const T& t );
71 template<
int32_t fromSlots >
84 bool operator != (
const LFVector& rhs )
const {
return !(*
this == rhs); }
86 bool empty()
const {
return size_ == 0; }
87 size_t size()
const {
return size_; }
128 void expand(
const size_t newSize,
const T& item = T( ));
142 void push_back(
const T& item,
bool lock =
true );
207 void resize(
const size_t size,
const T& value = T( ));
229 template<
int32_t fromSlots >
232 void push_back_unlocked_(
const T& item );
239 std::ostream& operator << ( std::ostream& os, const LFVector< T >& v );
243 #include "lfVector.ipp"
245 #endif // LUNCHBOX_LFVECTOR_H
An iterator for LFVector.
A fast lock for uncontended memory access.
STL-like vector implementation providing certain thread-safety guarantees.
LFVector & operator=(const LFVector &from)
void push_back(const T &item, bool lock=true)
Add an element to the vector.
ScopedWrite getWriteLock()
LFVectorIterator< const LFVector< T, nSlots >, const T > const_iterator
Iterator over the const vector elements.
bool operator==(const LFVector &rhs) const
void pop_back()
Remove the last element (STL version).
void clear()
Clear the vector and all storage.
const_iterator end() const
bool operator!=(const LFVector &rhs) const
void resize(const size_t size, const T &value=T())
Resize the vector.
void expand(const size_t newSize, const T &item=T())
Resize the vector to at least the given size.
const_iterator begin() const
LFVectorIterator< LFVector< T, nSlots >, T > iterator
Iterator over the vector elements.
iterator erase(typename LFVector< T, nSlots >::iterator pos)
Remove an element.