2 #ifndef _MADARA_UTILITY_THREADSAFE_VECTOR_H_ 3 #define _MADARA_UTILITY_THREADSAFE_VECTOR_H_ 6 #include "ace/Guard_T.h" 7 #include "ace/Recursive_Thread_Mutex.h" 8 #include "madara/LockType.h" 54 void operator= (
const std::vector<T> & rhs);
68 inline const T &
operator[] (
size_t index)
const;
75 inline size_t erase (
size_t index);
87 inline const T &
back (
void)
const;
93 inline T &
back (
void);
105 inline void reserve (
size_t new_size)
const;
111 inline void resize (
size_t new_size)
const;
117 inline size_t size (
void)
const;
123 inline size_t max_size (
void)
const;
128 inline void clear (
void);
133 inline void lock (
void)
const;
138 inline void unlock (
void)
const;
143 inline void acquire (
void)
const;
148 inline void release (
void)
const;
MADARA_LOCK_TYPE mutex_
mutex for updating refcount_
void lock(void) const
Locks the mutex.
void resize(size_t new_size) const
Resizes the vector.
void push_back(T &value)
Pushes a value onto the end of the vector.
void acquire(void) const
Locks the mutex.
size_t max_size(void) const
returns the max size of the vector
void release(void) const
Unlocks the mutex.
virtual ~ThreadSafeVector(void)
Destructor.
void unlock(void) const
Unlocks the mutex.
ThreadSafeVector(void)
Constructor.
const T & back(void) const
Returns the last element of the vector.
size_t size(void) const
returns the current size of the vector
T & operator[](size_t index)
Accesses an element of the vector.
T pop_back(void)
Returns the last element before removing it.
void clear(void)
Clears the vector.
void reserve(size_t new_size) const
Reserves a number of elements the vector.
size_t erase(size_t index)
Erases an element.
Provides utility functions and classes for common tasks and needs.
Manages a thread safe STL vector.
Copyright (c) 2015 Carnegie Mellon University.
std::vector< T > vector_
the encapsulated vector
void operator=(const ThreadSafeVector &rhs)
Assignment operator.