Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
ScopedPtrVect< T > Class Template Reference

#include "lib/scoped-ptrvect.hpp"

Description

template<class T>
class lib::ScopedPtrVect< T >

Simple vector based collection of pointers, managing lifecycle of the pointed-to objects.

Implemented as a non-copyable object, based on a vector of bare pointers.

Definition at line 67 of file scoped-ptrvect.hpp.

Public Types

typedef size_t size_type
 
typedef T value_type
 
typedef T & reference
 
typedef T const & const_reference
 
using iterator = IterType
 
using const_iterator = ConstIterType
 

Public Member Functions

 ~ScopedPtrVect ()
 
 ScopedPtrVect ()
 
 ScopedPtrVect (size_type capacity)
 
 ScopedPtrVect (ScopedPtrVect &&src)
 
ScopedPtrVectoperator= (ScopedPtrVect &&other)
 
T & manage (T *obj)
 take ownership of the given object, adding it at the end of the collection
 
T * detach (void *objAddress)
 withdraw responsibility for a specific object.
 
void clear ()
 
T & operator[] (size_type i)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
size_type size () const
 
size_type max_size () const
 
size_type capacity () const
 
bool empty () const
 

Friends

void swap (ScopedPtrVect &left, ScopedPtrVect &right)
 

Private Types

using _Vec = std::vector< T * >
 
using VIter = _Vec::iterator
 
using RIter = RangeIter< VIter >
 
using IterType = PtrDerefIter< RIter >
 
using ConstIterType = IterType::ConstIterType
 
using RcIter = IterType::WrappedConstIterType
 

Private Member Functions

T * get (size_type i)
 
RIter allPtrs ()
 
RIter allPtrs () const
 
- Private Member Functions inherited from MoveAssign
 ~MoveAssign ()=default
 
 MoveAssign ()=default
 
 MoveAssign (MoveAssign &&)=default
 
 MoveAssign (MoveAssign const &)=delete
 
MoveAssignoperator= (MoveAssign &&)=default
 
MoveAssignoperator= (MoveAssign const &)=delete
 

Private Attributes

_Vec vec_
 

Constructor & Destructor Documentation

◆ ~ScopedPtrVect()

template<class T >
~ScopedPtrVect ( )
inline

Definition at line 89 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::clear().

+ Here is the call graph for this function:

◆ ScopedPtrVect() [1/3]

template<class T >
ScopedPtrVect ( )
inline

Definition at line 94 of file scoped-ptrvect.hpp.

◆ ScopedPtrVect() [2/3]

template<class T >
ScopedPtrVect ( size_type  capacity)
inlineexplicit

Definition at line 99 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::capacity(), and ScopedPtrVect< T >::vec_.

+ Here is the call graph for this function:

◆ ScopedPtrVect() [3/3]

template<class T >
ScopedPtrVect ( ScopedPtrVect< T > &&  src)
inline

Definition at line 105 of file scoped-ptrvect.hpp.

Member Typedef Documentation

◆ _Vec

template<class T >
using _Vec = std::vector<T*>
private

Definition at line 70 of file scoped-ptrvect.hpp.

◆ VIter

template<class T >
using VIter = _Vec::iterator
private

Definition at line 71 of file scoped-ptrvect.hpp.

◆ RIter

template<class T >
using RIter = RangeIter<VIter>
private

Definition at line 73 of file scoped-ptrvect.hpp.

◆ IterType

template<class T >
using IterType = PtrDerefIter<RIter>
private

Definition at line 74 of file scoped-ptrvect.hpp.

◆ ConstIterType

template<class T >
using ConstIterType = IterType::ConstIterType
private

Definition at line 76 of file scoped-ptrvect.hpp.

◆ RcIter

template<class T >
using RcIter = IterType::WrappedConstIterType
private

Definition at line 77 of file scoped-ptrvect.hpp.

◆ size_type

template<class T >
typedef size_t size_type

Definition at line 82 of file scoped-ptrvect.hpp.

◆ value_type

template<class T >
typedef T value_type

Definition at line 83 of file scoped-ptrvect.hpp.

◆ reference

template<class T >
typedef T& reference

Definition at line 84 of file scoped-ptrvect.hpp.

◆ const_reference

template<class T >
typedef T const& const_reference

Definition at line 85 of file scoped-ptrvect.hpp.

◆ iterator

template<class T >
using iterator = IterType

Definition at line 191 of file scoped-ptrvect.hpp.

◆ const_iterator

template<class T >
using const_iterator = ConstIterType

Definition at line 192 of file scoped-ptrvect.hpp.

Member Function Documentation

◆ operator=()

template<class T >
ScopedPtrVect & operator= ( ScopedPtrVect< T > &&  other)
inline

Definition at line 116 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::swap.

◆ manage()

template<class T >
T & manage ( T *  obj)
inline

take ownership of the given object, adding it at the end of the collection

Note
object is deleted in case of any problem while adding it

Definition at line 129 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::vec_.

Referenced by DiagnosticOutputSlot::build(), and BlockPool::createBlock().

+ Here is the caller graph for this function:

◆ detach()

template<class T >
T * detach ( void *  objAddress)
inline

withdraw responsibility for a specific object.

This object will be removed form this collection and returned as-is; it won't be deleted when the ScopedPtrVect goes out of scope.

Parameters
objaddress of the object in question.
Returns
pointer to the object, if found. Otherwise, NULL will be returned and the collection of managed objects remains unaltered
Note
EX_STRONG

Definition at line 155 of file scoped-ptrvect.hpp.

References std::find(), and ScopedPtrVect< T >::vec_.

Referenced by BlockPool::transferResponsibility().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clear()

template<class T >
void clear ( )
inline

Definition at line 170 of file scoped-ptrvect.hpp.

References ERROR_LOG_AND_IGNORE, and ScopedPtrVect< T >::vec_.

Referenced by ScopedPtrVect< T >::~ScopedPtrVect().

+ Here is the caller graph for this function:

◆ operator[]()

template<class T >
T & operator[] ( size_type  i)
inline

Definition at line 186 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::get().

+ Here is the call graph for this function:

◆ begin() [1/2]

template<class T >
iterator begin ( )
inline

Definition at line 194 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::allPtrs().

+ Here is the call graph for this function:

◆ end() [1/2]

template<class T >
iterator end ( )
inline

Definition at line 195 of file scoped-ptrvect.hpp.

◆ begin() [2/2]

template<class T >
const_iterator begin ( ) const
inline

Definition at line 196 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::allPtrs().

+ Here is the call graph for this function:

◆ end() [2/2]

template<class T >
const_iterator end ( ) const
inline

Definition at line 197 of file scoped-ptrvect.hpp.

◆ size()

template<class T >
size_type size ( ) const
inline

Definition at line 204 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::vec_.

Referenced by BlockPool::prepare_for(), and BlockPool::size().

+ Here is the caller graph for this function:

◆ max_size()

template<class T >
size_type max_size ( ) const
inline

Definition at line 205 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::vec_.

◆ capacity()

template<class T >
size_type capacity ( ) const
inline

Definition at line 206 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::vec_.

Referenced by ScopedPtrVect< T >::ScopedPtrVect().

+ Here is the caller graph for this function:

◆ empty()

template<class T >
bool empty ( ) const
inline

Definition at line 207 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::vec_.

Referenced by BlockPool::isValid().

+ Here is the caller graph for this function:

◆ get()

template<class T >
T * get ( size_type  i)
inlineprivate

element access, including range and null check

Definition at line 213 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::vec_.

Referenced by WrappedStandardExeBuilder::invokeOriginalBuilder(), and ScopedPtrVect< T >::operator[]().

+ Here is the caller graph for this function:

◆ allPtrs() [1/2]

template<class T >
RIter allPtrs ( )
inlineprivate

access sequence of all managed pointers

Definition at line 224 of file scoped-ptrvect.hpp.

References ScopedPtrVect< T >::vec_.

Referenced by ScopedPtrVect< T >::begin(), and ScopedPtrVect< T >::begin().

+ Here is the caller graph for this function:

◆ allPtrs() [2/2]

template<class T >
RIter allPtrs ( ) const
inlineprivate

Definition at line 229 of file scoped-ptrvect.hpp.

References lib::elements(), and util::unConst().

+ Here is the call graph for this function:

Member Data Documentation

◆ vec_

Friends And Related Symbol Documentation

◆ swap

template<class T >
void swap ( ScopedPtrVect< T > &  left,
ScopedPtrVect< T > &  right 
)
friend

Definition at line 110 of file scoped-ptrvect.hpp.

Referenced by ScopedPtrVect< T >::operator=().

+ Inheritance diagram for ScopedPtrVect< T >:
+ Collaboration diagram for ScopedPtrVect< T >:

The documentation for this class was generated from the following file: