An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and with pointer allocation checking on access. More...
Public Types | |
typedef T | Type |
Public Member Functions | |
autoPtr (T *=nullptr) | |
Store object pointer. More... | |
autoPtr (const autoPtr< T > &) | |
Construct as copy by transferring pointer to this autoPtr and. More... | |
autoPtr (const autoPtr< T > &, const bool reuse) | |
Construct either by transferring pointer or cloning. More... | |
~autoPtr () | |
Destructor, delete object if pointer is not nullptr. More... | |
bool | empty () const |
Return true if the autoPtr is empty (ie, no pointer set) More... | |
bool | valid () const |
Return true if the autoPtr valid (ie, the pointer is set) More... | |
T * | ptr () |
Return object pointer for reuse. More... | |
void | set (T *) |
Set pointer to that given. More... | |
void | reset (T *=nullptr) |
If object pointer already set, delete object and set to given. More... | |
void | clear () |
Delete object (if the pointer is valid) and set pointer to. More... | |
T & | operator() () |
Return reference to the object data. More... | |
const T & | operator() () const |
Return const reference to the object data. 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 | |
Const cast to the underlying type reference. More... | |
T * | operator-> () |
Return object pointer. More... | |
const T * | operator-> () const |
Return const object pointer. More... | |
void | operator= (T *) |
Take over the object pointer from parameter. More... | |
void | operator= (const autoPtr< T > &) |
Take over the object pointer from parameter. More... | |
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and with pointer allocation checking on access.
Store object pointer.
Definition at line 32 of file autoPtrI.H.
Construct as copy by transferring pointer to this autoPtr and.
setting the arguments pointer to nullptr
Definition at line 39 of file autoPtrI.H.
Construct either by transferring pointer or cloning.
Should only be called with type that supports cloning
Definition at line 48 of file autoPtrI.H.
References autoPtr< T >::ptr(), and autoPtr< T >::valid().
|
inline |
Destructor, delete object if pointer is not nullptr.
Definition at line 67 of file autoPtrI.H.
References clear().
|
inline |
Return true if the autoPtr is empty (ie, no pointer set)
Definition at line 76 of file autoPtrI.H.
Referenced by phaseSystem::generateInterfacialModels(), and vtkMesh::topo().
|
inline |
Return true if the autoPtr valid (ie, the pointer is set)
Definition at line 83 of file autoPtrI.H.
Referenced by refinementHistoryConstraint::add(), refinementHistoryConstraint::apply(), autoPtr< T >::autoPtr(), Foam::meshCheck::checkGeometry(), Foam::meshCheck::checkTopology(), Foam::fv::CorrectPhi(), Foam::fvc::correctRhoUf(), Foam::fvc::correctUf(), snappySnapDriver::detectNearSurfaces(), snappySnapDriver::doSnap(), Foam::fileHandler(), phaseSystem::generateInterfacialModels(), PrimitiveOldTimePatch< FaceList, PointField >::has0(), polyTopoChangeMap::hasOldCellVolumes(), coupledPolyPatch::initOrder(), repatchMesh::mesh(), coupledPolyPatch::order(), cyclicPolyPatch::order(), projectCurveEdge::position(), projectEdge::position(), projectFace::project(), radiativeIntensityRay::radiativeIntensityRay(), masterUncollatedFileOperation::read(), decomposedBlockData::readBlocks(), uncollatedFileOperation::readHeader(), masterUncollatedFileOperation::readStream(), uncollatedFileOperation::readStream(), polyMesh::readUpdate(), histogram::write(), regionSizeDistribution::write(), decomposedBlockData::writeBlocks(), and fileOperation::writeObject().
|
inline |
Return object pointer for reuse.
Definition at line 90 of file autoPtrI.H.
References Foam::T().
Referenced by autoPtr< T >::autoPtr(), conformedFvsPatchField< Type >::conform(), conformedFvPatchField< Type >::conform(), phaseSystem::generateInterfacialModels(), rigidBodyModel::join(), distribution::New(), masterUncollatedFileOperation::read(), triSurfaceMesh::setField(), regIOobject::store(), and OFstreamCollator::write().
|
inline |
Set pointer to that given.
If object pointer already set issue a FatalError
Definition at line 99 of file autoPtrI.H.
Referenced by phaseSystem::generateInterfacialModels(), rigidBodyModel::merge(), SidedInterfacialModel< blendedDiffusiveMassTransferModel >::SidedInterfacialModel(), and SidedInterfacialModel< ModelType >::SidedInterfacialModel().
|
inline |
If object pointer already set, delete object and set to given.
pointer
Definition at line 114 of file autoPtrI.H.
Referenced by refinementHistoryConstraint::add(), refinementHistoryConstraint::apply(), snappySnapDriver::detectNearSurfaces(), distributedTriSurfaceMesh::distribute(), cellsToCells::distributeMesh(), PatchTools::gatherAndMerge(), polyTopoChange::makeMesh(), projectCurveEdge::position(), projectEdge::position(), projectFace::project(), radiativeIntensityRay::radiativeIntensityRay(), decomposedBlockData::read(), masterUncollatedFileOperation::read(), masterUncollatedFileOperation::readStream(), vtkMesh::topo(), patchToPatch::update(), histogram::write(), regionSizeDistribution::write(), and decomposedBlockData::writeObject().
|
inline |
Delete object (if the pointer is valid) and set pointer to.
nullptr
Definition at line 126 of file autoPtrI.H.
Referenced by meshRefinement::distribute(), massFractions::execute(), distribution::New(), forcing::readCoeffs(), and masterUncollatedFileOperation::readStream().
|
inline |
Return reference to the object data.
Definition at line 135 of file autoPtrI.H.
|
inline |
Return const reference to the object data.
Definition at line 150 of file autoPtrI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::name(), and Foam::T().
|
inline |
Return reference to the object data.
Definition at line 165 of file autoPtrI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::name(), and Foam::T().
|
inline |
Return const reference to the object data.
Definition at line 180 of file autoPtrI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::name(), and Foam::T().
|
inline |
Const cast to the underlying type reference.
Definition at line 195 of file autoPtrI.H.
|
inline |
Return object pointer.
Definition at line 202 of file autoPtrI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::name(), and Foam::T().
|
inline |
Return const object pointer.
Definition at line 217 of file autoPtrI.H.
|
inline |
Take over the object pointer from parameter.
Definition at line 224 of file autoPtrI.H.
References p.
Take over the object pointer from parameter.
Definition at line 231 of file autoPtrI.H.