Pointer management similar to std::unique_ptr, with some additional methods and type checking. More...
Public Types | |
typedef T | element_type |
Type of object being managed. More... | |
typedef T * | pointer |
Pointer to type of object being managed. More... | |
Public Member Functions | |
constexpr | autoPtr () noexcept |
Construct with no managed object. More... | |
constexpr | autoPtr (std::nullptr_t) noexcept |
Construct with no managed object (literal nullptr). More... | |
autoPtr (T *p) noexcept | |
Construct, taking ownership of the pointer. More... | |
autoPtr (autoPtr< T > &&ap) noexcept | |
Move construct, transferring ownership. More... | |
template<class U > | |
autoPtr (autoPtr< U > &&ap) | |
Move construct, transferring ownership from derived type. More... | |
autoPtr (const autoPtr< T > &ap) noexcept | |
A move construct disguised as a copy construct (transfers ownership) More... | |
~autoPtr () noexcept | |
Deletes the managed object if such is present. More... | |
bool | empty () const noexcept |
True if the managed pointer is null. More... | |
bool | valid () const noexcept |
True if the managed pointer is non-null. More... | |
T * | get () noexcept |
Return pointer to managed object without nullptr checking. More... | |
const T * | get () const noexcept |
Return const pointer to managed object without nullptr checking. More... | |
T & | ref () |
Return reference to the managed object without nullptr checking. More... | |
T * | release () noexcept |
Return pointer to the managed object and release ownership. More... | |
T * | ptr () noexcept |
void | clear () noexcept |
Delete managed object and set pointer to nullptr. More... | |
void | reset (T *p=nullptr) noexcept |
Delete managed object and set to new given pointer. More... | |
void | reset (autoPtr< T > &&ap) noexcept |
Delete managed object and set to new given pointer. More... | |
void | swap (autoPtr< T > &other) noexcept |
Swaps the managed object with other autoPtr. More... | |
template<class... Args> | |
autoPtr< T > | clone (Args &&... args) const |
Construct copy by invoking clone on underlying managed object. More... | |
T & | operator* () |
Return reference to the managed object. More... | |
const T & | operator* () const |
Return const reference to the object. More... | |
T * | operator-> () |
Dereferences (non-const) pointer to the managed object. More... | |
const T * | operator-> () const |
Dereferences (const) pointer to the managed object. More... | |
T & | operator() () |
Return reference to the object data. More... | |
const T & | operator() () const |
Return const reference to the object data. More... | |
operator const T & () const | |
Deprecated(2019-01) Automatic cast conversion to underlying type. More... | |
operator const T * () const noexcept | |
Cast to pointer type. More... | |
operator T* () noexcept | |
Cast to pointer type. More... | |
operator bool () const noexcept | |
True if the managed pointer is non-null - same as valid() More... | |
void | operator= (autoPtr< T > &&ap) noexcept |
Transfer object ownership from parameter. More... | |
template<class U > | |
void | operator= (autoPtr< U > &&ap) noexcept |
Transfer object ownership from parameter. More... | |
void | operator= (const autoPtr< T > &ap) noexcept |
A move assignment disguised as a copy assignment. More... | |
void | operator= (std::nullptr_t) noexcept |
Clear via assignment from literal nullptr. More... | |
void | set (T *p) noexcept |
Deprecated(2018-02) Identical to reset(). More... | |
void | operator= (T *p)=delete |
Deprecated(2018-02) No copy assignment from plain pointer. More... | |
template<class... Args> | |
Foam::autoPtr< T > | New (Args &&... args) |
template<class U , class... Args> | |
Foam::autoPtr< T > | NewFrom (Args &&... args) |
template<class... Args> | |
Foam::autoPtr< T > | clone (Args &&... args) const |
Static Public Member Functions | |
template<class... Args> | |
static autoPtr< T > | New (Args &&... args) |
Construct autoPtr of T with forwarding arguments. More... | |
template<class U , class... Args> | |
static autoPtr< T > | NewFrom (Args &&... args) |
Construct autoPtr from derived type with forwarding arguments. More... | |
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition at line 53 of file HashPtrTable.H.
typedef T element_type |
|
inlineconstexprnoexcept |
Construct with no managed object.
Definition at line 53 of file autoPtrI.H.
|
inlineconstexprnoexcept |
Construct with no managed object (literal nullptr).
Definition at line 60 of file autoPtrI.H.
Construct, taking ownership of the pointer.
Definition at line 67 of file autoPtrI.H.
Move construct, transferring ownership.
Definition at line 74 of file autoPtrI.H.
Move construct, transferring ownership from derived type.
U must be derivable from T
Definition at line 82 of file autoPtrI.H.
|
inlinenoexcept |
Deletes the managed object if such is present.
Definition at line 91 of file autoPtrI.H.
Construct autoPtr of T with forwarding arguments.
args | list of arguments with which an instance of T will be constructed. |
Referenced by polyMeshAdder::add(), cellToCellStencil::allCoupledFacesPatch(), cellToFaceStencil::allCoupledFacesPatch(), polyTopoChange::changeMesh(), subBody::clone(), solidMixtureProperties::clone(), liquidMixtureProperties::clone(), boundaryPatch::clone(), regionModelFunctionObject::clone(), cellShape::clone(), rigidBody::clone(), solidProperties::clone(), ignitionSite::clone(), pointToPointPlanarInterpolation::clone(), surfaceZonesInfo::clone(), curve::clone(), cellZone::clone(), RASModelVariables::clone(), cellModel::clone(), pointZone::clone(), faPatch::clone(), dimensionSet::clone(), bitSet::clone(), faceZone::clone(), polyPatch::clone(), IOobject::clone(), coordinateSystem::clone(), particle< Type >::clone(), exprResult::clone(), dictionary::clone(), mapDistribute::clone(), fvMeshDistribute::distribute(), sampledSet::gather(), IOobjectList::IOobjectList(), Foam::loadPointField(), voxelMeshSearch::makeMesh(), polyTopoChange::makeMesh(), meshRefinement::makePatch(), FIREMeshReader::mesh(), meshReader::mesh(), PDRblock::mesh(), reader::mesh(), lumpedPointIOMovement::New(), motionInterpolation::New(), procLduInterface::New(), solidMixtureProperties::New(), surfZone::New(), rigidBody::New(), cellModel::New(), block::New(), colourTable::New(), Time::New(), dictionary::New(), momentum::newField(), ensightCase::newGeometry(), fvMeshTools::newMesh(), phaseModel::iNew::operator()(), ignitionSite::iNew::operator()(), passiveParticle::iNew::operator()(), solidParticle::iNew::operator()(), trackedParticle::iNew::operator()(), molecule::iNew::operator()(), particle< Type >::iNew::operator()(), probes::prepare(), regionSplit::reduceRegions(), UnsortedMeshedSurface< Face >::releaseZoneIds(), fvMeshSubset::setCellSubset(), streamLineBase::wallPatch(), and vtkWrite::write().
Construct autoPtr from derived type with forwarding arguments.
args | list of arguments with which an instance of U will be constructed. |
|
inlinenoexcept |
True if the managed pointer is null.
Definition at line 100 of file autoPtrI.H.
Referenced by adjointBoundaryCondition::addATCUaGradUTerm(), and optMeshMovement::getMaxAllowedDisplacement().
|
inlinenoexcept |
True if the managed pointer is non-null.
Definition at line 107 of file autoPtrI.H.
Referenced by profilingPstream::active(), IOobjectList::add(), snappyLayerDriver::addLayers(), profilingPstream::addTime(), profilingPstream::beginTiming(), RASModelVariables::cloneAutoTmp(), decompositionModel::decomposer(), snappySnapDriver::detectNearSurfaces(), snappySnapDriver::doSnap(), Foam::fileHandler(), mapPolyMesh::hasOldCellVolumes(), cellVolumeWeight::interpolatePatchTypes(), Foam::lumpedPointTools::lumpedPointPatchList(), projectEdge::position(), projectCurveEdge::position(), projectFace::project(), radiativeIntensityRay::radiativeIntensityRay(), functionObjectList::read(), sampledSurfaces::read(), masterUncollatedFileOperation::read(), decomposedBlockData::readBlocks(), uncollatedFileOperation::readHeader(), uncollatedFileOperation::readStream(), masterUncollatedFileOperation::readStream(), dynamicMotionSolverTopoFvMesh::update(), rawTopoChangerFvMesh::update(), mixerFvMesh::update(), movingConeTopoFvMesh::update(), steadyOptimisation::updateDesignVariables(), polyMesh::updateGeom(), solver::updateOptTypeSource(), histogram::write(), and decomposedBlockData::writeBlocks().
|
inlinenoexcept |
Return pointer to managed object without nullptr checking.
Pointer remains under autoPtr management.
Definition at line 114 of file autoPtrI.H.
Referenced by refinementHistory::add(), refinementHistory::apply(), HashPtrTable< exprResult >::insert(), autoPtr< wallLubricationModel >::operator const wallLubricationModel *(), and autoPtr< wallLubricationModel >::operator wallLubricationModel *().
|
inlinenoexcept |
Return const pointer to managed object without nullptr checking.
Pointer remains under autoPtr management.
Definition at line 121 of file autoPtrI.H.
|
inline |
Return reference to the managed object without nullptr checking.
When get() == nullptr, additional guards may be required to avoid inadvertent access to a nullptr.
Definition at line 128 of file autoPtrI.H.
Referenced by energySpectrum::calcAndWriteSpectrum(), ensightParts::write(), ensightMesh::write(), Foam::ensightOutput::writeCloudField(), Foam::writeVolField(), and ensightWrite::writeVolFields().
|
inlinenoexcept |
Return pointer to the managed object and release ownership.
Definition at line 135 of file autoPtrI.H.
Referenced by PtrList< transferModel >::append(), HashPtrTable< exprResult >::insert(), functionObjectList::read(), sampledSurfaces::read(), PtrList< transferModel >::set(), and HashPtrTable< exprResult >::set().
|
inlinenoexcept |
Return pointer to the managed object and release ownership. Identical behaviour to release().
Definition at line 144 of file autoPtrI.H.
Referenced by variablesSet::allocateField(), variablesSet::allocateFluxField(), rigidBodyModel::join(), masterUncollatedFileOperation::read(), PtrListDictionary< phaseModel >::set(), exprResult::setObjectResult(), exprResult::setObjectResultImpl(), regIOobject::store(), and OFstreamCollator::write().
|
inlinenoexcept |
Delete managed object and set pointer to nullptr.
Definition at line 151 of file autoPtrI.H.
Referenced by polyMeshAdder::add(), meshRefinement::distribute(), snappySnapDriver::doSnap(), functionObjectList::read(), STLCore::readBinaryHeader(), masterUncollatedFileOperation::readStream(), FLMAsurfaceFormat< Face >::write(), and FIREMeshWriter::write().
|
inlinenoexcept |
Delete managed object and set to new given pointer.
Definition at line 158 of file autoPtrI.H.
Referenced by refinementHistory::add(), polyMeshAdder::add(), ATCstandard::addATC(), ATCUaGradU::addATC(), adjointBoundaryCondition::addATCUaGradUTerm(), variablesSet::allocateRenamedField(), refinementHistory::apply(), sensitivityVolBSplinesFI::assembleSensitivities(), sensitivityBezierFI::assembleSensitivities(), sensitivitySurface::assembleSensitivities(), RASModelVariables::cloneAutoTmp(), writeFile::createFile(), STLCore::detectBinaryHeader(), snappySnapDriver::detectNearSurfaces(), distributedTriSurfaceMesh::distribute(), snappySnapDriver::doSnap(), searchablePlateFeatures::features(), sensitivitySurfacePoints::finaliseFaceMultiplier(), PatchTools::gatherAndMerge(), if(), triSurfaceLoader::load(), polyTopoChange::makeMesh(), rigidBodyModel::merge(), lineSearch::New(), functionObjectList::New(), entry::New(), Foam::vtk::newFormatter(), projectEdge::position(), projectCurveEdge::position(), projectFace::project(), radiativeIntensityRay::radiativeIntensityRay(), decomposedBlockData::read(), functionObjectList::read(), masterUncollatedFileOperation::read(), STLCore::readBinaryHeader(), decomposedBlockData::readBlock(), decomposedBlockData::readBlocks(), masterUncollatedFileOperation::readStream(), variablesSet::setFluxField(), histogram::write(), externalCoupled::writeGeometry(), and decomposedBlockData::writeObject().
Delete managed object and set to new given pointer.
Definition at line 166 of file autoPtrI.H.
Swaps the managed object with other autoPtr.
Definition at line 173 of file autoPtrI.H.
Construct copy by invoking clone on underlying managed object.
A no-op if no pointer is managed
args | list of arguments for clone |
Referenced by mapPolyMesh::mapPolyMesh().
|
inline |
Return reference to the managed object.
FatalError if no pointer is managed
Definition at line 198 of file autoPtrI.H.
Referenced by autoPtr< wallLubricationModel >::operator const wallLubricationModel &().
|
inline |
Return const reference to the object.
FatalError if no pointer is managed
Definition at line 211 of file autoPtrI.H.
|
inline |
Dereferences (non-const) pointer to the managed object.
FatalError if no pointer is managed
Definition at line 218 of file autoPtrI.H.
|
inline |
Dereferences (const) pointer to the managed object.
FatalError if no pointer is managed
Definition at line 231 of file autoPtrI.H.
|
inline |
Return reference to the object data.
FatalError if no pointer is managed
Definition at line 238 of file autoPtrI.H.
|
inline |
Return const reference to the object data.
FatalError if no pointer is managed
Definition at line 245 of file autoPtrI.H.
|
inline |
Deprecated(2019-01) Automatic cast conversion to underlying type.
FatalError if no pointer is managed
|
inlinenoexcept |
|
inlineexplicitnoexcept |
True if the managed pointer is non-null - same as valid()
Definition at line 252 of file autoPtrI.H.
Transfer object ownership from parameter.
Definition at line 259 of file autoPtrI.H.
Transfer object ownership from parameter.
Definition at line 271 of file autoPtrI.H.
|
inlinenoexcept |
Clear via assignment from literal nullptr.
Definition at line 282 of file autoPtrI.H.
|
inlinenoexcept |
Deprecated(2018-02) Identical to reset().
Definition at line 275 of file autoPtr.H.
Referenced by distributedTriSurfaceMesh::findNearest(), and distributedTriSurfaceMesh::getVolumeType().
|
delete |
Deprecated(2018-02) No copy assignment from plain pointer.
|
inline |
Definition at line 36 of file autoPtrI.H.
|
inline |
Definition at line 44 of file autoPtrI.H.
|
inline |
Definition at line 184 of file autoPtrI.H.