00001 #include "Utilities/StorageFactory/interface/IOChannel.h" 00002 #include "Utilities/StorageFactory/src/SysIOChannel.h" 00003 #include "Utilities/StorageFactory/src/Throw.h" 00004 #include <algorithm> 00005 #include <cassert> 00006 00032 00033 00034 00035 00058 00059 00060 00061 00062 IOChannel::IOChannel (IOFD fd /* = EDM_IOFD_INVALID */) 00063 : m_fd (fd) 00064 {} 00065 00066 IOChannel::~IOChannel (void) 00067 {} 00068 00072 00073 IOFD 00074 IOChannel::fd (void) const 00075 { return m_fd; } 00076 00079 void 00080 IOChannel::fd (IOFD value) 00081 { 00082 // FIXME: close old one? 00083 // FIXME: reset state? 00084 m_fd = value; 00085 } 00086 00090 00092 void 00093 IOChannel::close (void) 00094 { 00095 if (fd () == EDM_IOFD_INVALID) 00096 return; 00097 00098 int error = 0; 00099 if (! sysclose (fd (), &error)) 00100 throwStorageError ("IOChannel::sysclose()", "close()", error); 00101 00102 fd (EDM_IOFD_INVALID); 00103 }