29 #ifndef fileOperation_H 30 #define fileOperation_H 152 const bool followLink =
true 159 const bool followLink =
true 167 const bool checkGzip=
true,
168 const bool followLink =
true 175 const bool followLink =
true 183 const bool checkGzip=
true,
184 const bool followLink =
true 191 const bool followLink =
true 198 const bool followLink =
true 205 const bool followLink =
true 213 const bool filtergz=
true,
214 const bool followLink =
true 222 const bool followLink =
true 234 const bool followLink =
false 243 const std::string& ext =
"bak" 275 const bool checkGlobal,
284 const bool checkGlobal,
311 const word& typeName,
312 const bool valid =
true 319 const bool masterOnly,
335 const bool valid =
true 355 const bool valid =
true 383 const bool masterOnly,
pathType
Enumeration for the location of an IOobject.
virtual bool writeObject(const regIOobject &, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool valid=true) const
Writes a regIOobject (so header, contents and divider).
virtual bool rm(const fileName &) const =0
Remove a file, returning true if successful otherwise false.
autoPtr< fileMonitor > monitorPtr_
file-change monitor for all registered files
virtual bool rmDir(const fileName &) const =0
Remove a dirctory and its contents.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual double highResLastModified(const fileName &, const bool followLink=true) const =0
Return time of last file modification.
A class for handling file names.
fileOperation()
Construct null.
virtual fileMonitor::fileState getState(const label) const
Get current state of file (using handle)
virtual bool chMod(const fileName &, const mode_t) const =0
Set the file mode.
Checking for changes to files.
virtual fileNameList readDir(const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true, const bool followLink=true) const =0
Read a directory and return the entries as a string list.
virtual bool mvBak(const fileName &, const std::string &ext="bak") const =0
Rename to a corresponding backup file.
fileState
Enumeration defining the file state.
virtual off_t fileSize(const fileName &, const bool followLink=true) const =0
Return size of file.
virtual void setUnmodified(const label) const
Set current state of file (using handle) to unmodified.
virtual bool mkDir(const fileName &, mode_t=0777) const =0
Make directory.
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const =0
Rename src to dst.
virtual ~fileOperation()
Destructor.
word format(conversionProperties.lookup("format"))
virtual bool isFile(const fileName &, const bool checkGzip=true, const bool followLink=true) const =0
Does the name exist as a FILE in the file system?
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
declareRunTimeSelectionTable(autoPtr, fileOperation, word,(const bool verbose),(verbose))
virtual mode_t mode(const fileName &, const bool followLink=true) const =0
Return the file mode.
virtual fileName::Type type(const fileName &, const bool followLink=true) const =0
Return the file type: DIRECTORY, FILE or LINK.
static autoPtr< fileOperation > New(const word &type, const bool verbose)
Select type.
virtual bool exists(const fileName &, const bool checkGzip=true, const bool followLink=true) const =0
Does the name exist (as DIRECTORY or FILE) in the file system?
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool valid=true) const =0
Reads header for regIOobject and returns an ISstream.
virtual bool ln(const fileName &src, const fileName &dst) const =0
Create a softlink. dst should not exist. Returns true if.
A class for handling words, derived from string.
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
virtual autoPtr< Ostream > NewOFstream(const fileName &pathname, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool valid=true) const =0
Generate an Ostream that writes a file.
streamFormat
Enumeration for the format of data in the stream.
virtual autoPtr< ISstream > NewIFstream(const fileName &) const =0
Generate an ISstream that reads a file.
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
virtual fileName filePath(const bool checkGlobal, const IOobject &, const word &typeName) const =0
Search for an object. checkGlobal : also check undecomposed case.
const fileOperation & fileHandler()
Get current file handler.
virtual label addWatch(const fileName &) const
Add watching of a file. Returns handle.
virtual bool cp(const fileName &src, const fileName &dst, const bool followLink=true) const =0
Copy, recursively if necessary, the source to the destination.
compressionType
Enumeration for the format of data in the stream.
static word processorsDir
Return the processors directory name (usually "processors")
fileMonitor & monitor() const
static bool isFileOrDir(const bool isFile, const fileName &)
Helper: check for file (isFile) or directory (!isFile)
static autoPtr< fileOperation > fileHandlerPtr_
Static fileOperation.
virtual label nProcs(const fileName &dir, const fileName &local="") const
Get number of processor directories/results. Used for e.g.
virtual void setTime(const Time &) const
Callback for time change.
static word defaultFileHandler
Default fileHandler.
static const versionNumber currentVersion
Current version number.
virtual bool isDir(const fileName &, const bool followLink=true) const =0
Does the name exist as a DIRECTORY in the file system?
virtual time_t lastModified(const fileName &, const bool followLink=true) const =0
Return time of last file modification.
static instantList sortTimes(const fileNameList &, const word &)
Sort directory entries according to time value.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual bool read(regIOobject &, const bool masterOnly, const IOstream::streamFormat format, const word &typeName) const =0
Top-level read.
TypeName("fileOperation")
Runtime type information.
Registry of regIOobjects.
virtual label findWatch(const labelList &watchIndices, const fileName &) const
Find index (or -1) of file in list of handles.
virtual fileName dirPath(const bool checkGlobal, const IOobject &) const =0
Search for a directory. checkGlobal : also check undecomposed.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual fileName objectPath(const IOobject &io, const word &typeName) const
Generate disk file name for object. Opposite of filePath.
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const =0
Read object header from supplied file.
Type
Enumerations to handle file types and modes.