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_;
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
T * release() noexcept
Release ownership and return the pointer.
A class for managing references or pointers (no reference counting).
bool is_pointer() const noexcept
True if this is a managed pointer (not a reference).
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
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).
bool registered() const noexcept
Query the registered state (ie, has been checked in). This is not necessarily the same as registerObj...
const labelList & watchIndices() const noexcept
Read access to file-monitoring handles.
bool ownedByRegistry() const noexcept
Is this object owned by the registry?
bool store()
Register object with its registry and transfer ownership to the registry.
label eventNo() const noexcept
Event number at last update.
void release(const bool unregister=false) noexcept
Set object as not ownedByRegistry.
bool checkIn()
Add object to registry, if not already registered.
A class for managing temporary objects.
bool is_pointer() const noexcept
True if this is a managed pointer (not a reference).
void protect(bool on) noexcept
Use specified protection against moving for the managed pointer. No-op for references.
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
T * get() noexcept
Return pointer without nullptr checking.
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr char nl
The newline '\n' character (0x0a).