OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [tools/] [src/] [librw11/] [Rw11VirtDisk.cpp] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 20 wfjm
// $Id: Rw11VirtDisk.cpp 509 2013-04-21 20:46:20Z mueller $
2
//
3
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16
// 2013-03-03   494   1.0    Initial version
17
// 2013-02-13   488   0.1    First draft
18
// ---------------------------------------------------------------------------
19
 
20
/*!
21
  \file
22
  \version $Id: Rw11VirtDisk.cpp 509 2013-04-21 20:46:20Z mueller $
23
  \brief   Implemenation of Rw11VirtDisk.
24
*/
25
#include <memory>
26
 
27
#include "librtools/RosFill.hpp"
28
#include "librtools/RparseUrl.hpp"
29
#include "Rw11VirtDiskFile.hpp"
30
 
31
#include "Rw11VirtDisk.hpp"
32
 
33
using namespace std;
34
 
35
/*!
36
  \class Retro::Rw11VirtDisk
37
  \brief FIXME_docs
38
*/
39
 
40
// all method definitions in namespace Retro
41
namespace Retro {
42
 
43
//------------------------------------------+-----------------------------------
44
//! Default constructor
45
 
46
Rw11VirtDisk::Rw11VirtDisk(Rw11Unit* punit)
47
  : Rw11Virt(punit),
48
    fBlkSize(0),
49
    fNBlock(0)
50
{
51
  fStats.Define(kStatNVDRead,    "NVDRead",     "Read() calls");
52
  fStats.Define(kStatNVDReadBlk, "NVDReadBlk",  "blocks read");
53
  fStats.Define(kStatNVDWrite,   "NVDWrite",    "Write() calls");
54
  fStats.Define(kStatNVDWriteBlk,"NVDWriteBlk", "blocks written");
55
}
56
 
57
//------------------------------------------+-----------------------------------
58
//! Destructor
59
 
60
Rw11VirtDisk::~Rw11VirtDisk()
61
{}
62
 
63
//------------------------------------------+-----------------------------------
64
//! FIXME_docs
65
 
66
Rw11VirtDisk* Rw11VirtDisk::New(const std::string& url, Rw11Unit* punit,
67
                                RerrMsg& emsg)
68
{
69
  string scheme = RparseUrl::FindScheme(url, "file");
70
  unique_ptr<Rw11VirtDisk> p;
71
 
72
  if (scheme == "file") {                   // scheme -> file:
73
    p.reset(new Rw11VirtDiskFile(punit));
74
    if (p->Open(url, emsg)) return p.release();
75
 
76
  } else {                                  // scheme -> no match
77
    emsg.Init("Rw11VirtDisk::New", string("Scheme '") + scheme +
78
              "' is not supported");
79
  }
80
 
81
  return 0;
82
}
83
 
84
//------------------------------------------+-----------------------------------
85
//! FIXME_docs
86
 
87
void Rw11VirtDisk::Dump(std::ostream& os, int ind, const char* text) const
88
{
89
  RosFill bl(ind);
90
  os << bl << (text?text:"--") << "Rw11VirtDisk @ " << this << endl;
91
 
92
  os << bl << "  fBlkSize:        " << fBlkSize << endl;
93
  os << bl << "  fNBlock:         " << fNBlock << endl;
94
  Rw11Virt::Dump(os, ind, " ^");
95
  return;
96
}
97
 
98
 
99
} // end namespace Retro

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.