// // DiskStrategy // // An abstract class defining the interface that all disk strategies // should implement. class DiskStrategy { public: // Returns the name of the strategy for display purposes. virtual char* getName() = 0; // Returns the process index among those available in !q! that // should be selected next for process by !arm!, according // to the represented strategy. virtual int selectProcess(DiskArm *arm, RequestQueue *q) = 0; }; // defines the First In, First Out strategy class FIFO : public DiskStrategy { public: FIFO(Disk *disk); // Returns the name of the strategy for display purposes char* getName() { return "FIFO"; } // Returns the process index among those available in !q! that // should be selected next for process by !arm!, according to FIFO. int selectProcess(DiskArm *arm, RequestQueue *q); private: // Tracks the process index from which we last made our request. int last_req; };