29 #ifndef fileOperation_H 30 #define fileOperation_H 117 const word& constantName,
201 const bool checkVariants =
true,
202 const bool followLink =
true 209 const bool checkVariants =
true,
210 const bool followLink =
true 218 const bool checkVariants =
true,
219 const bool followLink =
true 226 const bool followLink =
true 234 const bool checkVariants =
true,
235 const bool followLink =
true 242 const bool checkVariants =
true,
243 const bool followLink =
true 250 const bool checkVariants =
true,
251 const bool followLink =
true 258 const bool checkVariants =
true,
259 const bool followLink =
true 267 const bool filterVariants =
true,
268 const bool followLink =
true 276 const bool followLink =
true 288 const bool followLink =
false 297 const std::string& ext =
"bak" 329 const bool globalFile,
338 const bool globalFile,
365 const word& typeName,
366 const bool read =
true 374 const bool masterOnly,
390 const bool write =
true 415 const bool write =
true 443 const bool masterOnly,
491 const scalar startValue,
492 const word& stopInstance
500 virtual void flush()
const;
515 const word& instance,
pathType
Enumeration for the location of an IOobject.
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 directory and its contents.
List< dirIndex > dirIndexList
A class for handling file names.
virtual off_t fileSize(const fileName &, const bool checkVariants=true, const bool followLink=true) const =0
Return size of file.
virtual fileMonitor::fileState getState(const label) const
Get current state of file (using handle)
virtual bool read(regIOobject &, const bool masterOnly, const IOstream::streamFormat defaultFormat, const word &typeName) const =0
Top-level read.
virtual bool chMod(const fileName &, const mode_t) const =0
Set the file mode.
Checking for changes to files.
A 2-tuple for storing two objects of different types.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void cpFiles(const fileName &srcDir, const fileName &targetDir)
Copy all the files from the source to the target directory.
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 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.
bool exists(IOobject &io) const
Does ioobject exist. Is either a directory (empty name()) or.
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"))
Tuple2< fileName, Tuple2< pathType, label > > dirIndex
Description of processor directory naming:
tmpNrc< dirIndexList > lookupProcessorsPath(const fileName &) const
Lookup name of processorsDDD using cache. Return empty fileName.
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool read=true) const =0
Reads header for regIOobject and returns an ISstream.
fileName processorsPath(const IOobject &, const word &instance, const word &procDir) const
Generate path (like io.path) with provided instance and any.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
declareRunTimeSelectionTable(autoPtr, fileOperation, word,(const bool verbose),(verbose))
virtual autoPtr< Ostream > NewOFstream(const fileName &filePath, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool write=true) const =0
Generate an Ostream that writes a file.
static autoPtr< fileOperation > New(const word &type, const bool verbose)
Select type.
void cacheProcessorsPath(const fileName &fName) const
Detect presence of processorsDDD.
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
virtual fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true) const =0
Read a directory and return the entries as a string list.
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 fileName filePath(const bool globalFile, const IOobject &, const word &typeName) const =0
Search for an object. globalFile : also check undecomposed case.
virtual IOobject findInstance(const IOobject &io, const scalar startValue, const word &stopInstance) const
Find instance where IOobject is. Fails if cannot be found.
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
streamFormat
Enumeration for the format of data in the stream.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
const fileOperation & fileHandler()
Get current file handler.
virtual label addWatch(const fileName &) const
Add watching of a file. Returns handle.
fileType
Enumeration of file types.
An STL-conforming hash table.
virtual fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true) const =0
Return the file type: directory, file or link.
virtual bool cp(const fileName &src, const fileName &dst, const bool followLink=true) const =0
Copy, recursively if necessary, the source to the destination.
static void mergeTimes(const instantList &extraTimes, const word &constantName, instantList ×)
Merge two times.
compressionType
Enumeration for the format of data in the stream.
static word processorsBaseDir
Return the processors directory name (usually "processors")
virtual bool writeObject(const regIOobject &, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool write=true) const
Writes a regIOobject (so header, contents and divider).
fileName processorsCasePath(const IOobject &, const word &procDir) const
Generate path (like io.path) from root+casename with any.
fileOperation(const label comm)
Construct null.
fileMonitor & monitor() const
HashTable< dirIndexList > procsDirs_
Detected processors directories.
virtual time_t lastModified(const fileName &, const bool checkVariants=true, const bool followLink=true) const =0
Return time of last file modification.
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
A class for managing temporary objects without reference counting.
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 fileName dirPath(const bool globalFile, const IOobject &) const =0
Search for a directory. globalFile : also check undecomposed.
static instantList sortTimes(const fileNameList &, const word &)
Sort directory entries according to time value.
virtual autoPtr< ISstream > NewIFstream(const fileName &filePath, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion) const =0
Generate an ISstream that reads a file.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
const label comm_
Communicator to use.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
static label detectProcessorPath(const fileName &)
Detect processor number from '/aa/bb/processorDDD/cc'.
TypeName("fileOperation")
Runtime type information.
Registry of regIOobjects.
virtual bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true) const =0
Does the name exist as a file in the file system?
virtual label findWatch(const labelList &watchIndices, const fileName &) const
Find index (or -1) of file in list of handles.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static const NamedEnum< pathType, 12 > pathTypeNames_
virtual fileName objectPath(const IOobject &io, const word &typeName) const
Generate disk file name for object. Opposite of filePath.
static label splitProcessorPath(const fileName &, fileName &path, fileName &procDir, fileName &local, label &groupStart, label &groupSize, label &nProcs)
Split fileName into part before 'processor' and part after.
virtual void setNProcs(const label nProcs)
Set number of processor directories/results. Only used in.
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
virtual double highResLastModified(const fileName &, const bool checkVariants=true, const bool followLink=true) const =0
Return time of last file modification.
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const =0
Read object header from supplied file.
virtual word processorsDir(const IOobject &io) const
Actual name of processors dir (for use in mode PROCOBJECT,.
virtual mode_t mode(const fileName &, const bool checkVariants=true, const bool followLink=true) const =0
Return the file mode.