Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
NCollection_List< TheItemType > Class Template Reference

#include <NCollection_List.hxx>

Inheritance diagram for NCollection_List< TheItemType >:

Public Types

typedef TheItemType value_type
 STL-compliant typedef for value type.
typedef NCollection_TListNode< TheItemType > ListNode
typedef NCollection_TListIterator< TheItemType > Iterator
typedef NCollection_StlIterator< std::forward_iterator_tag, Iterator, TheItemType, false > iterator
 Shorthand for a regular iterator type.
typedef NCollection_StlIterator< std::forward_iterator_tag, Iterator, TheItemType, true > const_iterator
 Shorthand for a constant iterator type.

Public Member Functions

iterator begin () noexcept
 Returns an iterator pointing to the first element in the list.
iterator end () noexcept
 Returns an iterator referring to the past-the-end element in the list.
const_iterator begin () const noexcept
 Returns a const iterator pointing to the first element in the list.
const_iterator end () const noexcept
 Returns a const iterator referring to the past-the-end element in the list.
const_iterator cbegin () const noexcept
 Returns a const iterator pointing to the first element in the list.
const_iterator cend () const noexcept
 Returns a const iterator referring to the past-the-end element in the list.
 NCollection_List ()
 Empty constructor.
 NCollection_List (const occ::handle< NCollection_BaseAllocator > &theAllocator)
 Constructor.
 NCollection_List (const NCollection_List &theOther)
 Copy constructor.
 NCollection_List (NCollection_List &&theOther) noexcept
 Move constructor.
 NCollection_List (std::initializer_list< TheItemType > theInitList, const occ::handle< NCollection_BaseAllocator > &theAllocator=occ::handle< NCollection_BaseAllocator >())
 Initializer list constructor.
NCollection_List & Assign (const NCollection_List &theOther)
 Replace this list by the items of another list (theOther parameter). This method does not change the internal allocator.
NCollection_List & operator= (const NCollection_List &theOther)
 Replacement operator.
NCollection_List & operator= (NCollection_List &&theOther) noexcept
 Move operator.
void Clear (const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr)
 Clear this list.
const TheItemType & First () const
 First item.
TheItemType & First ()
 First item (non-const)
const TheItemType & Last () const
 Last item.
TheItemType & Last ()
 Last item (non-const)
TheItemType & Append (const TheItemType &theItem)
 Append one item at the end.
TheItemType & Append (TheItemType &&theItem)
 Append one item at the end.
void Append (const TheItemType &theItem, Iterator &theIter)
 Append one item at the end and output iterator pointing at the appended item.
void Append (TheItemType &&theItem, Iterator &theIter)
 Append one item at the end and output iterator pointing at the appended item.
void Append (NCollection_List &theOther)
 Append another list at the end. After this operation, theOther list will be cleared.
TheItemType & Prepend (const TheItemType &theItem)
 Prepend one item at the beginning.
TheItemType & Prepend (TheItemType &&theItem)
 Prepend one item at the beginning.
void Prepend (NCollection_List &theOther)
 Prepend another list at the beginning.
void RemoveFirst ()
 RemoveFirst item.
void Remove (Iterator &theIter)
 Remove item pointed by iterator theIter; theIter is then set to the next item.
template<typename TheValueType>
bool Remove (const TheValueType &theObject)
 Remove the first occurrence of the object.
TheItemType & InsertBefore (const TheItemType &theItem, Iterator &theIter)
 InsertBefore.
TheItemType & InsertBefore (TheItemType &&theItem, Iterator &theIter)
 InsertBefore.
void InsertBefore (NCollection_List &theOther, Iterator &theIter)
 InsertBefore.
TheItemType & InsertAfter (const TheItemType &theItem, Iterator &theIter)
 InsertAfter.
TheItemType & InsertAfter (TheItemType &&theItem, Iterator &theIter)
 InsertAfter.
void InsertAfter (NCollection_List &theOther, Iterator &theIter)
 InsertAfter.
template<typename... Args>
TheItemType & EmplaceAppend (Args &&... theArgs)
 Emplace one item at the end, constructing it in-place.
template<typename... Args>
TheItemType & EmplacePrepend (Args &&... theArgs)
 Emplace one item at the beginning, constructing it in-place.
template<typename... Args>
TheItemType & EmplaceBefore (Iterator &theIter, Args &&... theArgs)
 Emplace one item before the iterator position, constructing it in-place.
template<typename... Args>
TheItemType & EmplaceAfter (Iterator &theIter, Args &&... theArgs)
 Emplace one item after the iterator position, constructing it in-place.
void Reverse () noexcept
 Reverse the list.
void Exchange (NCollection_List &theOther) noexcept
 Exchange the content of two lists without re-allocations. Swaps all internal state including allocators, ensuring correct deallocation. Existing iterators remain valid but will point to the other list's elements.
template<typename TheValueType>
bool Contains (const TheValueType &theObject) const
 Return true if object is stored in the list.
 ~NCollection_List () override
 Destructor - clears the List.
Public Member Functions inherited from NCollection_BaseList
int Extent () const noexcept
int Length () const noexcept
 Length - number of nodes (legacy int-returning API, synonym of Extent()).
size_t Size () const noexcept
 Size - number of nodes.
bool IsEmpty () const noexcept
const occ::handle< NCollection_BaseAllocator > & Allocator () const noexcept
 Returns attached allocator.
virtual ~NCollection_BaseList ()=default

Additional Inherited Members

Protected Member Functions inherited from NCollection_BaseList
 NCollection_BaseList (const occ::handle< NCollection_BaseAllocator > &theAllocator=nullptr)
void PClear (NCollection_DelListNode fDel)
const NCollection_ListNode * PFirst () const noexcept
const NCollection_ListNode * PLast () const noexcept
void PAppend (NCollection_ListNode *theNode) noexcept
void PAppend (NCollection_ListNode *theNode, Iterator &theIt) noexcept
void PAppend (NCollection_BaseList &theOther) noexcept
void PPrepend (NCollection_ListNode *theNode) noexcept
void PPrepend (NCollection_BaseList &theOther) noexcept
void PRemoveFirst (NCollection_DelListNode fDel)
void PRemove (Iterator &theIter, NCollection_DelListNode fDel)
void PInsertBefore (NCollection_ListNode *theNode, Iterator &theIter)
void PInsertBefore (NCollection_BaseList &theOther, Iterator &theIter)
void PInsertAfter (NCollection_ListNode *theNode, Iterator &theIter)
void PInsertAfter (NCollection_BaseList &theOther, Iterator &theIter)
void PReverse () noexcept
void PExchange (NCollection_BaseList &theOther) noexcept
Protected Attributes inherited from NCollection_BaseList
occ::handle< NCollection_BaseAllocator > myAllocator
NCollection_ListNode * myFirst
NCollection_ListNode * myLast
size_t myLength

Detailed Description

template<class TheItemType>
class NCollection_List< TheItemType >

Purpose: Simple list to link items together keeping the first and the last one. Inherits BaseList, adding the data item to each node.

Member Typedef Documentation

◆ const_iterator

template<class TheItemType>
typedef NCollection_StlIterator<std::forward_iterator_tag, Iterator, TheItemType, true> NCollection_List< TheItemType >::const_iterator

Shorthand for a constant iterator type.

◆ Iterator

template<class TheItemType>
typedef NCollection_TListIterator<TheItemType> NCollection_List< TheItemType >::Iterator

◆ iterator

template<class TheItemType>
typedef NCollection_StlIterator<std::forward_iterator_tag, Iterator, TheItemType, false> NCollection_List< TheItemType >::iterator

Shorthand for a regular iterator type.

◆ ListNode

template<class TheItemType>
typedef NCollection_TListNode<TheItemType> NCollection_List< TheItemType >::ListNode

◆ value_type

template<class TheItemType>
typedef TheItemType NCollection_List< TheItemType >::value_type

STL-compliant typedef for value type.

Constructor & Destructor Documentation

◆ NCollection_List() [1/5]

template<class TheItemType>
NCollection_List< TheItemType >::NCollection_List ( )
inline

Empty constructor.

◆ NCollection_List() [2/5]

template<class TheItemType>
NCollection_List< TheItemType >::NCollection_List ( const occ::handle< NCollection_BaseAllocator > & theAllocator)
inlineexplicit

Constructor.

◆ NCollection_List() [3/5]

template<class TheItemType>
NCollection_List< TheItemType >::NCollection_List ( const NCollection_List< TheItemType > & theOther)
inline

Copy constructor.

◆ NCollection_List() [4/5]

template<class TheItemType>
NCollection_List< TheItemType >::NCollection_List ( NCollection_List< TheItemType > && theOther)
inlinenoexcept

Move constructor.

◆ NCollection_List() [5/5]

template<class TheItemType>
NCollection_List< TheItemType >::NCollection_List ( std::initializer_list< TheItemType > theInitList,
const occ::handle< NCollection_BaseAllocator > & theAllocator = occ::handle<NCollection_BaseAllocator>() )
inline

Initializer list constructor.

Parameters
theInitListinitializer list of elements to populate the list
theAllocatoroptional allocator for memory management

◆ ~NCollection_List()

template<class TheItemType>
NCollection_List< TheItemType >::~NCollection_List ( )
inlineoverride

Destructor - clears the List.

Member Function Documentation

◆ Append() [1/5]

template<class TheItemType>
TheItemType & NCollection_List< TheItemType >::Append ( const TheItemType & theItem)
inline

Append one item at the end.

◆ Append() [2/5]

template<class TheItemType>
void NCollection_List< TheItemType >::Append ( const TheItemType & theItem,
Iterator & theIter )
inline

Append one item at the end and output iterator pointing at the appended item.

◆ Append() [3/5]

template<class TheItemType>
void NCollection_List< TheItemType >::Append ( NCollection_List< TheItemType > & theOther)
inline

Append another list at the end. After this operation, theOther list will be cleared.

◆ Append() [4/5]

template<class TheItemType>
TheItemType & NCollection_List< TheItemType >::Append ( TheItemType && theItem)
inline

Append one item at the end.

◆ Append() [5/5]

template<class TheItemType>
void NCollection_List< TheItemType >::Append ( TheItemType && theItem,
Iterator & theIter )
inline

Append one item at the end and output iterator pointing at the appended item.

◆ Assign()

template<class TheItemType>
NCollection_List & NCollection_List< TheItemType >::Assign ( const NCollection_List< TheItemType > & theOther)
inline

Replace this list by the items of another list (theOther parameter). This method does not change the internal allocator.

◆ begin() [1/2]

template<class TheItemType>
const_iterator NCollection_List< TheItemType >::begin ( ) const
inlinenoexcept

Returns a const iterator pointing to the first element in the list.

◆ begin() [2/2]

template<class TheItemType>
iterator NCollection_List< TheItemType >::begin ( )
inlinenoexcept

Returns an iterator pointing to the first element in the list.

◆ cbegin()

template<class TheItemType>
const_iterator NCollection_List< TheItemType >::cbegin ( ) const
inlinenoexcept

Returns a const iterator pointing to the first element in the list.

◆ cend()

template<class TheItemType>
const_iterator NCollection_List< TheItemType >::cend ( ) const
inlinenoexcept

Returns a const iterator referring to the past-the-end element in the list.

◆ Clear()

template<class TheItemType>
void NCollection_List< TheItemType >::Clear ( const occ::handle< NCollection_BaseAllocator > & theAllocator = nullptr)
inline

Clear this list.

◆ Contains()

template<class TheItemType>
template<typename TheValueType>
bool NCollection_List< TheItemType >::Contains ( const TheValueType & theObject) const
inline

Return true if object is stored in the list.

◆ EmplaceAfter()

template<class TheItemType>
template<typename... Args>
TheItemType & NCollection_List< TheItemType >::EmplaceAfter ( Iterator & theIter,
Args &&... theArgs )
inline

Emplace one item after the iterator position, constructing it in-place.

Parameters
theIteriterator pointing to the position after which to insert
theArgsarguments forwarded to TheItemType constructor
Returns
reference to the newly constructed item

◆ EmplaceAppend()

template<class TheItemType>
template<typename... Args>
TheItemType & NCollection_List< TheItemType >::EmplaceAppend ( Args &&... theArgs)
inline

Emplace one item at the end, constructing it in-place.

Parameters
theArgsarguments forwarded to TheItemType constructor
Returns
reference to the newly constructed item

◆ EmplaceBefore()

template<class TheItemType>
template<typename... Args>
TheItemType & NCollection_List< TheItemType >::EmplaceBefore ( Iterator & theIter,
Args &&... theArgs )
inline

Emplace one item before the iterator position, constructing it in-place.

Parameters
theIteriterator pointing to the position before which to insert
theArgsarguments forwarded to TheItemType constructor
Returns
reference to the newly constructed item

◆ EmplacePrepend()

template<class TheItemType>
template<typename... Args>
TheItemType & NCollection_List< TheItemType >::EmplacePrepend ( Args &&... theArgs)
inline

Emplace one item at the beginning, constructing it in-place.

Parameters
theArgsarguments forwarded to TheItemType constructor
Returns
reference to the newly constructed item

◆ end() [1/2]

template<class TheItemType>
const_iterator NCollection_List< TheItemType >::end ( ) const
inlinenoexcept

Returns a const iterator referring to the past-the-end element in the list.

◆ end() [2/2]

template<class TheItemType>
iterator NCollection_List< TheItemType >::end ( )
inlinenoexcept

Returns an iterator referring to the past-the-end element in the list.

◆ Exchange()

template<class TheItemType>
void NCollection_List< TheItemType >::Exchange ( NCollection_List< TheItemType > & theOther)
inlinenoexcept

Exchange the content of two lists without re-allocations. Swaps all internal state including allocators, ensuring correct deallocation. Existing iterators remain valid but will point to the other list's elements.

◆ First() [1/2]

template<class TheItemType>
TheItemType & NCollection_List< TheItemType >::First ( )
inline

First item (non-const)

◆ First() [2/2]

template<class TheItemType>
const TheItemType & NCollection_List< TheItemType >::First ( ) const
inline

First item.

◆ InsertAfter() [1/3]

template<class TheItemType>
TheItemType & NCollection_List< TheItemType >::InsertAfter ( const TheItemType & theItem,
Iterator & theIter )
inline

InsertAfter.

◆ InsertAfter() [2/3]

template<class TheItemType>
void NCollection_List< TheItemType >::InsertAfter ( NCollection_List< TheItemType > & theOther,
Iterator & theIter )
inline

InsertAfter.

◆ InsertAfter() [3/3]

template<class TheItemType>
TheItemType & NCollection_List< TheItemType >::InsertAfter ( TheItemType && theItem,
Iterator & theIter )
inline

InsertAfter.

◆ InsertBefore() [1/3]

template<class TheItemType>
TheItemType & NCollection_List< TheItemType >::InsertBefore ( const TheItemType & theItem,
Iterator & theIter )
inline

InsertBefore.

◆ InsertBefore() [2/3]

template<class TheItemType>
void NCollection_List< TheItemType >::InsertBefore ( NCollection_List< TheItemType > & theOther,
Iterator & theIter )
inline

InsertBefore.

◆ InsertBefore() [3/3]

template<class TheItemType>
TheItemType & NCollection_List< TheItemType >::InsertBefore ( TheItemType && theItem,
Iterator & theIter )
inline

InsertBefore.

◆ Last() [1/2]

template<class TheItemType>
TheItemType & NCollection_List< TheItemType >::Last ( )
inline

Last item (non-const)

◆ Last() [2/2]

template<class TheItemType>
const TheItemType & NCollection_List< TheItemType >::Last ( ) const
inline

Last item.

◆ operator=() [1/2]

template<class TheItemType>
NCollection_List & NCollection_List< TheItemType >::operator= ( const NCollection_List< TheItemType > & theOther)
inline

Replacement operator.

◆ operator=() [2/2]

template<class TheItemType>
NCollection_List & NCollection_List< TheItemType >::operator= ( NCollection_List< TheItemType > && theOther)
inlinenoexcept

Move operator.

◆ Prepend() [1/3]

template<class TheItemType>
TheItemType & NCollection_List< TheItemType >::Prepend ( const TheItemType & theItem)
inline

Prepend one item at the beginning.

◆ Prepend() [2/3]

template<class TheItemType>
void NCollection_List< TheItemType >::Prepend ( NCollection_List< TheItemType > & theOther)
inline

Prepend another list at the beginning.

◆ Prepend() [3/3]

template<class TheItemType>
TheItemType & NCollection_List< TheItemType >::Prepend ( TheItemType && theItem)
inline

Prepend one item at the beginning.

◆ Remove() [1/2]

template<class TheItemType>
template<typename TheValueType>
bool NCollection_List< TheItemType >::Remove ( const TheValueType & theObject)
inline

Remove the first occurrence of the object.

◆ Remove() [2/2]

template<class TheItemType>
void NCollection_List< TheItemType >::Remove ( Iterator & theIter)
inline

Remove item pointed by iterator theIter; theIter is then set to the next item.

◆ RemoveFirst()

template<class TheItemType>
void NCollection_List< TheItemType >::RemoveFirst ( )
inline

RemoveFirst item.

◆ Reverse()

template<class TheItemType>
void NCollection_List< TheItemType >::Reverse ( )
inlinenoexcept

Reverse the list.


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