LLVM OpenMP 20.0.0git
|
This class safely opens and closes a C-style FILE* object using RAII semantics. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/openmp/runtime/src/kmp.h"
Public Member Functions | |
kmp_safe_raii_file_t () | |
kmp_safe_raii_file_t (const char *filename, const char *mode, const char *env_var=nullptr) | |
kmp_safe_raii_file_t (const kmp_safe_raii_file_t &other)=delete | |
kmp_safe_raii_file_t & | operator= (const kmp_safe_raii_file_t &other)=delete |
~kmp_safe_raii_file_t () | |
void | open (const char *filename, const char *mode, const char *env_var=nullptr) |
Open filename using mode. | |
int | try_open (const char *filename, const char *mode) |
Instead of erroring out, return non-zero when unsuccessful fopen() for any reason. | |
void | set_stdout () |
Set the FILE* object to stdout and output there No open call should happen before this call. | |
void | set_stderr () |
Set the FILE* object to stderr and output there No open call should happen before this call. | |
operator bool () | |
operator FILE * () | |
This class safely opens and closes a C-style FILE* object using RAII semantics.
There are also methods which allow using stdout or stderr as the underlying FILE* object. With the implicit conversion operator to FILE*, an object with this type can be used in any function which takes a FILE* object e.g., fprintf(). No close method is needed at use sites.
|
inline |
|
delete |
|
inline |
Open filename using mode.
This is automatically closed in the destructor. The env_var parameter indicates the environment variable the filename came from if != nullptr.
Definition at line 4742 of file kmp.h.
References __kmp_fatal(), __kmp_msg_null, f(), KMP_ASSERT, KMP_ERR, KMP_HNT, KMP_MSG, and mode.
Referenced by kmp_safe_raii_file_t().
|
inline |
|
inline |
|
delete |
|
inline |
Set the FILE* object to stderr and output there No open call should happen before this call.
Definition at line 4774 of file kmp.h.
References f(), and KMP_ASSERT.
|
inline |
Set the FILE* object to stdout and output there No open call should happen before this call.
Definition at line 4768 of file kmp.h.
References f(), and KMP_ASSERT.
Instead of erroring out, return non-zero when unsuccessful fopen() for any reason.
Definition at line 4759 of file kmp.h.
References f(), KMP_ASSERT, and mode.