A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers. The operator[] returns a reference to the object, not the pointer. More...
Inherited by blockMesh, faBoundaryMesh, fvBoundaryMesh, IOPtrList< T >, pointBoundaryMesh, and polyBoundaryMesh.
Public Member Functions | |
constexpr | PtrList () noexcept |
Construct null. More... | |
PtrList (const label len) | |
Construct with specified size, each element initialized to nullptr. More... | |
PtrList (const PtrList< T > &list) | |
Copy construct using 'clone()' method on each element. More... | |
PtrList (PtrList< T > &&list) | |
Move construct. More... | |
PtrList (UList< T * > &list) | |
Take ownerskip of pointers in the list, set old pointers to null. More... | |
template<class CloneArg > | |
PtrList (const PtrList< T > &list, const CloneArg &cloneArgs) | |
Copy construct using 'clone()' method on each element. More... | |
PtrList (PtrList< T > &list, bool reuse) | |
Construct as copy or re-use as specified. More... | |
PtrList (const SLPtrList< T > &list) | |
Copy construct using 'clone()' on each element of SLPtrList<T> More... | |
template<class INew > | |
PtrList (Istream &is, const INew &inew) | |
Construct from Istream using given Istream constructor class. More... | |
PtrList (Istream &is) | |
Construct from Istream using default Istream constructor class. More... | |
~PtrList () | |
Destructor. More... | |
template<class... Args> | |
PtrList< T > | clone (Args &&... args) const |
Make a copy by cloning each of the list elements. More... | |
void | clear () |
Clear the PtrList. Delete allocated entries and set size to zero. More... | |
void | resize (const label newLen) |
Adjust size of PtrList. More... | |
void | setSize (const label newLen) |
Same as resize() More... | |
void | append (T *ptr) |
Append an element to the end of the list. More... | |
void | append (autoPtr< T > &aptr) |
Move append an element to the end of the list. More... | |
void | append (autoPtr< T > &&aptr) |
Move append an element to the end of the list. More... | |
void | append (const tmp< T > &tptr) |
Move or clone append a tmp to the end of the list. More... | |
void | transfer (PtrList< T > &list) |
Transfer into this list and annul the argument list. More... | |
const T * | set (const label i) const |
Return const pointer to element (if set) or nullptr. More... | |
autoPtr< T > | set (const label i, T *ptr) |
Set element to given pointer and return old element (can be null) More... | |
autoPtr< T > | set (const label i, autoPtr< T > &aptr) |
Set element to given autoPtr and return old element. More... | |
autoPtr< T > | set (const label i, autoPtr< T > &&aptr) |
Set element to given autoPtr and return old element. More... | |
autoPtr< T > | set (const label i, const tmp< T > &tptr) |
Set element to given tmp and return old element. More... | |
autoPtr< T > | release (const label i) |
Release ownership of the pointer at the given position. More... | |
void | operator= (const PtrList< T > &list) |
Copy assignment. More... | |
void | operator= (PtrList< T > &&list) |
Move assignment. More... | |
template<class... Args> | |
Foam::PtrList< T > | clone (Args &&... args) const |
Protected Member Functions | |
template<class INew > | |
void | readIstream (Istream &is, const INew &inew) |
Read from Istream using Istream constructor class. More... | |
void | free () |
Delete the allocated entries, but retain the list size. More... | |
Friends | |
Istream & | operator>> (Istream &is, PtrList< T > &list) |
Read from Istream, discarding contents of existing list. More... | |
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers. The operator[] returns a reference to the object, not the pointer.
|
inlineconstexprnoexcept |
Construct null.
Definition at line 44 of file PtrListI.H.
|
inlineexplicit |
Construct with specified size, each element initialized to nullptr.
Definition at line 51 of file PtrListI.H.
Copy construct using 'clone()' method on each element.
Definition at line 58 of file PtrListI.H.
Move construct.
Definition at line 65 of file PtrListI.H.
Take ownerskip of pointers in the list, set old pointers to null.
Definition at line 72 of file PtrListI.H.
Copy construct using 'clone()' method on each element.
Definition at line 88 of file PtrListI.H.
Construct from Istream using given Istream constructor class.
Definition at line 165 of file PtrListIO.C.
Construct from Istream using default Istream constructor class.
Definition at line 172 of file PtrListIO.C.
Read from Istream using Istream constructor class.
Definition at line 38 of file PtrListIO.C.
|
inlineprotected |
Delete the allocated entries, but retain the list size.
Definition at line 35 of file PtrListI.H.
Make a copy by cloning each of the list elements.
Referenced by attachPolyTopoChanger::attach(), PtrList< transferModel >::clone(), polyTopoChange::makeMesh(), fvMeshTools::newMesh(), and fvMeshSubset::setCellSubset().
|
inline |
Clear the PtrList. Delete allocated entries and set size to zero.
Definition at line 100 of file PtrListI.H.
Referenced by functionObjectList::clear(), AMIWeights::read(), functionObjectList::read(), sampledSurfaces::read(), polyMesh::readUpdate(), polyMesh::removeBoundary(), and decompositionMethod::setConstraints().
void resize | ( | const label | newLen | ) |
Adjust size of PtrList.
New entries are initialized to nullptr, removed entries are deleted
Definition at line 103 of file PtrList.C.
Referenced by regionModel::interRegionAMI(), ZoneMesh< cellZone, polyMesh >::operator()(), functionObjectList::read(), sampledSurfaces::read(), and ZoneMesh< cellZone, polyMesh >::ZoneMesh().
|
inline |
Same as resize()
Definition at line 108 of file PtrListI.H.
Referenced by fvMeshAdder::add(), polyMeshAdder::add(), surfaceZonesInfo::addFaceZonesToMesh(), fvMeshTools::addPatch(), meshRefinement::appendPatch(), polyBoundaryMesh::checkParallelSync(), lduPrimitiveMesh::gather(), isoSurfaceTopo::isoSurfaceTopo(), patchInjection::patchInjection(), polyMesh::readUpdate(), polyMesh::removeBoundary(), searchableSurfaces::searchableSurfaces(), duplicatePoints::setRefinement(), trackingInverseDistance::update(), optimisationType::updateGradientsAndValues(), and OFstreamCollator::write().
|
inline |
Append an element to the end of the list.
Definition at line 115 of file PtrListI.H.
Referenced by singleProcessorFaceSets::add(), polyBoundaryMesh::groupPatchIDs(), triSurfaceLoader::load(), and streamLineBase::trimToBox().
Move append an element to the end of the list.
Definition at line 122 of file PtrListI.H.
Move append an element to the end of the list.
Definition at line 129 of file PtrListI.H.
Move or clone append a tmp to the end of the list.
Definition at line 136 of file PtrListI.H.
Transfer into this list and annul the argument list.
Definition at line 190 of file PtrListI.H.
Referenced by functionObjectList::read().
|
inline |
Return const pointer to element (if set) or nullptr.
The return value can be tested as a bool.
Definition at line 143 of file PtrListI.H.
Referenced by fvMeshAdder::add(), phaseSystem::addField(), fvMeshTools::addPatch(), meshRefinement::appendPatch(), diffusionMulticomponent< ReactionThermo, ThermoType >::correct(), boundaryMesh::deletePatch(), phaseSystem::fillFields(), forAll(), lduPrimitiveMesh::gather(), surfaceZonesInfo::getAllClosedNamedSurfaces(), surfaceZonesInfo::getClosedNamedSurfaces(), surfaceZonesInfo::getInsidePointNamedSurfaces(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getStandaloneNamedSurfaces(), surfaceZonesInfo::getUnclosedNamedSurfaces(), LUscalarMatrix::LUscalarMatrix(), PDRblock::mesh(), ZoneMesh< cellZone, polyMesh >::operator()(), pointBoundaryMesh::pointBoundaryMesh(), boundaryMesh::read(), polyMesh::readUpdate(), refinementSurfaces::refinementSurfaces(), refinementFeatures::regionEdgeTrees(), multiphaseSystem::solve(), trackingInverseDistance::update(), inverseDistance::update(), optimisationType::updateGradientsAndValues(), OFstreamCollator::write(), streamLineBase::writeToFile(), and ZoneMesh< cellZone, polyMesh >::ZoneMesh().
|
inline |
Set element to given pointer and return old element (can be null)
No-op if the new pointer value is identical to the current content.
Definition at line 150 of file PtrListI.H.
|
inline |
Set element to given autoPtr and return old element.
Definition at line 157 of file PtrListI.H.
|
inline |
Set element to given autoPtr and return old element.
Definition at line 164 of file PtrListI.H.
|
inline |
Set element to given tmp and return old element.
Definition at line 171 of file PtrListI.H.
|
inline |
Release ownership of the pointer at the given position.
Out of bounds addressing is a no-op and returns nullptr.
Definition at line 178 of file PtrListI.H.
Move assignment.
Definition at line 200 of file PtrListI.H.
Foam::PtrList<T> clone | ( | Args &&... | args | ) | const |
Read from Istream, discarding contents of existing list.