From a9265107d97c24a0d2b0b0210adc931326433478 Mon Sep 17 00:00:00 2001 From: ChUrl Date: Thu, 8 Dec 2022 21:49:03 +0100 Subject: [PATCH] Cleanup SerialOut --- src/device/port/SerialOut.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/device/port/SerialOut.h b/src/device/port/SerialOut.h index c7eeb0c..ca2e04a 100644 --- a/src/device/port/SerialOut.h +++ b/src/device/port/SerialOut.h @@ -4,23 +4,19 @@ #include "IOport.h" #include "lib/string/String.h" #include "lib/string/StringView.h" +#include "lib/util/RestrictedConstructors.h" // NOTE: I took this code from https://wiki.osdev.org/Serial_Ports namespace Device { class SerialOut { -private: - static const IOport com1; - - static int serial_received(); - - static int is_transmit_empty(); - public: SerialOut(); - SerialOut(const SerialOut ©) = delete; + MakeUncopyable(SerialOut) + + MakeUnmovable(SerialOut) // Can't make singleton because atexit @@ -29,6 +25,13 @@ public: static void write(char a); static void write(String::string_view a); + +private: + static const IOport com1; + + static int serial_received(); + + static int is_transmit_empty(); }; }