39 return ownedByRegistry_;
47 ownedByRegistry_ =
true;
52 <<
"Refuse to store unregistered object: " << this->
name() <<
nl;
55 return ownedByRegistry_;
65 <<
"Object deallocated\n" 69 const bool ok =
p->regIOobject::store();
74 <<
"Failed to store pointer: " <<
p->regIOobject::name()
75 <<
". Risk of memory leakage\n" 87 return store(ptr.release());
103 return store(ptr.release());
132 <<
"Refuse to store reference: " <<
p->
name()
133 <<
". Likely indicates a coding error\n";
175 <<
"Refuse to store reference: " <<
p->
name()
176 <<
". Likely indicates a coding error\n";
194 ownedByRegistry_ =
false;
215 return watchIndices_;
221 return watchIndices_;
void release(const bool unregister=false) noexcept
Set object as not ownedByRegistry.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word & name() const noexcept
Return the object name.
constexpr char nl
The newline '\n' character (0x0a)
label eventNo() const noexcept
Event number at last update.
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
bool store()
Register object with its registry and transfer ownership to the registry.
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
void protect(bool on) noexcept
Use specified protection against moving for the managed pointer. No-op for references.
A class for managing references or pointers (no reference counting)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
T * get() noexcept
Return pointer without nullptr checking.
errorManip< error > abort(error &err)
T * release() noexcept
Release ownership and return the pointer.
const labelList & watchIndices() const noexcept
Read access to file-monitoring handles.
T * get() noexcept
Return pointer without nullptr checking.
T * release() noexcept
Release ownership and return the pointer. A no-op for reference objects (returns nullptr).
#define WarningInFunction
Report a warning using Foam::Warning.
bool ownedByRegistry() const noexcept
Is this object owned by the registry?
bool is_pointer() const noexcept
True if this is a managed pointer (not a reference)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
A class for managing temporary objects.
bool registered() const noexcept
Query the registered state (ie, has been checked in). This is not necessarily the same as registerObj...
bool is_pointer() const noexcept
True if this is a managed pointer (not a reference)