CMS 3D CMS Logo

SaveErrno.h

Go to the documentation of this file.
00001 #ifndef CLASSLIB_SAVE_ERRNO_H
00002 # define CLASSLIB_SAVE_ERRNO_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "classlib/sysapi/system.h"
00007 # ifdef _WIN32
00008 #  include <windows.h>
00009 # endif
00010 # include <cerrno>
00011 
00012 namespace lat {
00013 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00014 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00015 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00016 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00017 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00018 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00019 
00022 class SaveErrno
00023 {
00024 public:
00025     SaveErrno (void);
00026     ~SaveErrno (void);
00027     // implicit copy constructor
00028     // implicit assignment operator
00029 
00030 private:
00031     int         m_errno;
00032     int         m_winerr;
00033 };
00034 
00035 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00036 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00037 
00039 inline
00040 SaveErrno::SaveErrno (void)
00041 {
00042     m_errno = errno;
00043 # ifdef _WIN32
00044     m_winerr = GetLastError ();
00045 # endif
00046 }
00047 
00049 inline
00050 SaveErrno::~SaveErrno (void)
00051 {
00052     errno = m_errno;
00053 # ifdef _WIN32
00054     SetLastError (m_winerr);
00055 # endif
00056 }
00057 
00058 } // namespace lat
00059 #endif // CLASSLIB_SAVE_ERRNO_H

Generated on Tue Jun 9 17:38:55 2009 for CMSSW by  doxygen 1.5.4