2 #ifndef _MADARA_UTILITY_THREADSAFE_VECTOR_H_
3 #define _MADARA_UTILITY_THREADSAFE_VECTOR_H_
6 #include "madara/LockType.h"
52 void operator=(
const std::vector<T>& rhs);
66 inline const T&
operator[](
size_t index)
const;
73 inline size_t erase(
size_t index);
85 inline const T&
back(
void)
const;
103 inline void reserve(
size_t new_size)
const;
109 inline void resize(
size_t new_size)
const;
115 inline size_t size(
void)
const;
126 inline void clear(
void);
131 inline void lock(
void)
const;
136 inline void unlock(
void)
const;
141 inline void acquire(
void)
const;
146 inline void release(
void)
const;
Manages a thread safe STL vector.
ThreadSafeVector(void)
Constructor.
void release(void) const
Unlocks the mutex.
T pop_back(void)
Returns the last element before removing it.
size_t max_size(void) const
returns the max size of the vector
T & operator[](size_t index)
Accesses an element of the vector.
size_t size(void) const
returns the current size of the vector
void resize(size_t new_size) const
Resizes the vector.
virtual ~ThreadSafeVector(void)
Destructor.
size_t erase(size_t index)
Erases an element.
void unlock(void) const
Unlocks the mutex.
void lock(void) const
Locks the mutex.
void acquire(void) const
Locks the mutex.
std::vector< T > vector_
the encapsulated vector
void clear(void)
Clears the vector.
void push_back(T &value)
Pushes a value onto the end of the vector.
void reserve(size_t new_size) const
Reserves a number of elements the vector.
const T & back(void) const
Returns the last element of the vector.
void operator=(const ThreadSafeVector &rhs)
Assignment operator.
MADARA_LOCK_TYPE mutex_
mutex for updating refcount_
Provides utility functions and classes for common tasks and needs.
Copyright(c) 2020 Galois.