CMS 3D CMS Logo

IOChannel.cc
Go to the documentation of this file.
3 #include <algorithm>
4 #include <cassert>
5 
31 
57 
61 IOChannel::IOChannel (IOFD fd /* = EDM_IOFD_INVALID */)
62  : m_fd (fd)
63 {}
64 
66 {}
67 
71 
72 IOFD
73 IOChannel::fd (void) const
74 { return m_fd; }
75 
78 void
80 {
81  // FIXME: close old one?
82  // FIXME: reset state?
83  m_fd = value;
84 }
85 
89 
91 void
93 {
94  if (fd () == EDM_IOFD_INVALID)
95  return;
96 
97  int error = 0;
98  if (! sysclose (fd (), &error))
99  throwStorageError ("FileCloseError", "Calling IOChannel::close()",
100  "sysclose()", error);
101 
103 }
void throwStorageError(const char *category, const char *context, const char *call, int error)
Definition: Throw.cc:7
virtual void close(void)
Definition: IOChannel.cc:92
bool sysclose(IOFD fd, int *error=0)
IOChannel(IOFD fd=-1)
Definition: IOChannel.cc:61
Definition: value.py:1
virtual ~IOChannel(void)
Definition: IOChannel.cc:65
int IOFD
Definition: IOTypes.h:22
#define EDM_IOFD_INVALID
Definition: IOTypes.h:8
IOFD m_fd
Definition: IOChannel.h:39
virtual IOFD fd(void) const
Definition: IOChannel.cc:73