MADARA
3.4.1
|
Manages a thread safe STL vector. More...
#include <ThreadSafeVector.h>
Public Member Functions | |
ThreadSafeVector (const std::vector< T > &rhs) | |
Copy constructor. More... | |
ThreadSafeVector (const ThreadSafeVector &rhs) | |
Copy constructor. More... | |
ThreadSafeVector (void) | |
Constructor. More... | |
virtual | ~ThreadSafeVector (void) |
Destructor. More... | |
void | acquire (void) const |
Locks the mutex. More... | |
T & | back (void) |
Returns the last element of the vector. More... | |
const T & | back (void) const |
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 std::vector< T > &rhs) |
Assignment operator. More... | |
void | operator= (const ThreadSafeVector &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 17 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 21 of file ThreadSafeVector.cpp.
|
inline |
Locks the mutex.
Definition at line 155 of file ThreadSafeVector.cpp.
|
inline |
Returns the last element of the vector.
Definition at line 107 of file ThreadSafeVector.cpp.
|
inline |
Returns the last element of the vector.
Definition at line 79 of file ThreadSafeVector.cpp.
|
inline |
Clears the vector.
Definition at line 142 of file ThreadSafeVector.cpp.
|
inline |
Erases an element.
index | index of element to erase |
Definition at line 96 of file ThreadSafeVector.cpp.
|
inline |
Locks the mutex.
Definition at line 149 of file ThreadSafeVector.cpp.
|
inline |
returns the max size of the vector
Definition at line 135 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 47 of file ThreadSafeVector.cpp.
void madara::utility::ThreadSafeVector< T >::operator= | ( | const ThreadSafeVector< T > & | rhs | ) |
Assignment operator.
rhs | a vector to copy |
Definition at line 34 of file ThreadSafeVector.cpp.
|
inline |
Accesses an element of the vector.
index | index to access |
Definition at line 58 of file ThreadSafeVector.cpp.
|
inline |
Accesses an element of the vector.
index | index to access |
Definition at line 65 of file ThreadSafeVector.cpp.
|
inline |
Returns the last element before removing it.
Definition at line 86 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 72 of file ThreadSafeVector.cpp.
|
inline |
Unlocks the mutex.
Definition at line 167 of file ThreadSafeVector.cpp.
|
inline |
Reserves a number of elements the vector.
new_size | the new size |
Definition at line 121 of file ThreadSafeVector.cpp.
|
inline |
Resizes the vector.
new_size | the new size |
Definition at line 114 of file ThreadSafeVector.cpp.
|
inline |
returns the current size of the vector
Definition at line 128 of file ThreadSafeVector.cpp.
|
inline |
Unlocks the mutex.
Definition at line 161 of file ThreadSafeVector.cpp.
|
mutableprivate |
mutex for updating refcount_
Definition at line 150 of file ThreadSafeVector.h.
|
private |
the encapsulated vector
Definition at line 153 of file ThreadSafeVector.h.