MADARA
3.1.8
|
Manages a thread safe STL vector. More...
#include <ThreadSafeVector.h>
Public Member Functions | |
ThreadSafeVector (void) | |
Constructor. More... | |
ThreadSafeVector (const ThreadSafeVector &rhs) | |
Copy constructor. More... | |
ThreadSafeVector (const std::vector< T > &rhs) | |
Copy constructor. More... | |
virtual | ~ThreadSafeVector (void) |
Destructor. More... | |
void | acquire (void) const |
Locks the mutex. More... | |
const T & | back (void) const |
Returns the last element of the vector. More... | |
T & | back (void) |
Returns the last element of the vector. More... | |
void | clear (void) |
Clears the vector. More... | |
size_t | erase (size_t index) |
Erases an element. More... | |
void | lock (void) const |
Locks the mutex. More... | |
size_t | max_size (void) const |
returns the max size of the vector More... | |
void | operator= (const ThreadSafeVector &rhs) |
Assignment operator. More... | |
void | operator= (const std::vector< T > &rhs) |
Assignment operator. More... | |
T & | operator[] (size_t index) |
Accesses an element of the vector. More... | |
const T & | operator[] (size_t index) const |
Accesses an element of the vector. More... | |
T | pop_back (void) |
Returns the last element before removing it. More... | |
void | push_back (T &value) |
Pushes a value onto the end of the vector. More... | |
void | release (void) const |
Unlocks the mutex. More... | |
void | reserve (size_t new_size) const |
Reserves a number of elements the vector. More... | |
void | resize (size_t new_size) const |
Resizes the vector. More... | |
size_t | size (void) const |
returns the current size of the vector More... | |
void | unlock (void) const |
Unlocks the mutex. More... | |
Private Attributes | |
MADARA_LOCK_TYPE | mutex_ |
mutex for updating refcount_ More... | |
std::vector< T > | vector_ |
the encapsulated vector More... | |
Manages a thread safe STL vector.
Definition at line 19 of file ThreadSafeVector.h.
madara::utility::ThreadSafeVector< T >::ThreadSafeVector | ( | void | ) |
Constructor.
Definition at line 8 of file ThreadSafeVector.cpp.
madara::utility::ThreadSafeVector< T >::ThreadSafeVector | ( | const ThreadSafeVector< T > & | rhs | ) |
Copy constructor.
rhs | the vector to copy |
Definition at line 13 of file ThreadSafeVector.cpp.
madara::utility::ThreadSafeVector< T >::ThreadSafeVector | ( | const std::vector< T > & | rhs | ) |
Copy constructor.
rhs | the vector to copy |
Definition at line 21 of file ThreadSafeVector.cpp.
|
virtual |
Destructor.
Definition at line 28 of file ThreadSafeVector.cpp.
|
inline |
Locks the mutex.
Definition at line 156 of file ThreadSafeVector.cpp.
|
inline |
Returns the last element of the vector.
Definition at line 80 of file ThreadSafeVector.cpp.
|
inline |
Returns the last element of the vector.
Definition at line 108 of file ThreadSafeVector.cpp.
|
inline |
Clears the vector.
Definition at line 143 of file ThreadSafeVector.cpp.
|
inline |
Erases an element.
index | index of element to erase |
Definition at line 97 of file ThreadSafeVector.cpp.
|
inline |
Locks the mutex.
Definition at line 150 of file ThreadSafeVector.cpp.
|
inline |
returns the max size of the vector
Definition at line 136 of file ThreadSafeVector.cpp.
void madara::utility::ThreadSafeVector< T >::operator= | ( | const ThreadSafeVector< T > & | rhs | ) |
Assignment operator.
rhs | a vector to copy |
Definition at line 35 of file ThreadSafeVector.cpp.
void madara::utility::ThreadSafeVector< T >::operator= | ( | const std::vector< T > & | rhs | ) |
Assignment operator.
rhs | a vector to copy |
Definition at line 48 of file ThreadSafeVector.cpp.
|
inline |
Accesses an element of the vector.
index | index to access |
Definition at line 59 of file ThreadSafeVector.cpp.
|
inline |
Accesses an element of the vector.
index | index to access |
Definition at line 66 of file ThreadSafeVector.cpp.
|
inline |
Returns the last element before removing it.
Definition at line 87 of file ThreadSafeVector.cpp.
|
inline |
Pushes a value onto the end of the vector.
value | a value to add to the end of the vector |
Definition at line 73 of file ThreadSafeVector.cpp.
|
inline |
Unlocks the mutex.
Definition at line 168 of file ThreadSafeVector.cpp.
|
inline |
Reserves a number of elements the vector.
new_size | the new size |
Definition at line 122 of file ThreadSafeVector.cpp.
|
inline |
Resizes the vector.
new_size | the new size |
Definition at line 115 of file ThreadSafeVector.cpp.
|
inline |
returns the current size of the vector
Definition at line 129 of file ThreadSafeVector.cpp.
|
inline |
Unlocks the mutex.
Definition at line 162 of file ThreadSafeVector.cpp.
|
mutableprivate |
mutex for updating refcount_
Definition at line 155 of file ThreadSafeVector.h.
|
private |
the encapsulated vector
Definition at line 158 of file ThreadSafeVector.h.