Public Member Functions | List of all members
uncollatedFileOperation Class Reference

fileOperation that assumes file operations are local. More...

Inheritance diagram for uncollatedFileOperation:
Inheritance graph
[legend]
Collaboration diagram for uncollatedFileOperation:
Collaboration graph
[legend]

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 followLink=true) const
 Return the file mode. More...
 
virtual fileName::Type type (const fileName &, const bool followLink=true) const
 Return the file type: DIRECTORY, FILE or LINK. More...
 
virtual bool exists (const fileName &, const bool checkGzip=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 checkGzip=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 followLink=true) const
 Return size of file. More...
 
virtual time_t lastModified (const fileName &, const bool followLink=true) const
 Return time of last file modification. More...
 
virtual double highResLastModified (const fileName &, const bool followLink=true) const
 Return time of last file modification. More...
 
virtual fileNameList readDir (const fileName &, const fileName::Type=fileName::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 dirctory and its contents. More...
 
virtual fileName filePath (const bool checkGlobal, const IOobject &, const word &typeName) const
 Search for an object. checkGlobal : also check undecomposed case. More...
 
virtual fileName dirPath (const bool checkGlobal, const IOobject &) const
 Search for a directory. checkGlobal : 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< ISstreamreadStream (regIOobject &, const fileName &, const word &typeName, const bool procValid=true) const
 Reads header for regIOobject and returns an ISstream. More...
 
virtual bool read (regIOobject &, const bool masterOnly, const IOstream::streamFormat format, const word &typeName) const
 Top-level read. More...
 
virtual autoPtr< ISstreamNewIFstream (const fileName &) const
 Generate an ISstream that reads a file. More...
 
virtual autoPtr< OstreamNewOFstream (const fileName &pathname, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool valid=true) const
 Generate an Ostream that writes a file. More...
 
- Public Member Functions inherited from fileOperation
 TypeName ("fileOperation")
 Runtime type information. More...
 
 fileOperation ()
 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 valid=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 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 void setTime (const Time &) const
 Callback for time change. More...
 

Additional Inherited Members

- Public Types inherited from fileOperation
enum  pathType {
  NOTFOUND, ABSOLUTE, OBJECT, PROCESSORSOBJECT,
  PARENTOBJECT, FINDINSTANCE, PROCESSORSFINDINSTANCE
}
 Enumeration for the location of an IOobject. More...
 
- Static Public Member Functions inherited from fileOperation
static autoPtr< fileOperationNew (const word &type, const bool verbose)
 Select type. More...
 
- Static Public Attributes inherited from fileOperation
static word processorsDir = "processors"
 Return the processors directory name (usually "processors") More...
 
static word defaultFileHandler
 Default fileHandler. More...
 
static autoPtr< fileOperationfileHandlerPtr_
 Static fileOperation. More...
 
- Protected Member Functions inherited from fileOperation
fileMonitormonitor () const
 
- Static Protected Member Functions inherited from fileOperation
static instantList sortTimes (const fileNameList &, const word &)
 Sort directory entries according to time value. More...
 
static bool isFileOrDir (const bool isFile, const fileName &)
 Helper: check for file (isFile) or directory (!isFile) More...
 
- Protected Attributes inherited from fileOperation
autoPtr< fileMonitormonitorPtr_
 file-change monitor for all registered files More...
 

Detailed Description

fileOperation that assumes file operations are local.

Definition at line 48 of file uncollatedFileOperation.H.

Constructor & Destructor Documentation

◆ uncollatedFileOperation()

uncollatedFileOperation ( const bool  verbose)

Construct null.

Definition at line 153 of file uncollatedFileOperation.C.

References Foam::endl(), and Foam::Info.

Here is the call graph for this function:

◆ ~uncollatedFileOperation()

Destructor.

Definition at line 166 of file uncollatedFileOperation.C.

References uncollatedFileOperation::mkDir().

Here is the call graph for this function:

Member Function Documentation

◆ TypeName()

TypeName ( "uncollated"  )

Runtime type information.

◆ mkDir()

bool mkDir ( const fileName dir,
mode_t  mode = 0777 
) const
virtual

Make directory.

Implements fileOperation.

Definition at line 173 of file uncollatedFileOperation.C.

References uncollatedFileOperation::chMod(), and Foam::mkDir().

Referenced by uncollatedFileOperation::~uncollatedFileOperation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chMod()

bool chMod ( const fileName fName,
const mode_t  mode 
) const
virtual

Set the file mode.

Implements fileOperation.

Definition at line 183 of file uncollatedFileOperation.C.

References Foam::chMod(), and uncollatedFileOperation::mode().

Referenced by uncollatedFileOperation::mkDir().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mode()

mode_t mode ( const fileName fName,
const bool  followLink = true 
) const
virtual

Return the file mode.

Implements fileOperation.

Definition at line 193 of file uncollatedFileOperation.C.

References Foam::mode(), and uncollatedFileOperation::type().

Referenced by uncollatedFileOperation::chMod().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ type()

Foam::fileName::Type type ( const fileName fName,
const bool  followLink = true 
) const
virtual

Return the file type: DIRECTORY, FILE or LINK.

Implements fileOperation.

Definition at line 203 of file uncollatedFileOperation.C.

References uncollatedFileOperation::exists(), and Foam::type().

Referenced by uncollatedFileOperation::mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ exists()

bool exists ( const fileName fName,
const bool  checkGzip = true,
const bool  followLink = true 
) const
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 213 of file uncollatedFileOperation.C.

References Foam::exists(), and uncollatedFileOperation::isDir().

Referenced by uncollatedFileOperation::type().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDir()

bool isDir ( const fileName fName,
const bool  followLink = true 
) const
virtual

Does the name exist as a DIRECTORY in the file system?

Implements fileOperation.

Definition at line 224 of file uncollatedFileOperation.C.

References Foam::isDir(), and uncollatedFileOperation::isFile().

Referenced by uncollatedFileOperation::exists().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isFile()

bool isFile ( const fileName fName,
const bool  checkGzip = true,
const bool  followLink = true 
) const
virtual

Does the name exist as a FILE in the file system?

Optionally enable/disable check for gzip file.

Implements fileOperation.

Definition at line 234 of file uncollatedFileOperation.C.

References uncollatedFileOperation::fileSize(), and Foam::isFile().

Referenced by uncollatedFileOperation::isDir().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fileSize()

off_t fileSize ( const fileName fName,
const bool  followLink = true 
) const
virtual

Return size of file.

Implements fileOperation.

Definition at line 245 of file uncollatedFileOperation.C.

References Foam::fileSize(), and uncollatedFileOperation::lastModified().

Referenced by uncollatedFileOperation::isFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lastModified()

time_t lastModified ( const fileName fName,
const bool  followLink = true 
) const
virtual

Return time of last file modification.

Implements fileOperation.

Definition at line 255 of file uncollatedFileOperation.C.

References uncollatedFileOperation::highResLastModified(), and Foam::lastModified().

Referenced by uncollatedFileOperation::fileSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ highResLastModified()

double highResLastModified ( const fileName fName,
const bool  followLink = true 
) const
virtual

Return time of last file modification.

Implements fileOperation.

Definition at line 265 of file uncollatedFileOperation.C.

References Foam::highResLastModified(), and uncollatedFileOperation::mvBak().

Referenced by uncollatedFileOperation::lastModified().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readDir()

Foam::fileNameList readDir ( const fileName dir,
const fileName::Type  type = fileName::FILE,
const bool  filtergz = true,
const bool  followLink = true 
) const
virtual

Read a directory and return the entries as a string list.

Implements fileOperation.

Definition at line 303 of file uncollatedFileOperation.C.

References uncollatedFileOperation::cp(), and Foam::readDir().

Referenced by uncollatedFileOperation::rmDir().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp()

bool cp ( const fileName src,
const fileName dst,
const bool  followLink = true 
) const
virtual

Copy, recursively if necessary, the source to the destination.

Implements fileOperation.

Definition at line 315 of file uncollatedFileOperation.C.

References Foam::cp(), and uncollatedFileOperation::ln().

Referenced by uncollatedFileOperation::readDir().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ln()

bool ln ( const fileName src,
const fileName dst 
) const
virtual

Create a softlink. dst should not exist. Returns true if.

successful.

Implements fileOperation.

Definition at line 326 of file uncollatedFileOperation.C.

References Foam::ln(), and uncollatedFileOperation::mv().

Referenced by uncollatedFileOperation::cp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mv()

bool mv ( const fileName src,
const fileName dst,
const bool  followLink = false 
) const
virtual

Rename src to dst.

Implements fileOperation.

Definition at line 336 of file uncollatedFileOperation.C.

References uncollatedFileOperation::filePath(), and Foam::mv().

Referenced by uncollatedFileOperation::ln().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mvBak()

bool mvBak ( const fileName fName,
const std::string &  ext = "bak" 
) const
virtual

Rename to a corresponding backup file.

If the backup file already exists, attempt with "01" .. "99" suffix

Implements fileOperation.

Definition at line 275 of file uncollatedFileOperation.C.

References Foam::mvBak(), and uncollatedFileOperation::rm().

Referenced by uncollatedFileOperation::highResLastModified().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rm()

bool rm ( const fileName fName) const
virtual

Remove a file, returning true if successful otherwise false.

Implements fileOperation.

Definition at line 285 of file uncollatedFileOperation.C.

References Foam::rm(), and uncollatedFileOperation::rmDir().

Referenced by uncollatedFileOperation::mvBak().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rmDir()

bool rmDir ( const fileName dir) const
virtual

Remove a dirctory and its contents.

Implements fileOperation.

Definition at line 294 of file uncollatedFileOperation.C.

References uncollatedFileOperation::readDir(), and Foam::rmDir().

Referenced by uncollatedFileOperation::rm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filePath()

Foam::fileName filePath ( const bool  checkGlobal,
const IOobject io,
const word typeName 
) const
virtual

Search for an object. checkGlobal : also check undecomposed case.

Implements fileOperation.

Definition at line 347 of file uncollatedFileOperation.C.

References uncollatedFileOperation::dirPath(), Foam::endl(), IOobject::objectPath(), and Foam::Pout.

Referenced by uncollatedFileOperation::mv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dirPath()

Foam::fileName dirPath ( const bool  checkGlobal,
const IOobject io 
) const
virtual

Search for a directory. checkGlobal : also check undecomposed.

case

Implements fileOperation.

Definition at line 374 of file uncollatedFileOperation.C.

References Foam::endl(), IOobject::objectPath(), Foam::Pout, and uncollatedFileOperation::readObjects().

Referenced by uncollatedFileOperation::filePath().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readObjects()

Foam::fileNameList readObjects ( const objectRegistry db,
const fileName instance,
const fileName local,
word newInstance 
) const
virtual

Search directory for objects. Used in IOobjectList.

Use non-time searching version

Reimplemented from fileOperation.

Definition at line 400 of file uncollatedFileOperation.C.

References Foam::endl(), Time::findInstancePath(), IOobject::objectPath(), Foam::Pout, uncollatedFileOperation::readHeader(), fileOperation::readObjects(), and objectRegistry::time().

Referenced by uncollatedFileOperation::dirPath().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readHeader()

bool readHeader ( IOobject io,
const fileName fName,
const word typeName 
) const
virtual

Read object header from supplied file.

Implements fileOperation.

Definition at line 449 of file uncollatedFileOperation.C.

References Foam::endl(), IOobject::headerClassName(), InfoInFunction, IOobject::objectPath(), IOobject::readHeader(), decomposedBlockData::readMasterHeader(), uncollatedFileOperation::readStream(), and autoPtr< T >::valid().

Referenced by uncollatedFileOperation::readObjects().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readStream()

Foam::autoPtr< Foam::ISstream > readStream ( regIOobject io,
const fileName fName,
const word typeName,
const bool  procValid = true 
) const
virtual

◆ read()

bool read ( regIOobject io,
const bool  masterOnly,
const IOstream::streamFormat  format,
const word typeName 
) const
virtual

◆ NewIFstream()

Foam::autoPtr< Foam::ISstream > NewIFstream ( const fileName filePath) const
virtual

Generate an ISstream that reads a file.

Implements fileOperation.

Definition at line 651 of file uncollatedFileOperation.C.

References uncollatedFileOperation::NewOFstream().

Referenced by uncollatedFileOperation::read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NewOFstream()

Foam::autoPtr< Foam::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
virtual

Generate an Ostream that writes a file.

Implements fileOperation.

Definition at line 661 of file uncollatedFileOperation.C.

Referenced by uncollatedFileOperation::NewIFstream().

Here is the caller graph for this function:

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