Skip to content

Modify the static regIOobject::store method, possibly remove the member version?

Just discussed with @Mattijs, following up on discussions with @andy

Given the scenario of having a local (unregistered) field

volScalarField* ptr = volScalarField:New(...).ptr();  // An unregistered pointer

I would later like to register this on its objectRegistry and have the registry take ownership.

  • Using ptr->store() merely changes the ownership flag, but doesn't register.
  • Using ptr->checkIn() will register it, but not take ownership.

The static store() version is just the same as the member one, with a nullptr check, but does not actually give ownership to the registry.

The static regIOobject::store() should probably attempt to check-in the object if not already marked as registered_. If the object cannot be checked in, Fatal, Warn, or package as autoPtr for deletion?

Minor (style) - the objectRegistry debug diagnostics will warn about attempting to insert an object with identical name. Should probably check if existing object is actually different.

Edited by Mark OLESEN