FINAL CUT
io_monitor.h
1 /***********************************************************************
2 * io_monitor.h - I/O monitoring object *
3 * *
4 * This file is part of the FINAL CUT widget toolkit *
5 * *
6 * Copyright 2023 Andreas Noe *
7 * *
8 * FINAL CUT is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as *
10 * published by the Free Software Foundation; either version 3 of *
11 * the License, or (at your option) any later version. *
12 * *
13 * FINAL CUT is distributed in the hope that it will be useful, but *
14 * WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this program. If not, see *
20 * <http://www.gnu.org/licenses/>. *
21 ***********************************************************************/
22 
23 /* Inheritance diagram
24  * ═══════════════════
25  *
26  * ▕▔▔▔▔▔▔▔▔▔▏
27  * ▕ Monitor ▏
28  * ▕▁▁▁▁▁▁▁▁▁▏
29  * ▲
30  * │
31  * ▕▔▔▔▔▔▔▔▔▔▔▔▏
32  * ▕ IoMonitor ▏
33  * ▕▁▁▁▁▁▁▁▁▁▁▁▏
34  */
35 
36 #ifndef IO_MONITOR_H
37 #define IO_MONITOR_H
38 
39 #include "final/eventloop/monitor.h"
40 #include "final/util/fstring.h"
41 
42 namespace finalcut
43 {
44 
45 //----------------------------------------------------------------------
46 // class IoMonitor
47 //----------------------------------------------------------------------
48 
49 class IoMonitor final : public Monitor
50 {
51  public:
52  // Disable default constructor
53  IoMonitor() = delete;
54 
55  explicit IoMonitor (EventLoop*);
56 
57  // Disable copy constructor
58  IoMonitor(const IoMonitor&) = delete;
59 
60  // Disable move constructor
61  IoMonitor(const IoMonitor&&) = delete;
62 
63  // Destructor
64  ~IoMonitor() noexcept override;
65 
66  // Accessor
67  auto getClassName() const -> FString override;
68 
69  // Method
70  template <typename T>
71  void init (int, short, handler_t, T&&);
72  auto operator = (const IoMonitor&) -> IoMonitor& = delete;
73  auto operator = (const IoMonitor&&) -> IoMonitor& = delete;
74 };
75 
76 // IoMonitor inline functions
77 //----------------------------------------------------------------------
78 inline auto IoMonitor::getClassName() const -> FString
79 { return "IoMonitor"; }
80 
81 //----------------------------------------------------------------------
82 template <typename T>
83 inline void IoMonitor::init ( int file_descriptor, short ev
84  , handler_t hdl, T&& uc )
85 {
86  setFileDescriptor (file_descriptor);
87  setEvents (ev);
88  setHandler (std::move(hdl));
89  setUserContext (std::forward<T>(uc));
90 }
91 
92 } // namespace finalcut
93 
94 #endif // IO_MONITOR_H
Definition: monitor.h:81
Definition: eventloop.h:48
Definition: class_template.cpp:25
Definition: io_monitor.h:49
Definition: fstring.h:79