From 7d1023ea98bd9464dd4bd10209bc4d5ef7dda83a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 8 Aug 2017 21:15:56 -0400 Subject: [PATCH] Added a 'ready' getter to `Drive`, formally to let the drive take ownership of that test. --- Storage/Disk/Drive.cpp | 5 +++++ Storage/Disk/Drive.hpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Storage/Disk/Drive.cpp b/Storage/Disk/Drive.cpp index a08398a47..1911d7916 100644 --- a/Storage/Disk/Drive.cpp +++ b/Storage/Disk/Drive.cpp @@ -46,6 +46,11 @@ bool Drive::get_is_read_only() { return false; } +bool Drive::get_is_ready() { + // TODO: a real test for this. + return disk_ != nullptr; +} + std::shared_ptr Drive::get_track() { if(disk_) return disk_->get_track_at_position(head_, (unsigned int)head_position_); if(track_) return track_; diff --git a/Storage/Disk/Drive.hpp b/Storage/Disk/Drive.hpp index 82e34fcd6..c67f5d1b6 100644 --- a/Storage/Disk/Drive.hpp +++ b/Storage/Disk/Drive.hpp @@ -65,6 +65,11 @@ class Drive { */ void set_track(const std::shared_ptr &track); + /*! + @returns @c true if the drive is ready; @c false otherwise. + */ + bool get_is_ready(); + private: std::shared_ptr track_; std::shared_ptr disk_;