LLVM OpenMP* Runtime Library
Public Member Functions | List of all members
kmp_safe_raii_file_t Class Reference

#include <kmp.h>

Public Member Functions

void open (const char *filename, const char *mode, const char *env_var=nullptr)
 
void set_stdout ()
 
void set_stderr ()
 

Detailed Description

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.

Definition at line 4216 of file kmp.h.

Member Function Documentation

◆ open()

void kmp_safe_raii_file_t::open ( const char *  filename,
const char *  mode,
const char *  env_var = nullptr 
)
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 4238 of file kmp.h.

◆ set_stderr()

void kmp_safe_raii_file_t::set_stderr ( )
inline

Set the FILE* object to stderr and output there No open call should happen before this call.

Definition at line 4261 of file kmp.h.

◆ set_stdout()

void kmp_safe_raii_file_t::set_stdout ( )
inline

Set the FILE* object to stdout and output there No open call should happen before this call.

Definition at line 4255 of file kmp.h.


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