RTI Connext Modern C++ API
Version 6.1.0
|
<<value-type>> A bounded sequence of elements More...
#include <rti/core/BoundedSequence.hpp>
Public Types | |
typedef std::vector< T > | vector_type |
The type of the underlying vector. More... | |
typedef vector_type::value_type | value_type |
The type of the elements, T . More... | |
typedef vector_type::allocator_type | allocator_type |
The allocator type of the underlying vector. More... | |
typedef vector_type::size_type | size_type |
The size type. More... | |
typedef vector_type::difference_type | difference_type |
The difference type. More... | |
typedef vector_type::reference | reference |
The reference type. More... | |
typedef vector_type::const_reference | const_reference |
The const reference type. More... | |
typedef vector_type::pointer | pointer |
The pointer type. More... | |
typedef vector_type::const_pointer | const_pointer |
The const pointer type. More... | |
typedef vector_type::iterator | iterator |
The iterator type. More... | |
typedef vector_type::const_iterator | const_iterator |
The const iterator type. More... | |
typedef vector_type::reverse_iterator | reverse_iterator |
The reverse iterator type. More... | |
typedef vector_type::const_reverse_iterator | const_reverse_iterator |
The const reverse iterator type. More... | |
Public Member Functions | |
bounded_sequence () | |
Creates an empty bounded_sequence. More... | |
bounded_sequence (const bounded_sequence &other) | |
Copy constructor. More... | |
template<size_t M> | |
bounded_sequence (const bounded_sequence< T, M > &other) | |
Copies a bounded sequence with a different bound M . More... | |
bounded_sequence (size_type count) | |
Create a bounded_sequence with a number of default-construced elements. More... | |
bounded_sequence (size_type count, const value_type &value) | |
Create a bounded_sequence with a number of elements. More... | |
template<typename InputIt > | |
bounded_sequence (InputIt first, InputIt last) | |
Create a bounded_sequence from a range of elements. More... | |
bounded_sequence (const std::vector< T > &v) | |
Create a bounded_sequence copying the elements of a std::vector. More... | |
bounded_sequence (bounded_sequence &&other) OMG_NOEXCEPT | |
<<C++11>> Move constructor More... | |
bounded_sequence (std::vector< T > &&v) | |
<<C++11>> Creates a bounded_sequence by moving a std::vector More... | |
bounded_sequence & | operator= (const bounded_sequence &other) |
Assignment operator. More... | |
template<typename U , size_t M> | |
bounded_sequence & | operator= (const bounded_sequence< U, M > &other) |
Copies the elements of a sequence with a different bound. More... | |
bounded_sequence & | operator= (const std::vector< T > &v) |
Copies the elements of a std::vector. More... | |
bounded_sequence & | operator= (bounded_sequence &&other) OMG_NOEXCEPT |
<<C++11>> Move-assignment operator More... | |
bounded_sequence & | operator= (std::vector< T > &&v) |
<<C++11>> Moves a std::vector into this bounded_sequence More... | |
bounded_sequence & | operator= (std::initializer_list< T > l) |
<<C++11>> Copies the elements in an initializer_list More... | |
reference | operator[] (size_type pos) |
Index access. More... | |
const_reference | operator[] (size_type pos) const |
Index access. More... | |
reference | at (size_type pos) |
Index access with bounds check. More... | |
const_reference | at (size_type pos) const |
Index access with bounds check. More... | |
reference | front () |
Returns a reference to the first element. More... | |
const_reference | front () const |
Returns a const reference to the first element. More... | |
reference | back () |
Returns a reference to the last element. More... | |
const_reference | back () const |
Returns a const reference to the last element. More... | |
pointer | data () |
Returns a pointer to the underlying data buffer. More... | |
const_pointer | data () const |
Returns a pointer to the underlying data buffer. More... | |
iterator | begin () OMG_NOEXCEPT |
Returns an iterator to the first element. More... | |
const_iterator | begin () const OMG_NOEXCEPT |
Returns an const iterator to the first element. More... | |
const_iterator | cbegin () const OMG_NOEXCEPT |
Returns an const iterator to the first element. More... | |
iterator | end () OMG_NOEXCEPT |
Returns an iterator to one past the last element. More... | |
const_iterator | end () const OMG_NOEXCEPT |
Returns an const iterator to one past the last element. More... | |
const_iterator | cend () const OMG_NOEXCEPT |
Returns a const iterator to one past the last element. More... | |
reverse_iterator | rbegin () OMG_NOEXCEPT |
Returns an iterator to the reverse-beginning of the sequence. More... | |
const_reverse_iterator | rbegin () const OMG_NOEXCEPT |
Returns a const iterator to the reverse-beginning of the sequence. More... | |
const_reverse_iterator | crbegin () const OMG_NOEXCEPT |
Returns a const iterator to the reverse-beginning of the sequence. More... | |
reverse_iterator | rend () OMG_NOEXCEPT |
Returns an iterator to the reverse-end of the sequence. More... | |
const_reverse_iterator | crend () const OMG_NOEXCEPT |
Returns a const iterator to the reverse-end of the sequence. More... | |
bool | empty () const OMG_NOEXCEPT |
Returns whether there are no elements. More... | |
size_type | size () const OMG_NOEXCEPT |
Returns the number of elements. More... | |
size_type | max_size () const OMG_NOEXCEPT |
Returns MaxLength . More... | |
void | reserve (size_type new_capacity) |
Pre-allocates elements up to new_capacity. More... | |
size_type | capacity () const OMG_NOEXCEPT |
Returns the current capacity. More... | |
void | clear () OMG_NOEXCEPT |
Removes the elements. More... | |
void | shrink_to_fit () |
Destroys any extra elements reserved above the current size. More... | |
iterator | insert (iterator pos, const T &value) |
Inserts a new element in a position specified by an iterator. More... | |
iterator | erase (iterator pos) |
Erases an element specified by an iterator. More... | |
void | push_back (const T &value) |
Adds a new element at the end. More... | |
void | push_back (T &&value) |
Adds a new element at the end by moving it. More... | |
void | pop_back () |
Removes the last element. More... | |
void | resize (size_type count) |
Resizes the container to contain count elements. More... | |
void | resize (size_type count, const T &value) |
Resizes the container to contain count elements. More... | |
void | swap (bounded_sequence &other) OMG_NOEXCEPT |
Swap the contents of two sequences. More... | |
<<value-type>> A bounded sequence of elements
T | The element type |
MaxLength | The maximum number of elements |
IDL bounded sequences map to this type, as described in Working with IDL types.
This type has a interface similar to std::vector, but it differs in two aspects:
MaxLength
, in its operations. Operations that would make the sequence grow beyond the limit throw dds::core::PreconditionNotMetError
.typedef std::vector<T> rti::core::bounded_sequence< T, MaxLength >::vector_type |
The type of the underlying vector.
typedef vector_type::value_type rti::core::bounded_sequence< T, MaxLength >::value_type |
The type of the elements, T
.
typedef vector_type::allocator_type rti::core::bounded_sequence< T, MaxLength >::allocator_type |
The allocator type of the underlying vector.
typedef vector_type::size_type rti::core::bounded_sequence< T, MaxLength >::size_type |
The size type.
typedef vector_type::difference_type rti::core::bounded_sequence< T, MaxLength >::difference_type |
The difference type.
typedef vector_type::reference rti::core::bounded_sequence< T, MaxLength >::reference |
The reference type.
typedef vector_type::const_reference rti::core::bounded_sequence< T, MaxLength >::const_reference |
The const reference type.
typedef vector_type::pointer rti::core::bounded_sequence< T, MaxLength >::pointer |
The pointer type.
typedef vector_type::const_pointer rti::core::bounded_sequence< T, MaxLength >::const_pointer |
The const pointer type.
typedef vector_type::iterator rti::core::bounded_sequence< T, MaxLength >::iterator |
The iterator type.
typedef vector_type::const_iterator rti::core::bounded_sequence< T, MaxLength >::const_iterator |
The const iterator type.
typedef vector_type::reverse_iterator rti::core::bounded_sequence< T, MaxLength >::reverse_iterator |
The reverse iterator type.
typedef vector_type::const_reverse_iterator rti::core::bounded_sequence< T, MaxLength >::const_reverse_iterator |
The const reverse iterator type.
|
inline |
Creates an empty bounded_sequence.
|
inline |
Copy constructor.
|
inlineexplicit |
Copies a bounded sequence with a different bound M
.
dds::core::PreconditionNotMetError | if other.size() > MaxLength |
|
inline |
Create a bounded_sequence with a number of default-construced elements.
|
inline |
Create a bounded_sequence with a number of elements.
|
inline |
Create a bounded_sequence from a range of elements.
|
inline |
Create a bounded_sequence copying the elements of a std::vector.
dds::core::PreconditionNotMetError | if v.size() > MaxLength |
|
inline |
<<C++11>> Move constructor
|
inline |
<<C++11>> Creates a bounded_sequence by moving a std::vector
|
inline |
Assignment operator.
References rti::core::bounded_sequence< T, MaxLength >::begin(), rti::core::bounded_sequence< T, MaxLength >::end(), and rti::core::bounded_sequence< T, MaxLength >::size().
|
inline |
Copies the elements of a sequence with a different bound.
dds::core::PreconditionNotMetError | if other.size() > MaxLength |
References rti::core::bounded_sequence< T, MaxLength >::begin(), rti::core::bounded_sequence< T, MaxLength >::end(), and rti::core::bounded_sequence< T, MaxLength >::size().
|
inline |
Copies the elements of a std::vector.
|
inline |
<<C++11>> Move-assignment operator
|
inline |
<<C++11>> Moves a std::vector into this bounded_sequence
References rti::core::bounded_sequence< T, MaxLength >::size().
|
inline |
<<C++11>> Copies the elements in an initializer_list
l | The initializer list |
|
inline |
Index access.
|
inline |
Index access.
|
inline |
Index access with bounds check.
std::out_of_range | if pos is >= size() |
|
inline |
Index access with bounds check.
std::out_of_range | if pos is >= size() |
|
inline |
Returns a reference to the first element.
|
inline |
Returns a const reference to the first element.
|
inline |
Returns a reference to the last element.
|
inline |
Returns a const reference to the last element.
|
inline |
Returns a pointer to the underlying data buffer.
|
inline |
Returns a pointer to the underlying data buffer.
|
inline |
Returns an iterator to the first element.
Referenced by rti::core::bounded_sequence< T, MaxLength >::operator=(), and rti::core::bounded_sequence< T, MaxLength >::swap().
|
inline |
Returns an const iterator to the first element.
|
inline |
Returns an const iterator to the first element.
|
inline |
Returns an iterator to one past the last element.
Referenced by rti::core::bounded_sequence< T, MaxLength >::operator=(), and rti::core::bounded_sequence< T, MaxLength >::swap().
|
inline |
Returns an const iterator to one past the last element.
|
inline |
Returns a const iterator to one past the last element.
|
inline |
Returns an iterator to the reverse-beginning of the sequence.
|
inline |
Returns a const iterator to the reverse-beginning of the sequence.
|
inline |
Returns a const iterator to the reverse-beginning of the sequence.
|
inline |
Returns an iterator to the reverse-end of the sequence.
|
inline |
Returns a const iterator to the reverse-end of the sequence.
|
inline |
Returns whether there are no elements.
|
inline |
Returns the number of elements.
Referenced by rti::core::bounded_sequence< T, MaxLength >::operator=(), and rti::core::bounded_sequence< T, MaxLength >::swap().
|
inline |
Returns MaxLength
.
|
inline |
Pre-allocates elements up to new_capacity.
This operation reserves space for new_capacity
elements and, unlike std::vector, it also default-constructs the extra elements. The size() remains the same.
|
inline |
Returns the current capacity.
|
inline |
Removes the elements.
This operation resizes the sequence to 0, but it doesn't destroy the elements, like std::vector would.
To destroy the elements, follow with a call to shrink_to_fit.
|
inline |
Destroys any extra elements reserved above the current size.
Note that resize() or clear() alone won't destroy the extra elements when they reduce the size of a sequence.
For example
|
inline |
Inserts a new element in a position specified by an iterator.
dds::core::PreconditionNotMetError | if size() == MaxLength |
|
inline |
Erases an element specified by an iterator.
|
inline |
Adds a new element at the end.
dds::core::PreconditionNotMetError | if size() == MaxLength |
|
inline |
Adds a new element at the end by moving it.
dds::core::PreconditionNotMetError | if size() == MaxLength |
|
inline |
Removes the last element.
The element removed is not destroyed. To destroy it, follow pop_back with a call to shrink_to_fit.
|
inline |
Resizes the container to contain count elements.
If count < size(), the sequence is reduced to the first count elements, but elements are not destroyed.
If count > size(), the sequence is expanded as follows: if capacity() >= count, new elements are not constructed, since they already had been. If capacity() < count, the extra elements are default-constructed.
dds::core::PreconditionNotMetError | if count > MaxLength |
|
inline |
Resizes the container to contain count elements.
This overload specifies the value.
|
inline |
Swap the contents of two sequences.
References rti::core::bounded_sequence< T, MaxLength >::begin(), rti::core::bounded_sequence< T, MaxLength >::end(), rti::core::bounded_sequence< T, MaxLength >::size(), and rti::core::bounded_sequence< T, MaxLength >::swap().
Referenced by rti::core::bounded_sequence< T, MaxLength >::swap().