IOobjectOption Class Reference

A simple container of IOobject preferences. Can also be used for general handling of read/no-read/read-if-present logic outside of an IOobject. More...

Inheritance diagram for IOobjectOption:

Public Types

enum  readOption : unsigned char {
  NO_READ = 0, MUST_READ = 0x1, READ_MODIFIED = 0x3, MUST_READ_IF_MODIFIED = 0x3,
  LAZY_READ = 0x4, READ_IF_PRESENT = 0x4
}
 Enumeration defining read preferences. More...
 
enum  writeOption : unsigned char { NO_WRITE = 0, AUTO_WRITE = 0x10 }
 Enumeration defining write preferences. More...
 
enum  registerOption : unsigned char { NO_REGISTER = 0, REGISTER = 1, LEGACY_REGISTER = 2 }
 Enumeration for use with registerObject(). Values map to bool (false/true) More...
 

Public Member Functions

constexpr IOobjectOption (readOption rOpt=readOption::NO_READ, writeOption wOpt=writeOption::NO_WRITE, registerOption registerObject=registerOption::REGISTER, bool globalObject=false) noexcept
 Default construct (NO_READ, NO_WRITE, REGISTER, non-global) or construct with specified options. More...
 
constexpr IOobjectOption (readOption rOpt, registerOption registerObject=registerOption::REGISTER, bool globalObject=false) noexcept
 Construct NO_WRITE with specified read/register options. More...
 
constexpr IOobjectOption (writeOption wOpt, registerOption registerObject=registerOption::REGISTER, bool globalObject=false) noexcept
 Construct NO_READ with specified write/register options. More...
 
constexpr IOobjectOption (registerOption registerObject, bool globalObject=false) noexcept
 Construct (NO_READ, NO_WRITE) with specified register option. More...
 
constexpr IOobjectOption (readOption rOpt, writeOption wOpt, bool registerObject, bool globalObject=false) noexcept
 Construct from components with specified register option as bool. More...
 
constexpr IOobjectOption (bool registerObject, bool globalObject=false) noexcept
 Construct (NO_READ, NO_WRITE) with specified register option as bool. More...
 
readOption readOpt () const noexcept
 Get the read option. More...
 
readOption readOpt (readOption opt) noexcept
 Set the read option. More...
 
writeOption writeOpt () const noexcept
 Get the write option. More...
 
writeOption writeOpt (writeOption opt) noexcept
 Set the write option. More...
 
bool registerObject () const noexcept
 Should objects created with this IOobject be registered? More...
 
bool registerObject (bool on) noexcept
 Change registration preference. More...
 
bool globalObject () const noexcept
 True if object is treated the same for all processors. More...
 
bool globalObject (bool on) noexcept
 Change global-object status. More...
 
bool isAnyRead () const noexcept
 True if any reading may be required (ie, != NO_READ) More...
 
bool isReadRequired () const noexcept
 True if (MUST_READ | READ_MODIFIED) bits are set. More...
 
bool isReadOptional () const noexcept
 True if (LAZY_READ) bits are set [same as READ_IF_PRESENT]. More...
 
readOptionreadOpt () noexcept
 Access to the read option. More...
 
writeOptionwriteOpt () noexcept
 Access to the write option. More...
 
bool & registerObject () noexcept
 Access to the register object option. More...
 
bool & globalObject () noexcept
 Access to the global object option. More...
 

Static Public Member Functions

static bool isAnyRead (readOption opt) noexcept
 True if any reading may be required (ie, != NO_READ) More...
 
static bool isReadRequired (readOption opt) noexcept
 True if (MUST_READ | READ_MODIFIED) bits are set. More...
 
static bool isReadOptional (readOption opt) noexcept
 True if (LAZY_READ) bits are set [same as READ_IF_PRESENT]. More...
 
static readOption lazierRead (readOption opt) noexcept
 Downgrade readOption optional (LAZY_READ), leaves NO_READ intact. More...
 

Detailed Description

A simple container of IOobject preferences. Can also be used for general handling of read/no-read/read-if-present logic outside of an IOobject.

See also
Foam::IOobject

Definition at line 45 of file IOobjectOption.H.

Member Enumeration Documentation

◆ readOption

enum readOption : unsigned char

Enumeration defining read preferences.

Lowest bit encodes 'must read'. Possible (future) named variants (none | normal | modified | lazy)

Enumerator
NO_READ 

Nothing to be read.

MUST_READ 

Reading required.

READ_MODIFIED 

Reading required, file watched for runTime modification [identical to MUST_READ_IF_MODIFIED]

MUST_READ_IF_MODIFIED 

Reading required, file watched for runTime modification [identical to READ_MODIFIED]

LAZY_READ 

Reading is optional [identical to READ_IF_PRESENT].

READ_IF_PRESENT 

Reading is optional [identical to LAZY_READ].

Definition at line 57 of file IOobjectOption.H.

◆ writeOption

enum writeOption : unsigned char

Enumeration defining write preferences.

Enumerator
NO_WRITE 

Ignore writing from objectRegistry::writeObject()

AUTO_WRITE 

Automatically write from objectRegistry::writeObject()

Definition at line 83 of file IOobjectOption.H.

◆ registerOption

enum registerOption : unsigned char

Enumeration for use with registerObject(). Values map to bool (false/true)

Enumerator
NO_REGISTER 

Do not request registration (bool: false)

REGISTER 

Request registration (bool: true)

LEGACY_REGISTER 

Legacy/default registration request (bool: true)

Definition at line 96 of file IOobjectOption.H.

Constructor & Destructor Documentation

◆ IOobjectOption() [1/6]

constexpr IOobjectOption ( readOption  rOpt = readOption::NO_READ,
writeOption  wOpt = writeOption::NO_WRITE,
registerOption  registerObject = registerOption::REGISTER,
bool  globalObject = false 
)
inlinenoexcept

Default construct (NO_READ, NO_WRITE, REGISTER, non-global) or construct with specified options.

Definition at line 143 of file IOobjectOption.H.

◆ IOobjectOption() [2/6]

constexpr IOobjectOption ( readOption  rOpt,
registerOption  registerObject = registerOption::REGISTER,
bool  globalObject = false 
)
inlinenoexcept

Construct NO_WRITE with specified read/register options.

Definition at line 160 of file IOobjectOption.H.

◆ IOobjectOption() [3/6]

constexpr IOobjectOption ( writeOption  wOpt,
registerOption  registerObject = registerOption::REGISTER,
bool  globalObject = false 
)
inlinenoexcept

Construct NO_READ with specified write/register options.

Definition at line 176 of file IOobjectOption.H.

◆ IOobjectOption() [4/6]

constexpr IOobjectOption ( registerOption  registerObject,
bool  globalObject = false 
)
inlinenoexcept

Construct (NO_READ, NO_WRITE) with specified register option.

Definition at line 192 of file IOobjectOption.H.

◆ IOobjectOption() [5/6]

constexpr IOobjectOption ( readOption  rOpt,
writeOption  wOpt,
bool  registerObject,
bool  globalObject = false 
)
inlinenoexcept

Construct from components with specified register option as bool.

Definition at line 208 of file IOobjectOption.H.

◆ IOobjectOption() [6/6]

constexpr IOobjectOption ( bool  registerObject,
bool  globalObject = false 
)
inlineexplicitnoexcept

Construct (NO_READ, NO_WRITE) with specified register option as bool.

Definition at line 226 of file IOobjectOption.H.

Member Function Documentation

◆ readOpt() [1/3]

◆ readOpt() [2/3]

readOption readOpt ( readOption  opt)
inlinenoexcept

Set the read option.

Returns
the previous value

Definition at line 248 of file IOobjectOption.H.

◆ writeOpt() [1/3]

writeOption writeOpt ( ) const
inlinenoexcept

◆ writeOpt() [2/3]

writeOption writeOpt ( writeOption  opt)
inlinenoexcept

Set the write option.

Returns
the previous value

Definition at line 263 of file IOobjectOption.H.

◆ registerObject() [1/3]

bool registerObject ( ) const
inlinenoexcept

Should objects created with this IOobject be registered?

Definition at line 273 of file IOobjectOption.H.

Referenced by Foam::loadPointField(), faMeshTools::newMesh(), fvMeshTools::newMesh(), regIOobject::operator=(), regIOobject::regIOobject(), regIOobject::rename(), and blockMesh::topology().

Here is the caller graph for this function:

◆ registerObject() [2/3]

bool registerObject ( bool  on)
inlinenoexcept

Change registration preference.

Returns
previous value

Definition at line 278 of file IOobjectOption.H.

◆ globalObject() [1/3]

bool globalObject ( ) const
inlinenoexcept

True if object is treated the same for all processors.

Definition at line 288 of file IOobjectOption.H.

Referenced by IOobject::operator=().

Here is the caller graph for this function:

◆ globalObject() [2/3]

bool globalObject ( bool  on)
inlinenoexcept

Change global-object status.

Returns
previous value

Definition at line 293 of file IOobjectOption.H.

◆ isAnyRead() [1/2]

static bool isAnyRead ( readOption  opt)
inlinestaticnoexcept

True if any reading may be required (ie, != NO_READ)

Definition at line 306 of file IOobjectOption.H.

Referenced by refinementHistory::refinementHistory(), and triSurfaceMesh::triSurfaceMesh().

Here is the caller graph for this function:

◆ isAnyRead() [2/2]

bool isAnyRead ( ) const
inlinenoexcept

True if any reading may be required (ie, != NO_READ)

Definition at line 314 of file IOobjectOption.H.

◆ isReadRequired() [1/2]

static bool isReadRequired ( readOption  opt)
inlinestaticnoexcept

True if (MUST_READ | READ_MODIFIED) bits are set.

Definition at line 322 of file IOobjectOption.H.

Referenced by masterUncollatedFileOperation::findInstance(), and fileOperation::findInstance().

Here is the caller graph for this function:

◆ isReadRequired() [2/2]

◆ isReadOptional() [1/2]

static bool isReadOptional ( readOption  opt)
inlinestaticnoexcept

True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].

Definition at line 338 of file IOobjectOption.H.

◆ isReadOptional() [2/2]

bool isReadOptional ( ) const
inlinenoexcept

◆ lazierRead()

static readOption lazierRead ( readOption  opt)
inlinestaticnoexcept

Downgrade readOption optional (LAZY_READ), leaves NO_READ intact.

Definition at line 354 of file IOobjectOption.H.

Referenced by coordinateSystem::coordinateSystem().

Here is the caller graph for this function:

◆ readOpt() [3/3]

readOption& readOpt ( )
inlinenoexcept

Access to the read option.

Deprecated:
(2021-03) - use readOpt(readOption)

Definition at line 367 of file IOobjectOption.H.

◆ writeOpt() [3/3]

writeOption& writeOpt ( )
inlinenoexcept

Access to the write option.

Deprecated:
(2021-03) - use writeOpt(writeOption)

Definition at line 374 of file IOobjectOption.H.

◆ registerObject() [3/3]

bool& registerObject ( )
inlinenoexcept

Access to the register object option.

Deprecated:
(2021-03) - use registerObject(bool)

Definition at line 381 of file IOobjectOption.H.

◆ globalObject() [3/3]

bool& globalObject ( )
inlinenoexcept

Access to the global object option.

Deprecated:
(2021-03) - use globalObject(bool)

Definition at line 388 of file IOobjectOption.H.


The documentation for this class was generated from the following file: