IOerror Class Reference

Report an I/O error. More...

Inheritance diagram for IOerror:
[legend]
Collaboration diagram for IOerror:
[legend]

Public Member Functions

 IOerror (const string &title)
 Construct from title string. More...
 
 IOerror (const dictionary &errDict)
 Construct from dictionary. More...
 
virtual ~IOerror () noexcept
 Destructor. More...
 
const stringioFileName () const noexcept
 The currently defined IO name for output messages. More...
 
label ioStartLineNumber () const noexcept
 The currently defined IO start-line number for output messages. More...
 
label ioEndLineNumber () const noexcept
 The currently defined IO end-line number. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const string &ioFileName, const label ioStartLineNumber=-1, const label ioEndLineNumber=-1)
 Define basic print message. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream)
 Define basic print message for IO stream. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const dictionary &dict)
 
OSstreamoperator() (const std::string &where, const IOstream &ioStream)
 
OSstreamoperator() (const std::string &where, const dictionary &dict)
 
 operator dictionary () const
 Extract a dictionary representation of the error information. More...
 
void exit (const int errNo=1)
 Exit : can be called for any error to exit program. More...
 
void abort ()
 Abort : used to stop code for fatal errors. More...
 
virtual void write (Ostream &os, const bool withTitle=true) const
 Print error message. More...
 
- Public Member Functions inherited from error
 error (const string &title)
 Construct from title string. More...
 
 error (const dictionary &errDict)
 Construct from dictionary. More...
 
 error (const error &err)
 Copy construct. More...
 
virtual ~error () noexcept
 Destructor. More...
 
string message () const
 The accumulated error message. More...
 
void clear () const
 Clear any messages. More...
 
const stringfunctionName () const noexcept
 The currently defined function name for output messages. More...
 
const stringsourceFileName () const noexcept
 The currently defined source-file name for output messages. More...
 
label sourceFileLineNumber () const noexcept
 The currently defined source-file line number for output messages. More...
 
bool throwing () const noexcept
 Return the current exception throwing state (on or off) More...
 
bool throwing (const bool on) noexcept
 Specify exception throwing state (on or off) More...
 
OSstreamstream ()
 Return OSstream for output operations. More...
 
 operator OSstream & ()
 Implicit cast to OSstream for << operations. More...
 
OSstreamoperator() ()
 Explicit convert to OSstream for << operations. More...
 
OSstreamoperator() (const string &functionName)
 Define basic print message. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber=0)
 Define basic print message. More...
 
OSstreamoperator() (const string &functionName, const char *sourceFileName, const int sourceFileLineNumber=0)
 Define basic print message. More...
 
 operator dictionary () const
 Extract a dictionary representation of the error information. More...
 
void exit (const int errNo=1)
 Exit : can be called for any error to exit program. More...
 
void abort ()
 Abort : used to stop code for fatal errors. More...
 
virtual void write (Ostream &os, const bool withTitle=true) const
 Print error message. More...
 
bool throwExceptions (const bool on=true) noexcept
 Specify exception throwing state (default is on) More...
 
bool dontThrowExceptions () noexcept
 Deactivate exception throwing. More...
 
- Public Member Functions inherited from messageStream
 messageStream (const string &title, const errorSeverity severity, const int maxErrors=0)
 Construct from components. More...
 
 messageStream (const dictionary &dict)
 Construct as Fatal from dictionary, extracting the 'title'. More...
 
const stringtitle () const noexcept
 The title of this error type. More...
 
int maxErrors () const noexcept
 The maximum number of errors before program termination. More...
 
int maxErrors (int nErrors) noexcept
 Set the maximum number of errors before program termination. More...
 
OSstreamstream (OSstream *alternative=nullptr)
 
OSstreammasterStream (const label communicator)
 
std::ostream & stdStream ()
 Return std::ostream for output operations. More...
 
 operator OSstream & ()
 Implicit cast to OSstream for << operations. More...
 
OSstreamoperator() ()
 Explicitly convert to OSstream for << operations. More...
 
OSstreamoperator() (const string &functionName)
 Report 'From function-name'. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber=0)
 
OSstreamoperator() (const string &functionName, const char *sourceFileName, const int sourceFileLineNumber=0)
 Report 'From function-name, source file, line number'. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const string &ioFileName, const label ioStartLineNumber=-1, const label ioEndLineNumber=-1)
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &)
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const dictionary &)
 

Static Public Member Functions

static void SafeFatalIOError (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream, const string &msg)
 Print basic message and exit. More...
 
- Static Public Member Functions inherited from error
static bool master (const label communicator=-1)
 
static bool warnAboutAge (const int version) noexcept
 Test if an age warning should be emitted. More...
 
static bool warnAboutAge (const char *what, const int version)
 Emit warning on stderr about something being old. More...
 
static void safePrintStack (std::ostream &os)
 
static void printStack (Ostream &os)
 Helper function to print a stack. More...
 
static bool useAbort ()
 True if FOAM_ABORT is on. More...
 

Additional Inherited Members

- Public Types inherited from messageStream
enum  errorSeverity {
  INFO = 1 , INFO_STDERR , WARNING , SERIOUS ,
  FATAL
}
 Message type, error severity flags. More...
 
- Static Public Attributes inherited from messageStream
static int level
 The output level (verbosity) of messages. More...
 
static int redirect
 The output redirection of messages. More...
 
- Protected Member Functions inherited from error
void simpleExit (const int errNo, const bool isAbort)
 Exit or abort, without throwing or job control handling. More...
 
- Protected Attributes inherited from error
string functionName_
 
string sourceFileName_
 
label sourceFileLineNumber_
 
bool throwing_
 
std::unique_ptr< OStringStreammessageStreamPtr_
 
- Protected Attributes inherited from messageStream
string title_
 
errorSeverity severity_
 
int maxErrors_
 
int errorCount_
 

Detailed Description

Report an I/O error.

Definition at line 279 of file error.H.

Constructor & Destructor Documentation

◆ IOerror() [1/2]

IOerror ( const string title)
explicit

Construct from title string.

Definition at line 38 of file IOerror.C.

◆ IOerror() [2/2]

IOerror ( const dictionary errDict)
explicit

Construct from dictionary.

Definition at line 47 of file IOerror.C.

◆ ~IOerror()

~IOerror ( )
virtualnoexcept

Destructor.

Definition at line 58 of file IOerror.C.

Member Function Documentation

◆ ioFileName()

const string & ioFileName ( ) const
inlinenoexcept

The currently defined IO name for output messages.

Definition at line 314 of file error.H.

◆ ioStartLineNumber()

label ioStartLineNumber ( ) const
inlinenoexcept

The currently defined IO start-line number for output messages.

Definition at line 320 of file error.H.

◆ ioEndLineNumber()

label ioEndLineNumber ( ) const
inlinenoexcept

The currently defined IO end-line number.

Definition at line 326 of file error.H.

◆ operator()() [1/5]

Foam::OSstream & operator() ( const char *  functionName,
const char *  sourceFileName,
const int  sourceFileLineNumber,
const string ioFileName,
const label  ioStartLineNumber = -1,
const label  ioEndLineNumber = -1 
)

Define basic print message.

Returns
OSstream for further operations

Definition at line 64 of file IOerror.C.

References faMatrix< Type >::operator, and os().

Here is the call graph for this function:

◆ operator()() [2/5]

Foam::OSstream & operator() ( const char *  functionName,
const char *  sourceFileName,
const int  sourceFileLineNumber,
const IOstream ioStream 
)

Define basic print message for IO stream.

Returns
OSstream for further operations

Definition at line 89 of file IOerror.C.

◆ operator()() [3/5]

Foam::OSstream & operator() ( const char *  functionName,
const char *  sourceFileName,
const int  sourceFileLineNumber,
const dictionary dict 
)

Define basic print message for dictionary entries. Uses the dictionary::relativeName() on output.

Returns
OSstream for further operations

Definition at line 109 of file IOerror.C.

References dict, dictionary::endLineNumber(), dictionary::relativeName(), and dictionary::startLineNumber().

Here is the call graph for this function:

◆ operator()() [4/5]

Foam::OSstream & operator() ( const std::string &  where,
const IOstream ioStream 
)

Define basic print message for IO stream, independent of a source-file reference. Uses the dictionary::relativeName() on output.

Returns
OSstream for further operations

Definition at line 129 of file IOerror.C.

◆ operator()() [5/5]

Foam::OSstream & operator() ( const std::string &  where,
const dictionary dict 
)

Define basic print message for dictionary entries, independent of a source-file reference. Uses the dictionary::relativeName() on output.

Returns
OSstream for further operations

Definition at line 147 of file IOerror.C.

References dict, dictionary::endLineNumber(), dictionary::relativeName(), and dictionary::startLineNumber().

Here is the call graph for this function:

◆ SafeFatalIOError()

void SafeFatalIOError ( const char *  functionName,
const char *  sourceFileName,
const int  sourceFileLineNumber,
const IOstream ioStream,
const string msg 
)
static

Print basic message and exit.

Uses cerr if streams not yet constructed (at startup). Use in startup parsing instead of FatalError.

Definition at line 165 of file IOerror.C.

References JobInfo::constructed, Foam::exit(), Foam::FatalIOError, IOstream::lineNumber(), Foam::nl, and IOstream::relativeName().

Here is the call graph for this function:

◆ operator dictionary()

operator dictionary ( ) const

Extract a dictionary representation of the error information.

◆ exit()

void exit ( const int  errNo = 1)

Exit : can be called for any error to exit program.

Definition at line 243 of file IOerror.C.

Referenced by IFstream::operator()(), and Istream::operator()().

Here is the caller graph for this function:

◆ abort()

void abort ( )

Abort : used to stop code for fatal errors.

Definition at line 249 of file IOerror.C.

◆ write()

void write ( Ostream os,
const bool  withTitle = true 
) const
virtual

Print error message.

Reimplemented from error.

Definition at line 255 of file IOerror.C.

References Foam::foamVersion::api, IOstream::bad(), messageStream::level, Foam::nl, os(), Foam::foamVersion::patch, and Foam::foamVersion::patched().

Referenced by Foam::operator<<().

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

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