rpa::filgen_tmpfile Class Reference

#include <streambuf_tmpnam.h>

List of all members.

Public Member Functions

 filgen_tmpfile ()
FILE * operator() (void) const
 ~filgen_tmpfile ()

Private Attributes

FILE * _FI


Detailed Description

This class creates a temporary 'FILE ptr', by encapsulating 'tmpfile'. 'operator() const' returns a FILE ptr. The file name is unknown and hidden into 'tmpfile'.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.


Member Data Documentation

FILE* rpa::filgen_tmpfile::_FI [private]


The documentation for this class was generated from the following files:
Generated on Tue Sep 25 10:20:38 2007 for rpa by  doxygen 1.4.7