2016-07-10 12:54:39 +00:00
|
|
|
//
|
|
|
|
// Disk.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 10/07/2016.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2016 Thomas Harte. All rights reserved.
|
2016-07-10 12:54:39 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Disk_hpp
|
|
|
|
#define Disk_hpp
|
|
|
|
|
2016-11-26 06:27:06 +00:00
|
|
|
#include <map>
|
2016-12-30 03:15:58 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <mutex>
|
2016-12-25 03:11:31 +00:00
|
|
|
#include <set>
|
2016-12-30 03:15:58 +00:00
|
|
|
|
2016-07-10 12:54:39 +00:00
|
|
|
#include "../Storage.hpp"
|
2017-09-23 02:39:23 +00:00
|
|
|
#include "Track/Track.hpp"
|
2016-12-30 03:15:58 +00:00
|
|
|
#include "../../Concurrency/AsyncTaskQueue.hpp"
|
2016-07-10 12:54:39 +00:00
|
|
|
|
|
|
|
namespace Storage {
|
2016-08-27 21:15:09 +00:00
|
|
|
namespace Disk {
|
2016-07-10 12:54:39 +00:00
|
|
|
|
2019-08-22 03:22:58 +00:00
|
|
|
/*!
|
|
|
|
Models a flopy disk.
|
|
|
|
*/
|
2016-07-10 12:54:39 +00:00
|
|
|
class Disk {
|
|
|
|
public:
|
2017-10-07 23:14:18 +00:00
|
|
|
virtual ~Disk() {}
|
2016-07-10 12:54:39 +00:00
|
|
|
|
|
|
|
/*!
|
2016-11-26 15:35:11 +00:00
|
|
|
@returns the number of discrete positions that this disk uses to model its complete surface area.
|
2016-07-10 12:54:39 +00:00
|
|
|
|
|
|
|
This is not necessarily a track count. There is no implicit guarantee that every position will
|
2018-05-13 19:34:31 +00:00
|
|
|
return a distinct track, or, e.g. if the media is holeless, will return any track at all.
|
2016-07-10 12:54:39 +00:00
|
|
|
*/
|
2018-05-07 03:17:36 +00:00
|
|
|
virtual HeadPosition get_maximum_head_position() = 0;
|
2016-07-10 12:54:39 +00:00
|
|
|
|
2016-09-18 23:21:02 +00:00
|
|
|
/*!
|
2016-11-26 15:35:11 +00:00
|
|
|
@returns the number of heads (and, therefore, impliedly surfaces) available on this disk.
|
2016-09-18 23:21:02 +00:00
|
|
|
*/
|
2017-10-07 01:45:12 +00:00
|
|
|
virtual int get_head_count() = 0;
|
2016-09-18 23:21:02 +00:00
|
|
|
|
2016-07-10 12:54:39 +00:00
|
|
|
/*!
|
2016-11-26 15:35:11 +00:00
|
|
|
@returns the @c Track at @c position underneath @c head if there are any detectable events there;
|
|
|
|
returns @c nullptr otherwise.
|
2016-07-10 12:54:39 +00:00
|
|
|
*/
|
2017-10-07 01:45:12 +00:00
|
|
|
virtual std::shared_ptr<Track> get_track_at_position(Track::Address address) = 0;
|
2016-11-26 06:27:06 +00:00
|
|
|
|
2016-12-25 03:11:31 +00:00
|
|
|
/*!
|
|
|
|
Replaces the Track at position @c position underneath @c head with @c track. Ignored if this disk is read-only.
|
|
|
|
*/
|
2017-10-07 01:45:12 +00:00
|
|
|
virtual void set_track_at_position(Track::Address address, const std::shared_ptr<Track> &track) = 0;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Provides a hint that no further tracks are likely to be written for a while.
|
|
|
|
*/
|
|
|
|
virtual void flush_tracks() = 0;
|
2016-12-25 03:11:31 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
@returns whether the disk image is read only. Defaults to @c true if not overridden.
|
|
|
|
*/
|
2017-09-23 00:28:11 +00:00
|
|
|
virtual bool get_is_read_only() = 0;
|
2020-07-18 02:09:21 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
@returns @c true if the tracks at the two addresses are different. @c false if they are the same track.
|
|
|
|
This can avoid some degree of work when disk images offer sub-head-position precision.
|
|
|
|
*/
|
|
|
|
virtual bool tracks_differ(Track::Address, Track::Address) = 0;
|
2016-07-10 12:54:39 +00:00
|
|
|
};
|
|
|
|
|
2016-08-27 21:15:09 +00:00
|
|
|
}
|
2016-07-10 12:54:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Disk_hpp */
|