w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Rw11VirtTapeTap.hpp
Go to the documentation of this file.
1// $Id: Rw11VirtTapeTap.hpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2015-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-07-08 1180 1.1 use RfileFd; remove dtor
8// 2017-04-07 868 1.0.1 Dump(): add detail arg
9// 2015-06-04 686 1.0 Initial version
10// 2015-05-17 683 0.1 First draft
11// ---------------------------------------------------------------------------
12
13
18#ifndef included_Retro_Rw11VirtTapeTap
19#define included_Retro_Rw11VirtTapeTap 1
20
21#include "librtools/RfileFd.hpp"
22
23#include "Rw11VirtTape.hpp"
24
25namespace Retro {
26
28 public:
29
30 explicit Rw11VirtTapeTap(Rw11Unit* punit);
31
32 virtual bool Open(const std::string& url, RerrMsg& emsg);
33
34 virtual bool ReadRecord(size_t nbyt, uint8_t* data, size_t& ndone,
35 int& opcode, RerrMsg& emsg);
36 virtual bool WriteRecord(size_t nbyt, const uint8_t* data,
37 int& opcode, RerrMsg& emsg);
38 virtual bool WriteEof(RerrMsg& emsg);
39 virtual bool SpaceForw(size_t nrec, size_t& ndone,
40 int& opcode, RerrMsg& emsg);
41 virtual bool SpaceBack(size_t nrec, size_t& ndone,
42 int& opcode, RerrMsg& emsg);
43 virtual bool Rewind(int& opcode, RerrMsg& emsg);
44
45 virtual void Dump(std::ostream& os, int ind=0, const char* text=0,
46 int detail=0) const;
47
48 // some constants (also defined in cpp)
49 static const uint32_t kMetaEof = 0x00000000;
50 static const uint32_t kMetaEom = 0xffffffff;
51 static const uint32_t kMeta_M_Perr = 0x80000000;
52 static const uint32_t kMeta_M_Mbz = 0x7fff0000;
53 static const uint32_t kMeta_B_Rlen = 0x0000ffff;
54
55 protected:
56 bool Seek(size_t seekpos, int dir, RerrMsg& emsg);
57 bool Read(size_t nbyt, uint8_t* data, RerrMsg& emsg);
58 bool Write(size_t nbyt, const uint8_t* data, bool back,
59 RerrMsg& emsg);
60 bool CheckSizeForw(size_t nbyt, const char* text, RerrMsg& emsg);
61 bool CheckSizeBack(size_t nbyt, const char* text, RerrMsg& emsg);
62 void UpdatePos(size_t nbyt, int dir);
63 bool ParseMeta(uint32_t meta, size_t& rlen, bool& perr,
64 RerrMsg& emsg);
65 size_t BytePadding(size_t rlen);
66 bool SetBad();
67 bool BadTapeMsg(const char* meth, RerrMsg& emsg);
68 void IncPosRecord(int delta);
69
70 protected:
72 size_t fSize;
73 size_t fPos;
74 bool fBad;
75 bool fPadOdd;
77 };
78
79} // end namespace Retro
80
81#include "Rw11VirtTapeTap.ipp"
82
83#endif
FIXME_docs.
Definition: RerrMsg.hpp:25
FIXME_docs.
Definition: RfileFd.hpp:30
FIXME_docs.
Definition: Rw11Unit.hpp:39
virtual bool Open(const std::string &url, RerrMsg &emsg)
FIXME_docs.
static const uint32_t kMeta_M_Perr
virtual bool SpaceForw(size_t nrec, size_t &ndone, int &opcode, RerrMsg &emsg)
FIXME_docs.
static const uint32_t kMetaEom
EOM marker.
size_t fPos
file position
bool Write(size_t nbyt, const uint8_t *data, bool back, RerrMsg &emsg)
FIXME_docs.
static const uint32_t kMeta_B_Rlen
bool CheckSizeForw(size_t nbyt, const char *text, RerrMsg &emsg)
FIXME_docs.
static const uint32_t kMetaEof
EOF marker.
virtual bool WriteRecord(size_t nbyt, const uint8_t *data, int &opcode, RerrMsg &emsg)
FIXME_docs.
virtual bool Rewind(int &opcode, RerrMsg &emsg)
FIXME_docs.
bool CheckSizeBack(size_t nbyt, const char *text, RerrMsg &emsg)
FIXME_docs.
bool BadTapeMsg(const char *meth, RerrMsg &emsg)
FIXME_docs.
bool Seek(size_t seekpos, int dir, RerrMsg &emsg)
FIXME_docs.
virtual bool WriteEof(RerrMsg &emsg)
FIXME_docs.
bool Read(size_t nbyt, uint8_t *data, RerrMsg &emsg)
FIXME_docs.
bool ParseMeta(uint32_t meta, size_t &rlen, bool &perr, RerrMsg &emsg)
FIXME_docs.
bool fBad
BAD file format flag.
bool SetBad()
FIXME_docs.
static const uint32_t kMeta_M_Mbz
virtual bool ReadRecord(size_t nbyt, uint8_t *data, size_t &ndone, int &opcode, RerrMsg &emsg)
FIXME_docs.
bool fPadOdd
do odd byte padding
bool fTruncPend
truncate on next write
void IncPosRecord(int delta)
FIXME_docs.
virtual bool SpaceBack(size_t nrec, size_t &ndone, int &opcode, RerrMsg &emsg)
FIXME_docs.
void UpdatePos(size_t nbyt, int dir)
FIXME_docs.
RfileFd fFd
file number
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
size_t BytePadding(size_t rlen)
FIXME_docs.
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47