PVData C++
8.0.6
|
A holder for a contiguous piece of memory. More...
#include <misc/pv/sharedVector.h>
Public Types | |
typedef E | value_type |
typedef E & | reference |
typedef meta::decorate_const < E >::type & | const_reference |
typedef E * | pointer |
typedef meta::decorate_const < E >::type * | const_pointer |
typedef E * | iterator |
typedef std::reverse_iterator < iterator > | reverse_iterator |
typedef meta::decorate_const < E >::type * | const_iterator |
typedef std::reverse_iterator < const_iterator > | const_reverse_iterator |
typedef ptrdiff_t | difference_type |
typedef size_t | size_type |
typedef E | element_type |
typedef std::tr1::shared_ptr< E > | shared_pointer_type |
Public Member Functions | |
shared_vector () | |
Empty vector (not very interesting) | |
shared_vector (size_t c) | |
Allocate (with new[]) a new vector of size c. | |
shared_vector (size_t c, param_type e) | |
Allocate (with new[]) a new vector of size c and fill with value e. | |
template<typename A > | |
shared_vector (A v, size_t o, size_t c) | |
Build vector from a raw pointer. More... | |
template<typename E1 > | |
shared_vector (const std::tr1::shared_ptr< E1 > &d, size_t o, size_t c) | |
Build vector from an existing smart pointer. More... | |
template<typename A , typename B > | |
shared_vector (A d, B b, size_t o, size_t c) | |
Build vector from raw pointer and cleanup function. More... | |
shared_vector (const shared_vector &o) | |
Copy an existing vector of same type. | |
template<typename FROM > | |
shared_vector (const shared_vector< FROM > &src, detail::_shared_vector_cast_tag) | |
shared_vector (shared_vector< typename base_t::_E_non_const > &O, detail::_shared_vector_freeze_tag t) | |
shared_vector (shared_vector< const E > &O, detail::_shared_vector_thaw_tag t) | |
shared_vector & | operator= (const shared_vector &o) |
size_t | max_size () const |
size_t | capacity () const |
void | reserve (size_t i) |
Set array capacity. More... | |
void | resize (size_t i) |
Grow or shrink array. More... | |
void | resize (size_t i, param_type v) |
Grow (and fill) or shrink array. More... | |
void | make_unique () |
Ensure (by copying) that this shared_vector is the sole owner of the data array. More... | |
iterator | begin () const |
const_iterator | cbegin () const |
iterator | end () const |
const_iterator | cend () const |
reverse_iterator | rbegin () const |
const_reverse_iterator | crbegin () const |
reverse_iterator | rend () const |
const_reverse_iterator | crend () const |
reference | front () const |
reference | back () const |
void | push_back (param_type v) |
void | pop_back () |
pointer | data () const |
Return Base pointer. | |
reference | operator[] (size_t i) const |
Member access Undefined if empty()==true. | |
reference | at (size_t i) const |
Member access. More... | |
Public Member Functions inherited from epics::pvData::detail::shared_vector_base< E > | |
shared_vector_base () | |
Empty vector (not very interesting) | |
template<typename A > | |
shared_vector_base (A *v, size_t o, size_t c) | |
shared_vector_base (const std::tr1::shared_ptr< E > &d, size_t o, size_t c) | |
template<typename A , typename B > | |
shared_vector_base (A d, B b, size_t o, size_t c) | |
shared_vector_base (const shared_vector_base &O) | |
shared_vector_base (shared_vector_base< _E_non_const > &O, _shared_vector_freeze_tag) | |
shared_vector_base (shared_vector< const E > &O, _shared_vector_thaw_tag) | |
shared_vector_base & | operator= (const shared_vector_base &o) |
Copy an existing vector. | |
void | swap (shared_vector_base &o) |
Swap the contents of this vector with another. | |
void | clear () |
Clear contents. size() becomes 0. | |
bool | unique () const |
Data is not shared? | |
size_t | size () const |
Number of elements visible through this vector. | |
bool | empty () const |
shorthand for size()==0 | |
void | slice (size_t offset, size_t length=(size_t)-1) |
Reduce the view of this shared_vector. More... | |
const std::tr1::shared_ptr< E > & | dataPtr () const |
size_t | dataOffset () const |
size_t | dataCount () const |
size_t | dataTotal () const |
Friends | |
template<typename E1 , class Enable1 > | |
class | shared_vector |
Additional Inherited Members | |
Protected Types inherited from epics::pvData::detail::shared_vector_base< E > | |
typedef meta::strip_const< E > ::type | _E_non_const |
Protected Member Functions inherited from epics::pvData::detail::shared_vector_base< E > | |
void | _null_input () |
Protected Attributes inherited from epics::pvData::detail::shared_vector_base< E > | |
std::tr1::shared_ptr< E > | m_sdata |
size_t | m_offset |
Offset in the data array of first visible element. | |
size_t | m_count |
Number of visible elements between m_offset and end of data. | |
size_t | m_total |
Total number of elements between m_offset and the end of data. | |
A holder for a contiguous piece of memory.
Data is shared, but offset and length are not. This allows one vector to have access to only a subset of a piece of memory.
The ways in which shared_vector is intended to differ from std::vector are outlined in Differences between std::vector and shared_vector .
Also see Memory Management with shared_vector and Value const-ness and shared_vector
Definition at line 27 of file sharedVector.h.
|
inline |
Build vector from a raw pointer.
v | A raw pointer allocated with new[]. |
o | The offset in v or the first element visible to the vector |
c | The number of elements pointed to by v+o |
Definition at line 347 of file sharedVector.h.
|
inline |
Build vector from an existing smart pointer.
d | An existing smart pointer |
o | The offset in v or the first element visible to the vector |
c | The number of elements pointed to by v+o |
Definition at line 356 of file sharedVector.h.
|
inline |
Build vector from raw pointer and cleanup function.
d | An existing raw pointer |
b | An function/functor used to free d. Invoked as b(d). |
o | The offset in v or the first element visible to the vector |
c | The number of elements pointed to by v+o |
Definition at line 367 of file sharedVector.h.
|
inline |
Member access.
std::out_of_range | if i>=size(). |
Definition at line 624 of file sharedVector.h.
|
inline |
Ensure (by copying) that this shared_vector is the sole owner of the data array.
If a copy is needed, memory is allocated with new[]. If this is not desirable then do something like the following.
std::bad_alloc | if requested allocation can not be made |
other | exceptions from element copy ctor |
Definition at line 526 of file sharedVector.h.
|
inline |
Set array capacity.
A side effect is that array data will be uniquely owned by this instance as if make_unique() was called. This holds even if the capacity does not increase.
For notes on copying see docs for make_unique().
std::bad_alloc | if requested allocation can not be made |
other | exceptions from element copy ctor |
Definition at line 428 of file sharedVector.h.
|
inline |
Grow or shrink array.
A side effect is that array data will be uniquely owned by this instance as if make_unique() were called. This holds even if the size does not change.
For notes on copying see docs for make_unique().
std::bad_alloc | if requested allocation can not be made |
other | exceptions from element copy ctor |
Definition at line 457 of file sharedVector.h.
|
inline |