KiCad PCB EDA Suite
Loading...
Searching...
No Matches
MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL > Class Template Reference

Multivector container type. More...

#include <multivector.h>

Classes

class  ITERATOR_BASE
 Generic implementation of a flat const/non-const iterator over contained items.The non-const iterator. More...
 

Public Types

typedef boost::ptr_vector< T > ITEM_PTR_VECTOR
 Helper for defining a list of library draw object pointers.
 
typedef ITERATOR_BASE< T, MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
 The const iterator.
 
typedef ITERATOR_BASE< const T, const MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::const_iterator > CONST_ITERATOR
 

Public Member Functions

 MULTIVECTOR ()
 
void push_back (T *aItem)
 
ITERATOR erase (const ITERATOR &aIterator)
 
ITERATOR begin (int aType=UNDEFINED_TYPE)
 
ITERATOR end (int aType=UNDEFINED_TYPE)
 
CONST_ITERATOR begin (int aType=UNDEFINED_TYPE) const
 
CONST_ITERATOR end (int aType=UNDEFINED_TYPE) const
 
void clear (int aType=UNDEFINED_TYPE)
 
size_t size (int aType=UNDEFINED_TYPE) const
 
bool empty (int aType=UNDEFINED_TYPE) const
 
void sort ()
 
void unique ()
 Remove duplicate elements in list.
 
ITEM_PTR_VECTORoperator[] (int aType)
 
const ITEM_PTR_VECTORoperator[] (int aType) const
 

Static Public Attributes

static constexpr int UNDEFINED_TYPE = 0
 Type value to indicate no specific type.
 
static constexpr int FIRST_TYPE = FIRST_TYPE_VAL
 
static constexpr int LAST_TYPE = LAST_TYPE_VAL
 
static constexpr int TYPES_COUNT = LAST_TYPE - FIRST_TYPE + 1
 

Private Member Functions

int first () const
 < Get first non-empty type or first type if all are empty.
 
int last () const
 Contained items by type.
 

Private Attributes

ITEM_PTR_VECTOR m_data [TYPES_COUNT]
 

Detailed Description

template<typename T, int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
class MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >

Multivector container type.

Keeps items segregated by their type in multiple ptr_vectors. Provides both access as a flat list as well as access by type of item.

T is the stored type, needs to provide Type() method used to segregate items. FIRST_TYPE_VAL is the lower boundary value of the types stored in the container. LAST_TYPE_VAL is the upper boundary value of the types stored in the container.

Definition at line 46 of file multivector.h.

Member Typedef Documentation

◆ CONST_ITERATOR

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
typedef ITERATOR_BASE<const T, const MULTIVECTOR<T, FIRST_TYPE_VAL, LAST_TYPE_VAL>, typename ITEM_PTR_VECTOR::const_iterator> MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::CONST_ITERATOR

Definition at line 168 of file multivector.h.

◆ ITEM_PTR_VECTOR

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
typedef boost::ptr_vector<T> MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::ITEM_PTR_VECTOR

Helper for defining a list of library draw object pointers.

The Boost pointer containers are responsible for deleting object pointers placed in them. If you access a object pointer from the list, do not delete it directly.

Definition at line 65 of file multivector.h.

◆ ITERATOR

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
typedef ITERATOR_BASE<T, MULTIVECTOR<T, FIRST_TYPE_VAL, LAST_TYPE_VAL>, typename ITEM_PTR_VECTOR::iterator> MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::ITERATOR

The const iterator.

Definition at line 165 of file multivector.h.

Constructor & Destructor Documentation

◆ MULTIVECTOR()

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::MULTIVECTOR ( )
inline

Definition at line 171 of file multivector.h.

Member Function Documentation

◆ begin() [1/2]

◆ begin() [2/2]

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
CONST_ITERATOR MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::begin ( int  aType = UNDEFINED_TYPE) const
inline

◆ clear()

◆ empty()

◆ end() [1/2]

◆ end() [2/2]

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
CONST_ITERATOR MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::end ( int  aType = UNDEFINED_TYPE) const
inline

◆ erase()

◆ first()

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
int MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::first ( ) const
inlineprivate

◆ last()

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
int MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::last ( ) const
inlineprivate

◆ operator[]() [1/2]

◆ operator[]() [2/2]

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
const ITEM_PTR_VECTOR & MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::operator[] ( int  aType) const
inline

◆ push_back()

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
void MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::push_back ( T *  aItem)
inline

◆ size()

◆ sort()

◆ unique()

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
void MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::unique ( )
inline

Member Data Documentation

◆ FIRST_TYPE

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
constexpr int MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::FIRST_TYPE = FIRST_TYPE_VAL
staticconstexpr

◆ LAST_TYPE

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
constexpr int MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::LAST_TYPE = LAST_TYPE_VAL
staticconstexpr

◆ m_data

◆ TYPES_COUNT

◆ UNDEFINED_TYPE

template<typename T , int FIRST_TYPE_VAL, int LAST_TYPE_VAL>
constexpr int MULTIVECTOR< T, FIRST_TYPE_VAL, LAST_TYPE_VAL >::UNDEFINED_TYPE = 0
staticconstexpr

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