fileOperation that assumes file operations are local. More...
Public Member Functions | |
TypeName ("uncollated") | |
Runtime type information. More... | |
uncollatedFileOperation (const bool verbose) | |
Construct null. More... | |
virtual | ~uncollatedFileOperation () |
Destructor. More... | |
virtual bool | mkDir (const fileName &, mode_t=0777) const |
Make directory. More... | |
virtual bool | chMod (const fileName &, const mode_t) const |
Set the file mode. More... | |
virtual mode_t | mode (const fileName &, const bool checkVariants=true, const bool followLink=true) const |
Return the file mode. More... | |
virtual fileType | type (const fileName &, const bool checkVariants=true, const bool followLink=true) const |
Return the file type: directory, file or link. More... | |
virtual bool | exists (const fileName &, const bool checkVariants=true, const bool followLink=true) const |
Does the name exist (as directory or file) in the file system? More... | |
virtual bool | isDir (const fileName &, const bool followLink=true) const |
Does the name exist as a directory in the file system? More... | |
virtual bool | isFile (const fileName &, const bool checkVariants=true, const bool followLink=true) const |
Does the name exist as a FILE in the file system? More... | |
virtual off_t | fileSize (const fileName &, const bool checkVariants=true, const bool followLink=true) const |
Return size of file. More... | |
virtual time_t | lastModified (const fileName &, const bool checkVariants=true, const bool followLink=true) const |
Return time of last file modification. More... | |
virtual double | highResLastModified (const fileName &, const bool checkVariants=true, const bool followLink=true) const |
Return time of last file modification. More... | |
virtual fileNameList | readDir (const fileName &, const fileType=fileType::file, const bool filtergz=true, const bool followLink=true) const |
Read a directory and return the entries as a string list. More... | |
virtual bool | cp (const fileName &src, const fileName &dst, const bool followLink=true) const |
Copy, recursively if necessary, the source to the destination. More... | |
virtual bool | ln (const fileName &src, const fileName &dst) const |
Create a softlink. dst should not exist. Returns true if. More... | |
virtual bool | mv (const fileName &src, const fileName &dst, const bool followLink=false) const |
Rename src to dst. More... | |
virtual bool | mvBak (const fileName &, const std::string &ext="bak") const |
Rename to a corresponding backup file. More... | |
virtual bool | rm (const fileName &) const |
Remove a file, returning true if successful otherwise false. More... | |
virtual bool | rmDir (const fileName &) const |
Remove a directory and its contents. More... | |
virtual fileName | filePath (const bool globalFile, const IOobject &, const word &typeName) const |
Search for an object. globalFile : also check undecomposed case. More... | |
virtual fileName | dirPath (const bool globalFile, const IOobject &) const |
Search for a directory. globalFile : also check undecomposed. More... | |
virtual fileNameList | readObjects (const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const |
Search directory for objects. Used in IOobjectList. More... | |
virtual bool | readHeader (IOobject &, const fileName &, const word &typeName) const |
Read object header from supplied file. More... | |
virtual autoPtr< ISstream > | readStream (regIOobject &, const fileName &, const word &typeName, const bool read=true) const |
Reads header for regIOobject and returns an ISstream. More... | |
virtual bool | read (regIOobject &, const bool masterOnly, const IOstream::streamFormat defaultFormat, const word &typeName) const |
Top-level read. More... | |
virtual autoPtr< ISstream > | NewIFstream (const fileName &filePath, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion) const |
Generate an ISstream that reads a file. More... | |
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 |
Generate an Ostream that writes a file. More... | |
Public Member Functions inherited from fileOperation | |
TypeName ("fileOperation") | |
Runtime type information. More... | |
fileOperation (const label comm) | |
Construct null. More... | |
declareRunTimeSelectionTable (autoPtr, fileOperation, word,(const bool verbose),(verbose)) | |
virtual | ~fileOperation () |
Destructor. More... | |
virtual fileName | objectPath (const IOobject &io, const word &typeName) const |
Generate disk file name for object. Opposite of filePath. More... | |
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). More... | |
virtual fileName | filePath (const fileName &) const |
Search for a file or directory. Use IOobject version in. More... | |
virtual label | addWatch (const fileName &) const |
Add watching of a file. Returns handle. More... | |
virtual bool | removeWatch (const label) const |
Remove watch on a file (using handle) More... | |
virtual label | findWatch (const labelList &watchIndices, const fileName &) const |
Find index (or -1) of file in list of handles. More... | |
virtual void | addWatches (regIOobject &, const fileNameList &) const |
Helper: add watches for list of regIOobjects. More... | |
virtual fileName | getFile (const label) const |
Get name of file being watched (using handle) More... | |
virtual void | updateStates (const bool masterOnly, const bool syncPar) const |
Update state of all files. More... | |
virtual fileMonitor::fileState | getState (const label) const |
Get current state of file (using handle) More... | |
virtual void | setUnmodified (const label) const |
Set current state of file (using handle) to unmodified. More... | |
virtual word | processorsDir (const IOobject &io) const |
Actual name of processors dir (for use in mode PROCOBJECT,. More... | |
virtual word | processorsDir (const fileName &) const |
Actual name of processors dir (for use in mode PROCOBJECT,. More... | |
virtual void | setNProcs (const label nProcs) |
Set number of processor directories/results. Only used in. More... | |
virtual label | nProcs (const fileName &dir, const fileName &local="") const |
Get number of processor directories/results. Used for e.g. More... | |
virtual instantList | findTimes (const fileName &, const word &) const |
Get sorted list of times. More... | |
virtual IOobject | findInstance (const IOobject &io, const scalar startValue, const word &stopInstance) const |
Find instance where IOobject is. Fails if cannot be found. More... | |
virtual void | setTime (const Time &) const |
Callback for time change. More... | |
virtual void | flush () const |
Forcibly wait until all output done. Flush any cached data. More... | |
fileName | processorsCasePath (const IOobject &, const word &procDir) const |
Generate path (like io.path) from root+casename with any. More... | |
fileName | processorsPath (const IOobject &, const word &instance, const word &procDir) const |
Generate path (like io.path) with provided instance and any. More... | |
fileName | processorsPath (const fileName &, const word &procDir) const |
Operating on fileName: replace processorXXX with procDir. More... | |
Additional Inherited Members | |
Public Types inherited from fileOperation | |
enum | pathType { NOTFOUND , ABSOLUTE , OBJECT , WRITEOBJECT , PROCUNCOLLATED , PROCBASEOBJECT , PROCOBJECT , PARENTOBJECT , FINDINSTANCE , PROCUNCOLLATEDINSTANCE , PROCBASEINSTANCE , PROCINSTANCE } |
Enumeration for the location of an IOobject. More... | |
typedef Tuple2< fileName, Tuple2< pathType, label > > | dirIndex |
Description of processor directory naming: More... | |
typedef List< dirIndex > | dirIndexList |
Static Public Member Functions inherited from fileOperation | |
static autoPtr< fileOperation > | New (const word &type, const bool verbose) |
Select type. More... | |
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. More... | |
static label | detectProcessorPath (const fileName &) |
Detect processor number from '/aa/bb/processorDDD/cc'. More... | |
Static Public Attributes inherited from fileOperation | |
static const NamedEnum< pathType, 12 > | pathTypeNames_ |
static word | processorsBaseDir = "processors" |
Return the processors directory name (usually "processors") More... | |
static word | defaultFileHandler |
Default fileHandler. More... | |
static autoPtr< fileOperation > | fileHandlerPtr_ |
Static fileOperation. More... | |
Protected Member Functions inherited from fileOperation | |
fileMonitor & | monitor () const |
void | cacheProcessorsPath (const fileName &fName) const |
Detect presence of processorsDDD. More... | |
tmpNrc< dirIndexList > | lookupProcessorsPath (const fileName &) const |
Lookup name of processorsDDD using cache. Return empty fileName. More... | |
bool | exists (IOobject &io) const |
Does ioobject exist. Is either a directory (empty name()) or. More... | |
Static Protected Member Functions inherited from fileOperation | |
static instantList | sortTimes (const fileNameList &, const word &) |
Sort directory entries according to time value. More... | |
static void | mergeTimes (const instantList &extraTimes, const word &constantName, instantList ×) |
Merge two times. More... | |
static bool | isFileOrDir (const bool isFile, const fileName &) |
Helper: check for file (isFile) or directory (!isFile) More... | |
Protected Attributes inherited from fileOperation | |
const label | comm_ |
Communicator to use. More... | |
HashTable< dirIndexList > | procsDirs_ |
Detected processors directories. More... | |
autoPtr< fileMonitor > | monitorPtr_ |
file-change monitor for all registered files More... | |
fileOperation that assumes file operations are local.
Definition at line 47 of file uncollatedFileOperation.H.
uncollatedFileOperation | ( | const bool | verbose | ) |
Construct null.
Definition at line 165 of file uncollatedFileOperation.C.
References Foam::endl(), and InfoHeader.
|
virtual |
Destructor.
Definition at line 181 of file uncollatedFileOperation.C.
TypeName | ( | "uncollated" | ) |
Runtime type information.
|
virtual |
Make directory.
Implements fileOperation.
Definition at line 187 of file uncollatedFileOperation.C.
References Foam::mkDir(), and Foam::mode().
|
virtual |
Set the file mode.
Implements fileOperation.
Definition at line 197 of file uncollatedFileOperation.C.
References Foam::chMod(), and Foam::mode().
|
virtual |
Return the file mode.
Implements fileOperation.
Definition at line 207 of file uncollatedFileOperation.C.
References Foam::mode().
|
virtual |
Return the file type: directory, file or link.
Implements fileOperation.
Definition at line 218 of file uncollatedFileOperation.C.
References Foam::type().
|
virtual |
Does the name exist (as directory or file) in the file system?
Optionally enable/disable check for gzip file.
Implements fileOperation.
Definition at line 229 of file uncollatedFileOperation.C.
References Foam::exists().
|
virtual |
Does the name exist as a directory in the file system?
Implements fileOperation.
Definition at line 240 of file uncollatedFileOperation.C.
References Foam::isDir().
|
virtual |
Does the name exist as a FILE in the file system?
Optionally enable/disable check for gzip file.
Implements fileOperation.
Definition at line 250 of file uncollatedFileOperation.C.
References Foam::isFile().
|
virtual |
Return size of file.
Implements fileOperation.
Definition at line 261 of file uncollatedFileOperation.C.
References Foam::fileSize().
|
virtual |
Return time of last file modification.
Implements fileOperation.
Definition at line 272 of file uncollatedFileOperation.C.
References Foam::lastModified().
|
virtual |
Return time of last file modification.
Implements fileOperation.
Definition at line 283 of file uncollatedFileOperation.C.
References Foam::highResLastModified().
|
virtual |
Read a directory and return the entries as a string list.
Implements fileOperation.
Definition at line 322 of file uncollatedFileOperation.C.
References Foam::readDir(), and Foam::type().
Copy, recursively if necessary, the source to the destination.
Implements fileOperation.
Definition at line 334 of file uncollatedFileOperation.C.
References Foam::cp().
Create a softlink. dst should not exist. Returns true if.
successful.
Implements fileOperation.
Definition at line 345 of file uncollatedFileOperation.C.
References Foam::ln().
Rename src to dst.
Implements fileOperation.
Definition at line 355 of file uncollatedFileOperation.C.
References Foam::mv().
|
virtual |
Rename to a corresponding backup file.
If the backup file already exists, attempt with "01" .. "99" suffix
Implements fileOperation.
Definition at line 294 of file uncollatedFileOperation.C.
References Foam::mvBak().
|
virtual |
Remove a file, returning true if successful otherwise false.
Implements fileOperation.
Definition at line 304 of file uncollatedFileOperation.C.
References Foam::rm().
|
virtual |
Remove a directory and its contents.
Implements fileOperation.
Definition at line 313 of file uncollatedFileOperation.C.
References Foam::rmDir().
|
virtual |
Search for an object. globalFile : also check undecomposed case.
Implements fileOperation.
Definition at line 366 of file uncollatedFileOperation.C.
References Foam::endl(), IOobject::objectPath(), and Foam::Pout.
|
virtual |
Search for a directory. globalFile : also check undecomposed.
case
Implements fileOperation.
Definition at line 393 of file uncollatedFileOperation.C.
References Foam::endl(), IOobject::objectPath(), and Foam::Pout.
|
virtual |
Search directory for objects. Used in IOobjectList.
Use non-time searching version
Reimplemented from fileOperation.
Definition at line 419 of file uncollatedFileOperation.C.
References Foam::endl(), Time::findInstancePath(), regIOobject::objectPath(), Foam::Pout, fileOperation::readObjects(), and objectRegistry::time().
Read object header from supplied file.
Implements fileOperation.
Definition at line 468 of file uncollatedFileOperation.C.
References Foam::endl(), IOobject::headerClassName(), InfoInFunction, IOobject::name(), Foam::Pout, IOobject::readHeader(), decomposedBlockData::readMasterHeader(), and autoPtr< T >::valid().
|
virtual |
Reads header for regIOobject and returns an ISstream.
to read the contents.
Implements fileOperation.
Definition at line 521 of file uncollatedFileOperation.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::FatalIOError, FatalIOErrorInFunction, IOobject::headerClassName(), IOobject::name(), regIOobject::objectPath(), Foam::read(), decomposedBlockData::readBlock(), IOobject::readHeader(), and autoPtr< T >::valid().
|
virtual |
Top-level read.
Format set to ASCII if defaultFormat and file format are ASCII
Implements fileOperation.
Definition at line 609 of file uncollatedFileOperation.C.
References UPstream::commsStruct::above(), IOstream::ASCII, UPstream::commsStruct::below(), regIOobject::close(), Foam::endl(), forAll, IOstream::format(), format(), IOobject::headerClassName(), UPstream::linearCommunication(), UPstream::master(), UPstream::msgType(), UPstream::myProcNo(), IOobject::note(), UPstream::nProcs(), UPstream::nProcsSimpleSum, regIOobject::objectPath(), UPstream::parRun(), Foam::Pout, regIOobject::readData(), Pstream::scatter(), UPstream::scheduled, UPstream::treeCommunication(), UPstream::worldComm, and regIOobject::writeData().
|
virtual |
Generate an ISstream that reads a file.
Implements fileOperation.
Definition at line 714 of file uncollatedFileOperation.C.
References format().
|
virtual |
Generate an Ostream that writes a file.
Implements fileOperation.
Definition at line 726 of file uncollatedFileOperation.C.
References format().