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 faBoundaryMesh, fvBoundaryMesh, IOPtrList< T >, pointBoundaryMesh, and polyBoundaryMesh.
Public Member Functions | |
constexpr | PtrList () noexcept |
Default construct. 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 ownership 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... | |
const T * | set (const label i) const |
Return const pointer to element (can be nullptr),. 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... | |
template<class... Args> | |
void | emplace_append (Args &&... args) |
Construct and append an element to the end of the list. More... | |
void | append (T *ptr) |
Append an element to the end of the list. More... | |
void | append (autoPtr< T > &ptr) |
Move append an element to the end of the list. More... | |
void | append (autoPtr< T > &&ptr) |
Move append an element to the end of the list. More... | |
void | append (std::unique_ptr< T > &&ptr) |
Move append an element to the end of the list. More... | |
void | append (const refPtr< T > &ptr) |
Move or clone append a refPtr to the end of the list. More... | |
void | append (const tmp< T > &ptr) |
Move or clone append a tmp to the end of the list. More... | |
template<class... Args> | |
autoPtr< T > | emplace (const label i, Args &&... args) |
Construct and set an element. 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 > &ptr) |
Set element to given autoPtr and return old element. More... | |
autoPtr< T > | set (const label i, autoPtr< T > &&ptr) |
Set element to given autoPtr and return old element. More... | |
autoPtr< T > | set (const label i, std::unique_ptr< T > &&ptr) |
Set element to given unique_ptr and return old element. More... | |
autoPtr< T > | set (const label i, const refPtr< T > &ptr) |
Set element to given refPtr and return old element. More... | |
autoPtr< T > | set (const label i, const tmp< T > &ptr) |
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 | transfer (PtrList< T > &list) |
Transfer into this list and annul the argument list. 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 |
template<class... Args> | |
Foam::autoPtr< T > | emplace (const label i, Args &&... args) |
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 |
Default construct.
Definition at line 45 of file PtrListI.H.
|
inlineexplicit |
Construct with specified size, each element initialized to nullptr.
Definition at line 52 of file PtrListI.H.
Copy construct using 'clone()' method on each element.
Definition at line 59 of file PtrListI.H.
Move construct.
Definition at line 66 of file PtrListI.H.
Take ownership of pointers in the list, set old pointers to null.
Definition at line 73 of file PtrListI.H.
Copy construct using 'clone()' method on each element.
Definition at line 85 of file PtrListI.H.
Construct from Istream using given Istream constructor class.
Definition at line 145 of file PtrListIO.C.
Construct from Istream using default Istream constructor class.
Definition at line 152 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 36 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 |
Return const pointer to element (can be nullptr),.
without bounds checking - same as get(). The return value can also be tested as a bool.
Definition at line 138 of file PtrList.H.
Referenced by fvMeshAdder::add(), polyMeshAdder::add(), phaseSystem::addField(), fvMeshTools::addPatch(), meshRefinement::appendPatch(), diffusionMulticomponent< ReactionThermo, ThermoType >::correct(), boundaryMesh::deletePatch(), fvMeshDistribute::distribute(), phaseSystem::fillFields(), forAll(), lduPrimitiveMesh::gather(), surfaceZonesInfo::getAllClosedNamedSurfaces(), surfaceZonesInfo::getClosedNamedSurfaces(), surfaceZonesInfo::getInsidePointNamedSurfaces(), surfaceZonesInfo::getNamedSurfaces(), surfaceZonesInfo::getStandaloneNamedSurfaces(), surfaceZonesInfo::getUnclosedNamedSurfaces(), PDRblock::innerMesh(), LUscalarMatrix::LUscalarMatrix(), fvMeshAdder::MapDimFields(), fvMeshAdder::MapSurfaceFields(), fvMeshAdder::MapVolFields(), pointBoundaryMesh::pointBoundaryMesh(), polyBoundaryMesh::polyBoundaryMesh(), multiRegion::read(), boundaryMesh::read(), externalCoupled::readDataMaster(), polyMesh::readUpdate(), refinementSurfaces::refinementSurfaces(), refinementFeatures::regionEdgeTrees(), trackingInverseDistance::update(), inverseDistance::update(), optimisationType::updateGradientsAndValues(), OFstreamCollator::write(), externalCoupled::writeDataMaster(), streamLineBase::writeToFile(), and ZoneMesh< cellZone, polyMesh >::ZoneMesh().
|
inline |
Clear the PtrList. Delete allocated entries and set size to zero.
Definition at line 97 of file PtrListI.H.
Referenced by functionObjectList::clear(), fvMatrix< Type >::clear(), 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(), multiRegion::read(), sampledSurfaces::read(), PtrList< transferModel >::setSize(), and ZoneMesh< cellZone, polyMesh >::ZoneMesh().
|
inline |
Same as resize()
Definition at line 151 of file PtrList.H.
Referenced by fvMeshAdder::add(), polyMeshAdder::add(), surfaceZonesInfo::addFaceZonesToMesh(), fvMeshTools::addPatch(), meshRefinement::appendPatch(), lduPrimitiveMesh::gather(), patchInjection::patchInjection(), polyBoundaryMesh::polyBoundaryMesh(), polyMesh::readUpdate(), polyMesh::removeBoundary(), searchableSurfaces::searchableSurfaces(), duplicatePoints::setRefinement(), trackingInverseDistance::update(), optimisationType::updateGradientsAndValues(), lduPrimitiveMeshAssembly::updateMaps(), and OFstreamCollator::write().
|
inline |
Construct and append an element to the end of the list.
Definition at line 106 of file PtrListI.H.
|
inline |
Append an element to the end of the list.
Definition at line 113 of file PtrListI.H.
Referenced by singleProcessorFaceSets::add(), triSurfaceLoader::load(), and streamLineBase::trimToBox().
Move append an element to the end of the list.
Definition at line 120 of file PtrListI.H.
Move append an element to the end of the list.
Definition at line 127 of file PtrListI.H.
|
inline |
Move append an element to the end of the list.
Definition at line 134 of file PtrListI.H.
Move or clone append a refPtr to the end of the list.
Definition at line 141 of file PtrListI.H.
Move or clone append a tmp to the end of the list.
Definition at line 148 of file PtrListI.H.
|
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 167 of file PtrListI.H.
|
inline |
Set element to given autoPtr and return old element.
Definition at line 179 of file PtrListI.H.
Referenced by PtrList< transferModel >::set().
|
inline |
Set element to given autoPtr and return old element.
Definition at line 190 of file PtrListI.H.
|
inline |
Set element to given unique_ptr and return old element.
Definition at line 201 of file PtrListI.H.
|
inline |
Set element to given refPtr and return old element.
Definition at line 212 of file PtrListI.H.
|
inline |
Set element to given tmp and return old element.
Definition at line 223 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 233 of file PtrListI.H.
Transfer into this list and annul the argument list.
Definition at line 245 of file PtrListI.H.
Referenced by functionObjectList::read().
Move assignment.
Definition at line 255 of file PtrListI.H.
Foam::PtrList<T> clone | ( | Args &&... | args | ) | const |
|
inline |
Definition at line 157 of file PtrListI.H.
Read from Istream, discarding contents of existing list.