Lely core libraries 2.3.4
io.hpp
Go to the documentation of this file.
1
24#ifndef LELY_IO2_SYS_IO_HPP_
25#define LELY_IO2_SYS_IO_HPP_
26
27#include <lely/io2/sys/io.h>
28#include <lely/util/error.hpp>
29
30namespace lely {
31namespace io {
32
34class IoGuard {
35 public:
36 IoGuard() {
37 if (io_init() == -1) util::throw_errc("IoGuard");
38 }
39
40 IoGuard(const IoGuard&) = delete;
41 IoGuard& operator=(const IoGuard&) = delete;
42
43 ~IoGuard() noexcept { io_fini(); }
44};
45
46} // namespace io
47} // namespace lely
48
49#endif // !LELY_IO2_SYS_IO_HPP_
A RAII-style wrapper around io_init() and io_fini().
Definition: io.hpp:34
This header file is part of the utilities library; it contains C++ convenience functions for creating...
This header file is part of the I/O library; it contains system-dependent I/O initialization/finaliza...
int io_init(void)
Initializes the I/O library and makes the I/O functions available for use.
Definition: io.c:31
void io_fini(void)
Finalizes the I/O library and terminates the availability of the I/O functions.
Definition: io.c:38