#include <streambuf_tmpnam.h>
Public Member Functions | |
filgen_tmpfile () | |
FILE * | operator() (void) const |
~filgen_tmpfile () | |
Private Attributes | |
FILE * | _FI |
rpa::filgen_tmpfile::filgen_tmpfile | ( | ) |
No need to destroy the file in the destructor. It is done automatically.
rpa::filgen_tmpfile::~filgen_tmpfile | ( | ) |
The file is closed because the rule for all filgen_XXXX classes is that the resources created must be destroyed too. It is not possible to remove the file because we are not given its name, but it must be deleted automatically once it is closed.
Maybe because of a filegen converter, the int file descriptor which is hidden in the FILE object, is already closed. If this is the case, we must tolerate the error 'Bad Number'. There might as well be a race condition between the moment this integer file descriptor is closed by a derived class, and now : In the mean time, it could be re-allocated by another thread : Therefore, the only serious solution is to lock (flock) it in the destructor of the derived class. Nevertheless, we apply here this short-term solution until something else is seriously needed.
FILE* rpa::filgen_tmpfile::operator() | ( | void | ) | const [inline] |
This method is called by the constructor of a streambuf. The returned value must always be the same because this 'const' method may be called several times, e.g. for debugging, without side effects.
FILE* rpa::filgen_tmpfile::_FI [private] |