main
Line | |
---|
1 | /* CrO2 datassette emulator
|
---|
2 | * Copyright 2012, Adrien Destugues <pulkomandy@pulkomandy.ath.cx>
|
---|
3 | *
|
---|
4 | * Distributed under the terms of the MIT licence.
|
---|
5 | */
|
---|
6 | #ifndef __TAPE_H__
|
---|
7 | #define __TAPE_H__
|
---|
8 |
|
---|
9 | #include <stdint.h>
|
---|
10 | #include <string>
|
---|
11 | #include <vector>
|
---|
12 |
|
---|
13 | class Tape {
|
---|
14 | public:
|
---|
15 | class Block {
|
---|
16 | public:
|
---|
17 | Block(int length);
|
---|
18 | Block(const Block& other);
|
---|
19 | virtual ~Block();
|
---|
20 | const Block& operator=(const Block& other);
|
---|
21 |
|
---|
22 | virtual bool isFile() const = 0;
|
---|
23 | // Does this block mark the start of a file ?
|
---|
24 | virtual bool isControl() const = 0;
|
---|
25 | // Is this block a control (sync, eof, ...) or data block ?
|
---|
26 | virtual const std::string getName() const = 0;
|
---|
27 |
|
---|
28 | int length;
|
---|
29 | uint8_t* data;
|
---|
30 | private:
|
---|
31 | Block() = delete;
|
---|
32 | };
|
---|
33 |
|
---|
34 | virtual ~Tape();
|
---|
35 |
|
---|
36 | static Tape* load(const char* filename) throw (const char*);
|
---|
37 |
|
---|
38 | int getBlockCount() const;
|
---|
39 | Block& getBlock(int number);
|
---|
40 | const Block& getBlock(int number) const;
|
---|
41 | protected:
|
---|
42 | Tape() {};
|
---|
43 | std::vector<Block*> blocks;
|
---|
44 | };
|
---|
45 |
|
---|
46 | #endif
|
---|
47 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.