simulator work
This commit is contained in:
parent
27b8de1bc2
commit
9cc0c10e35
584 changed files with 29988 additions and 0 deletions
37
ass2/simulator/device.h
Normal file
37
ass2/simulator/device.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef DEVICE_H
|
||||
#define DEVICE_H
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
using namespace std;
|
||||
|
||||
class Device {
|
||||
public:
|
||||
virtual bool test();
|
||||
virtual unsigned char read();
|
||||
virtual void write(unsigned char value);
|
||||
virtual ~Device() = default;
|
||||
};
|
||||
|
||||
class InputDevice : public Device {
|
||||
istream& input;
|
||||
public:
|
||||
InputDevice(istream& in);
|
||||
unsigned char read() override;
|
||||
};
|
||||
|
||||
class OutputDevice : public Device {
|
||||
ostream& output;
|
||||
public:
|
||||
OutputDevice(ostream& out);
|
||||
void write(unsigned char value) override;
|
||||
};
|
||||
|
||||
class FileDevice : public Device {
|
||||
fstream file;
|
||||
public:
|
||||
FileDevice(string& filename);
|
||||
bool test() override;
|
||||
unsigned char read() override;
|
||||
void write(unsigned char value) override;
|
||||
};
|
||||
#endif // DEVICE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue