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>
53 template<
class T,
int32_t nSlots = 32 >
class LFVector
66 LFVector(
const size_t n,
const T& t );
72 template<
int32_t fromSlots >
85 bool operator != (
const LFVector& rhs )
const {
return !(*
this == rhs); }
87 bool empty()
const {
return size_ == 0; }
88 size_t size()
const {
return size_; }
130 void expand(
const size_t newSize,
const T& item = T( ));
145 void push_back(
const T& item,
bool lock =
true );
211 void resize(
const size_t size,
const T& value = T( ));
233 template<
int32_t fromSlots >
236 void push_back_unlocked_(
const T& item );
243 std::ostream& operator << ( std::ostream& os, const LFVector< T >& v );
247 #include "lfVector.ipp"
249 #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.