added to aas3
This commit is contained in:
parent
527d2e7346
commit
9ac28aa798
48 changed files with 7134 additions and 0 deletions
23
ass3/simulator_SIC_XE/include/file_device.h
Normal file
23
ass3/simulator_SIC_XE/include/file_device.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef FILE_DEVICE_H
|
||||
#define FILE_DEVICE_H
|
||||
|
||||
#include "device.h"
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
class FileDevice : public Device {
|
||||
public:
|
||||
explicit FileDevice(const std::string &filename);
|
||||
~FileDevice();
|
||||
unsigned char read() override;
|
||||
void write(unsigned char value) override;
|
||||
|
||||
private:
|
||||
void ensureFileOpen();
|
||||
std::fstream fileStream;
|
||||
std::string filename;
|
||||
bool fileCreated;
|
||||
std::streampos readPosition;
|
||||
};
|
||||
|
||||
#endif // FILE_DEVICE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue