Pointer management similar to std::unique_ptr, with some additional methods and type checking. More...
Inherited by LList< Foam::autoPtr< Foam::regExpPosix > >.
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 pointer. More... | |
constexpr | autoPtr (std::nullptr_t) noexcept |
Implicit construct from literal nullptr: no managed pointer. More... | |
autoPtr (T *p) noexcept | |
Construct, taking ownership of the pointer. More... | |
autoPtr (autoPtr< T > &&rhs) noexcept | |
Move construct, transferring ownership. More... | |
template<class U > | |
autoPtr (autoPtr< U > &&rhs) | |
Move construct, transferring ownership from derived type. More... | |
autoPtr (std::unique_ptr< T > &&rhs) noexcept | |
Move construct from unique_ptr, transferring ownership. More... | |
autoPtr (const autoPtr< T > &rhs) noexcept | |
A move construct disguised as a copy construct (transfers ownership) More... | |
~autoPtr () noexcept | |
Destructor: deletes managed pointer. More... | |
bool | good () 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 |
Release ownership and return the pointer. More... | |
T * | ptr () noexcept |
Same as release() . More... | |
void | clear () noexcept |
Same as reset(nullptr) More... | |
void | reset (T *p=nullptr) noexcept |
Delete managed object and set to new given pointer. More... | |
void | reset (autoPtr< T > &&other) noexcept |
Delete managed object and set to new given pointer. More... | |
template<class... Args> | |
T & | emplace (Args &&... args) |
Reset with emplace construction. Return reference to the new content. More... | |
void | swap (autoPtr< T > &other) noexcept |
Swaps the managed object with other autoPtr. More... | |
template<class... Args> | |
autoPtr< T > | clone (Args &&... args) const |
Copy construct 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 bool () const noexcept | |
True if pointer/reference is non-null. Same as good() More... | |
operator const T * () const noexcept | |
Implicit cast to const pointer type. More... | |
operator const T & () const | |
Deprecated(2019-01) Automatic cast conversion to underlying type. More... | |
void | operator= (T *p)=delete |
No copy assignment from plain pointer (uncontrolled access) More... | |
void | operator= (const autoPtr< T > &)=delete |
No move assignment disguised as a copy assignment. More... | |
void | operator= (autoPtr< T > &&other) noexcept |
Transfer object ownership from parameter. More... | |
template<class U > | |
void | operator= (autoPtr< U > &&other) noexcept |
Transfer object ownership from parameter. More... | |
void | operator= (std::unique_ptr< T > &&other) |
Transfer ownership by move assignment from unique_ptr. More... | |
void | operator= (std::nullptr_t) noexcept |
Reset via assignment from literal nullptr. More... | |
bool | valid () const noexcept |
Identical to good(), or bool operator. More... | |
bool | empty () const noexcept |
Deprecated(2020-07) True if the managed pointer is null. More... | |
void | set (T *p) noexcept |
Deprecated(2018-02) Identical to reset(). More... | |
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 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 48 of file HashPtrTable.H.
typedef T element_type |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Construct autoPtr with forwarding arguments.
args | list of arguments with which an instance of T will be constructed. |
Definition at line 178 of file autoPtr.H.
Referenced by polyMeshAdder::add(), zoneCellStencils::allCoupledFacesPatch(), cellToCellStencil::allCoupledFacesPatch(), cellToFaceStencil::allCoupledFacesPatch(), holeToFace::calcClosure(), polyTopoChange::changeMesh(), solidMixtureProperties::clone(), subBody::clone(), liquidMixtureProperties::clone(), boundaryPatch::clone(), regionModelFunctionObject::clone(), rigidBody::clone(), ignitionSite::clone(), solidProperties::clone(), curve::clone(), RASModelVariables::clone(), cellShape::clone(), pointToPointPlanarInterpolation::clone(), surfaceZonesInfo::clone(), cellModel::clone(), cellZone::clone(), pointZone::clone(), faPatch::clone(), bitSet::clone(), polyPatch::clone(), dimensionSet::clone(), faceZone::clone(), AMIInterpolation::clone(), exprResult::clone(), mapDistribute::clone(), coordinateSystem::clone(), particle< Type >::clone(), dictionary::clone(), IOobject::clone(), Foam::createReconstructMap(), cyclicAMIPolyPatch::cylindricalCS(), fvMeshDistribute::distribute(), multiphaseSystem::dragCoeffs(), coordSet::gatherSort(), PDRblock::innerMesh(), IOobjectList::IOobjectList(), Foam::loadPointField(), distributedTriSurfaceMesh::localQueries(), polyTopoChange::makeMesh(), voxelMeshSearch::makeMesh(), meshRefinement::makePatch(), FIREMeshReader::mesh(), meshReader::mesh(), blockMesh::mesh(), reader::mesh(), lumpedPointIOMovement::New(), motionInterpolation::New(), procLduInterface::New(), lumpedPointController::New(), solidMixtureProperties::New(), surfZone::New(), rigidBody::New(), block::New(), cellModel::New(), topODesignVariables::New(), colourTable::New(), Time::New(), dictionary::New(), momentum::newField(), Time::NewGlobalTime(), faMeshTools::newMesh(), fvMeshTools::newMesh(), zoneCellStencils::nonEmptyFacesPatch(), phaseModel::iNew::operator()(), ignitionSite::iNew::operator()(), passiveParticle::iNew::operator()(), passivePositionParticle::iNew::operator()(), injectedParticle::iNew::operator()(), trackedParticle::iNew::operator()(), solidParticle::iNew::operator()(), molecule::iNew::operator()(), particle< Type >::iNew::operator()(), mappedPatchBase::readDatabase(), UnsortedMeshedSurface< Face >::releaseZoneIds(), fvMeshSubset::reset(), basicSpecieMixture::specieComposition(), polyTopoChanger::topoChangeRequest(), faMesh::TryNew(), streamLineBase::wallPatch(), and vtkWrite::write().
|
inlinenoexcept |
True if the managed pointer is non-null.
Definition at line 206 of file autoPtr.H.
Referenced by UniformValueField< Type >::good(), writeFile::newFile(), writeFile::newFileAtTime(), uncollatedFileOperation::readHeader(), uncollatedFileOperation::readStream(), masterUncollatedFileOperation::readStream(), Table< Type >::Table(), objectiveIncompressible::update_dJdTMvar(), FLMAsurfaceFormat< Face >::write(), and FIREMeshWriter::write().
|
inlinenoexcept |
Return pointer to managed object without nullptr checking.
Pointer remains under autoPtr management.
Definition at line 216 of file autoPtr.H.
Referenced by refinementHistory::add(), refinementHistory::apply(), fvExpressionField::performAction(), and fieldsDistributor::readFields().
|
inlinenoexcept |
|
inline |
Return reference to the managed object without nullptr checking.
When get() == nullptr, additional guards may be required to avoid inadvertent access of a nullptr.
Definition at line 231 of file autoPtr.H.
Referenced by energySpectrum::calcAndWriteSpectrum(), pointPatchField< vector >::New(), TDACChemistryModel< CompType, ThermoType >::TDACChemistryModel(), objectiveForce::update_dxdbMultiplier(), objectiveMoment::update_dxdbMultiplier(), ParticlePostProcessing< CloudType >::write(), and ParticleHistogram< CloudType >::write().
|
inlinenoexcept |
Release ownership and return the pointer.
Definition at line 28 of file autoPtrI.H.
Referenced by PtrList< transferModel >::append(), fvExpressionField::performAction(), autoPtr< Foam::distributionModel >::ptr(), PtrListDictionary< phaseModel >::set(), PtrList< transferModel >::set(), PtrDynList< Foam::profilingInformation >::set(), and regIOobject::store().
|
inlinenoexcept |
Same as release()
.
Definition at line 248 of file autoPtr.H.
Referenced by variablesSet::allocateField(), variablesSet::allocateFluxField(), rigidBodyModel::join(), and OFstreamCollator::write().
|
inlinenoexcept |
Same as reset(nullptr)
Definition at line 255 of file autoPtr.H.
Referenced by polyMeshAdder::add(), cyclicACMIGAMGInterface::cyclicACMIGAMGInterface(), cyclicAMIGAMGInterface::cyclicAMIGAMGInterface(), meshRefinement::distribute(), snappySnapDriver::doSnap(), masterUncollatedFileOperation::readStream(), FLMAsurfaceFormat< Face >::write(), and FIREMeshWriter::write().
|
inlinenoexcept |
Delete managed object and set to new given pointer.
Definition at line 37 of file autoPtrI.H.
Referenced by refinementHistory::add(), polyMeshAdder::add(), ATCUaGradU::addATC(), AMIInterpolation::agglomerate(), variablesSet::allocateRenamedField(), refinementHistory::apply(), shapeDesignVariables::assembleSensitivities(), autoPtr< Foam::distributionModel >::clear(), PatchInteractionFields< CloudType >::clearOrReset(), cyclicACMIGAMGInterface::cyclicACMIGAMGInterface(), cyclicAMIGAMGInterface::cyclicAMIGAMGInterface(), snappySnapDriver::detectNearSurfaces(), faMeshDistributor::distribute(), distributedTriSurfaceMesh::distribute(), snappySnapDriver::doSnap(), searchablePlateFeatures::features(), distributedTriSurfaceMesh::findNearest(), PatchTools::gatherAndMerge(), distributedTriSurfaceMesh::getVolumeType(), if(), cyclicAMIPolyPatch::initInterpolate(), cyclicAMIPolyPatch::interpolate(), optimisationManager::lineSearchUpdate(), polyTopoChange::makeMesh(), rigidBodyModel::merge(), averageNeighbourFvGeometryScheme::movePoints(), isoSurfaceBase::New(), lineSearch::New(), entry::New(), functionObjectList::New(), writeFile::newFile(), writeFile::newFileAtTime(), Foam::vtk::newFormatter(), masterUncollatedFileOperation::NewIFstream(), Foam::NewOrNone(), autoPtr< Foam::distributionModel >::operator=(), processorCyclicPolyPatch::order(), fvExpressionField::performAction(), projectCurveEdge::position(), projectEdge::position(), ISQP::preconVectorProduct(), projectFace::project(), radiativeIntensityRay::radiativeIntensityRay(), decomposedBlockData::read(), BilgerMixtureFraction::read(), functionObjectList::read(), masterUncollatedFileOperation::read(), decomposedBlockData::readBlock(), decomposedBlockData::readBlocks(), volumetricBSplinesDesignVariables::readBounds(), designVariables::readDict(), masterUncollatedFileOperation::readStream(), Foam::reconstructLagrangian(), Foam::redistributeLagrangian(), autoPtr< Foam::distributionModel >::set(), cyclicAMIPolyPatch::setAMIFaces(), BezierDesignVariables::setBounds(), variablesSet::setFluxField(), sensitivitySurface::smoothSensitivities(), objective::updateNormalizationFactor(), Foam::ensightOutput::writeCloudPositions(), externalCoupled::writeGeometry(), decomposedBlockData::writeObject(), and topOVariablesBase::writeSurfaceFiles().
Delete managed object and set to new given pointer.
Definition at line 45 of file autoPtrI.H.
|
inline |
Reset with emplace construction. Return reference to the new content.
Definition at line 59 of file autoPtrI.H.
Swaps the managed object with other autoPtr.
Definition at line 68 of file autoPtrI.H.
Copy construct 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 94 of file autoPtrI.H.
Referenced by autoPtr< ThermoType >::operator const ThermoType &().
|
inline |
Return const reference to the object.
FatalError if no pointer is managed
Definition at line 107 of file autoPtrI.H.
|
inline |
Dereferences (non-const) pointer to the managed object.
FatalError if no pointer is managed
Definition at line 114 of file autoPtrI.H.
|
inline |
Dereferences (const) pointer to the managed object.
FatalError if no pointer is managed
Definition at line 127 of file autoPtrI.H.
|
inline |
Return reference to the object data.
FatalError if no pointer is managed
Definition at line 134 of file autoPtrI.H.
|
inline |
Return const reference to the object data.
FatalError if no pointer is managed
Definition at line 141 of file autoPtrI.H.
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inline |
Deprecated(2019-01) Automatic cast conversion to underlying type.
FatalError if no pointer is managed
|
delete |
No copy assignment from plain pointer (uncontrolled access)
No move assignment disguised as a copy assignment.
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Deprecated(2020-07) True if the managed pointer is null.
|
inlinenoexcept |
Deprecated(2018-02) Identical to reset().
Definition at line 437 of file autoPtr.H.
Referenced by lduPrimitiveMesh::lduPrimitiveMesh(), and fvMeshSubset::reset().
|
inline |
Definition at line 80 of file autoPtrI.H.