artdaq_core
v3_06_01
|
A QuickVec behaves like a std::vector, but does no initialization of its data, making it faster at the cost of having to ensure that uninitialized data is not read. More...
#include <artdaq-core/Core/QuickVec.hh>
Public Types | |
typedef TT_ * | iterator |
Iterator is pointer-to-member type. | |
typedef const TT_ * | const_iterator |
const_iterator is const-pointer-to-member type | |
typedef TT_ & | reference |
reference is reference-to-member tpye | |
typedef const TT_ & | const_reference |
const_reference is const-reference-to-member type | |
typedef TT_ | value_type |
value_type is member type | |
typedef ptrdiff_t | difference_type |
difference_type is ptrdiff_t | |
typedef size_t | size_type |
size_type is size_t | |
Public Member Functions | |
QuickVec (size_t sz) | |
Allocates a QuickVec object, doing no initialization of allocated memory. More... | |
QuickVec (size_t sz, TT_ val) | |
Allocates a QuickVec object, initializing each element to the given value. More... | |
virtual | ~QuickVec () noexcept |
Destructor calls free on data. | |
QuickVec (std::vector< TT_ > &other) | |
Copies the contents of a std::vector into a new QuickVec object. More... | |
void | clear () |
Sets the size to 0. QuickVec does not reinitialize memory, so no further action will be taken. | |
QuickVec (const QuickVec &other) | |
Copy Constructor. More... | |
QuickVec< TT_ > & | operator= (const QuickVec &other) |
Copy assignment operator. More... | |
TT_ & | operator[] (int idx) |
Returns a reference to a given element. More... | |
const TT_ & | operator[] (int idx) const |
Returns a const reference to a given element. More... | |
size_t | size () const |
Accesses the current size of the QuickVec. More... | |
size_t | capacity () const |
Accesses the current capacity of the QuickVec. More... | |
iterator | begin () |
Gets an iterator to the beginning of the QuickVec. More... | |
const_iterator | begin () const |
Gets a const_iterator to the beginning of the QuickVec. More... | |
iterator | end () |
Gets an iterator to the end of the QuickVec. More... | |
const_iterator | end () const |
Gets a const_iterator to the end of the QuickVec. More... | |
void | reserve (size_t size) |
Allocates memory for the QuickVec so that its capacity is at least size. More... | |
void | resize (size_t size) |
Resizes the QuickVec. More... | |
void | resizeWithCushion (size_t size, double growthFactor=1.3) |
Resizes the QuickVec and requests additional capacity. More... | |
void | resize (size_t size, TT_ val) |
Resizes the QuickVec, initializes new elements with val. More... | |
iterator | insert (const_iterator position, size_t nn, const TT_ &val) |
Inserts an element into the QuickVec. More... | |
iterator | insert (const_iterator position, const_iterator first, const_iterator last) |
Inserts a range of elements into the QuickVec. More... | |
iterator | erase (const_iterator first, const_iterator last) |
Erases elements in given range from the QuickVec. More... | |
void | swap (QuickVec &other) noexcept |
Exchanges references to two QuickVec objects. More... | |
void | push_back (const value_type &val) |
Adds a value to the QuickVec, resizing if necessary (adds 10% capacity) More... | |
Static Public Member Functions | |
static short | Class_Version () |
Returns the current version of the template code \ *. More... | |
A QuickVec behaves like a std::vector, but does no initialization of its data, making it faster at the cost of having to ensure that uninitialized data is not read.
TT_ | The data type stored in the QuickVec |
Definition at line 87 of file QuickVec.hh.
|
inline |
Allocates a QuickVec object, doing no initialization of allocated memory.
sz | Size of QuickVec object to allocate |
Definition at line 345 of file QuickVec.hh.
|
inline |
Allocates a QuickVec object, initializing each element to the given value.
sz | Size of QuickVec object to allocate |
val | Value with which to initialize elements |
Definition at line 354 of file QuickVec.hh.
|
inline |
Copies the contents of a std::vector into a new QuickVec object.
other | The vector to copy |
Definition at line 119 of file QuickVec.hh.
|
inline |
|
inline |
Gets an iterator to the beginning of the QuickVec.
Definition at line 395 of file QuickVec.hh.
|
inline |
Gets a const_iterator to the beginning of the QuickVec.
Definition at line 398 of file QuickVec.hh.
|
inline |
Accesses the current capacity of the QuickVec.
Accesses the current capcity of the QuickVec. Like a vector, the capacity of a QuickVec object is defined as the maximum size it can hold before it must reallocate more memory.
Definition at line 392 of file QuickVec.hh.
|
inlinestatic |
Returns the current version of the template code \ *.
\ *
Definition at line 333 of file QuickVec.hh.
|
inline |
Gets an iterator to the end of the QuickVec.
Definition at line 401 of file QuickVec.hh.
|
inline |
Gets a const_iterator to the end of the QuickVec.
Definition at line 407 of file QuickVec.hh.
|
inline |
Erases elements in given range from the QuickVec.
first | First element to erase |
last | Last element to erase |
Erases elements in given range from the QuickVec. Note that since the underlying data structure resembles a std::vector, erase operations are very inefficient! (O(n))
Definition at line 522 of file QuickVec.hh.
|
inline |
Inserts an element into the QuickVec.
position | Position at which to isnert |
nn | Number of copies of val to insert |
val | Value to insert |
Inserts an element (or copies thereof) into the QuickVec. Note that since the underlying data structure resembles a std::vector, insert operations are very inefficient!
Definition at line 485 of file QuickVec.hh.
|
inline |
Inserts a range of elements into the QuickVec.
position | Position at which to insert |
first | const_iterator to first element to insert |
last | const_iterator to last element to insert |
Inserts elements into the QuickVec. Note that since the underlying data structure resembles a std::vector, insert operations are very inefficient!
Definition at line 503 of file QuickVec.hh.
|
inline |
Copy assignment operator.
other | QuickVec to copy |
Definition at line 152 of file QuickVec.hh.
|
inline |
Returns a reference to a given element.
idx | Element to return |
Definition at line 375 of file QuickVec.hh.
|
inline |
Returns a const reference to a given element.
idx | Element to return |
Definition at line 382 of file QuickVec.hh.
|
inline |
Adds a value to the QuickVec, resizing if necessary (adds 10% capacity)
val | Value to add to the QuickVec |
Definition at line 548 of file QuickVec.hh.
|
inline |
Allocates memory for the QuickVec so that its capacity is at least size.
size | The new capacity of the QuickVec |
Allocates memory for the QuickVec so that its capacity is at least size. If the QuickVec is already at or above size in capacity, no allocation is performed.
Definition at line 413 of file QuickVec.hh.
|
inline |
Resizes the QuickVec.
size | New size of the QuickVec |
If size is smaller than the current size of the QuickVec, then it will change its size_ parameter (no reallocation, capacity does not change). If size is greater than the capacity of the QuickVec, a reallocation will occur.
Definition at line 429 of file QuickVec.hh.
|
inline |
Resizes the QuickVec, initializes new elements with val.
size | New size of the QuickVec |
val | Value with which to initialize elements |
Definition at line 473 of file QuickVec.hh.
|
inline |
Resizes the QuickVec and requests additional capacity.
size | New size of the QuickVec |
growthFactor | Factor to use when allocating additional capacity |
This method updates the size of the QuickVec. If the new size is within the current capacity, no realloction takes place. If not, then the reallocation reserves additional capacity as a cushion against future needs to reallocate, based on the specified growth factor.
Definition at line 448 of file QuickVec.hh.
|
inline |
Accesses the current size of the QuickVec.
Definition at line 389 of file QuickVec.hh.
|
inlinenoexcept |
Exchanges references to two QuickVec objects.
other | Other QuickVec to swap with |
Definition at line 538 of file QuickVec.hh.