98 #ifndef Foam_IOobject_H 99 #define Foam_IOobject_H 108 #include <type_traits> 118 class objectRegistry;
122 Ostream& operator<<(Ostream&, const InfoProxy<IOobject>&);
128 struct is_globalIOobject : std::false_type {};
137 public IOobjectOption
168 static bool bannerEnabled_;
177 unsigned char sizeofLabel_;
180 unsigned char sizeofScalar_;
186 word headerClassName_;
210 bool readAndCheckHeader
213 const word& typeName,
214 const bool checkType =
true,
216 const bool verbose =
true 230 const word& objectType,
240 const word& objectType,
276 return bannerEnabled_;
283 bool old(bannerEnabled_);
305 const fileName&
path,
313 template<
class StringType>
326 const std::string& scope,
334 const std::string& scope,
357 const word& ioName =
"" 518 virtual
void rename(const word& newName)
532 void resetHeader(const word& newName = word::null);
558 inline word
group() const;
561 inline word
member() const;
582 fileName
path() const;
591 const fileName&
local = fileName::null
598 const fileName&
local = fileName::null
615 const word& typeName,
624 const word& typeName,
649 const
bool checkType = true,
653 const
bool verbose = true
693 const
word& objectType,
725 inline bool IOobject::isHeaderClass<void>()
const 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...
writeOption
Enumeration defining write preferences.
autoPtr< IOobject > clone() const
Clone.
static bool fileNameComponents(const fileName &path, fileName &instance, fileName &local, word &name)
Split path into instance, local, name components.
A class for handling file names.
fileName globalFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching up if in parallel.
static float fileModificationSkew
Time skew (seconds) for file modification checks.
void operator=(const IOobject &io)
Copy assignment, copies all values (except the registry)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
virtual const dictionary * findMetaData() const noexcept
Return pointer to meta-data (if any) or nullptr.
const word & name() const noexcept
Return the object name.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
virtual void rename(const word &newName)
Rename the object.
static Ostream & writeDivider(Ostream &os)
Write the standard file section divider.
const string & note() const noexcept
Return the optional note.
word member() const
Return member (name without the extension)
void setBad(const string &s)
Set the object state to bad.
A simple container for options an IOstream can normally have.
bool bad() const noexcept
Did last readHeader() fail?
word group() const
Return group (extension part of name)
bool good() const noexcept
Did last readHeader() succeed?
Ignore writing from objectRegistry::writeObject()
bool writeHeader(Ostream &os) const
Write header with current type()
fileName objectPath() const
The complete path + object name.
fileName typeFilePath(const bool search=true) const
Call localFilePath or globalFilePath for given type depending on its is_globalIOobject trait...
IOstreamOption parseHeader(const dictionary &headerDict)
Parse 'FoamFile' header contents and set the IOobject characteristics and return the stream character...
fileName path() const
The complete path for the object (with instance, local,...).
bool hasHeaderClass() const noexcept
True if headerClassName() is non-empty (after reading)
const fileName & caseName() const noexcept
Return the Time::caseName()
bool globalObject() const noexcept
True if object is treated the same for all processors.
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
A class for handling words, derived from Foam::string.
fileCheckTypes
Enumeration defining the file checking options.
static int maxFileModificationPolls
Max number of times to poll for file modification changes.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
fileName localFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching locally.
const fileName & globalCaseName() const noexcept
Return the Time::globalCaseName()
virtual ~IOobject()=default
Destructor.
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info.
const Time & time() const noexcept
Return Time associated with the objectRegistry.
InfoProxy< IOobject > info() const noexcept
Return info proxy, for printing information to a stream.
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static const Enum< fileCheckTypes > fileCheckTypesNames
Names for the fileCheckTypes.
OBJstream os(runTime.globalPath()/outputName)
static fileCheckTypes fileModificationChecking
Type of file modification checking.
static bool bannerEnabled() noexcept
Status of output file banner.
fileName globalObjectPath() const
The complete global path + object name.
const fileName & instance() const noexcept
Read access to instance path component.
static char scopeSeparator
Character for scoping object names (':' or '_')
unsigned labelByteSize() const noexcept
The sizeof (label) in bytes, possibly read from the header.
static void writeHeaderContent(Ostream &os, const IOobject &io, const word &objectType, const dictionary *metaDataDict=nullptr)
Helper: write content for FoamFile IOobject header with optional meta information.
registerOption
Enumeration for use with registerObject(). Values map to bool (false/true)
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
const word & headerClassName() const noexcept
Return name of the class name read from header.
const fileName & rootPath() const noexcept
Return the Time::rootPath()
A helper class for outputting values to Ostream.
bool isHeaderClassName() const
Same as isHeaderClass()
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
TypeName("IOobject")
Declare type-name, virtual type (with debug switch)
fileName objectRelPath() const
The object path relative to the root.
bool registerObject() const noexcept
Should objects created with this IOobject be registered?
static Ostream & writeBanner(Ostream &os, const bool noSyntaxHint=false)
Write the standard OpenFOAM file/dictionary banner.
fileName globalPath() const
The complete global path for the object (with instance, local,...)
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Registry of regIOobjects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
objectState
Enumeration defining the valid states of an IOobject.
const fileName & local() const noexcept
Read access to local path component.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void resetHeader(const word &newName=word::null)
Clear various bits (headerClassName, note, sizeof...) that would be obtained when reading from a file...
bool readHeader(Istream &is)
Read header ('FoamFile' dictionary) and set the IOobject and stream characteristics.
Defines the attributes of an object for which implicit objectRegistry management is supported...
void warnNoRereading() const
Helper: warn that type does not support re-reading.
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Return the IOobject, but also consider an alternative file name.
bool isHeaderClass() const
Check if headerClassName() equals Type::typeName.
unsigned scalarByteSize() const noexcept
The sizeof (scalar) in bytes, possibly read from the header.
readOption
Enumeration defining read preferences.