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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [src/] [librw11/] [Rw11VirtTerm.cpp] - Blame information for rev 40

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 20 wfjm
// $Id: Rw11VirtTerm.cpp 508 2013-04-20 18:43:28Z mueller $
2 19 wfjm
//
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-06   495   1.0    Initial version
17
// 2013-02-13   488   0.1    First draft
18
// ---------------------------------------------------------------------------
19
 
20
/*!
21
  \file
22 20 wfjm
  \version $Id: Rw11VirtTerm.cpp 508 2013-04-20 18:43:28Z mueller $
23 19 wfjm
  \brief   Implemenation of Rw11VirtTerm.
24
*/
25
#include <memory>
26
 
27
#include "librtools/RparseUrl.hpp"
28
#include "librtools/RosFill.hpp"
29
#include "Rw11VirtTermPty.hpp"
30
#include "Rw11VirtTermTcp.hpp"
31
 
32
#include "Rw11VirtTerm.hpp"
33
 
34
using namespace std;
35
 
36
/*!
37
  \class Retro::Rw11VirtTerm
38
  \brief FIXME_docs
39
*/
40
 
41
// all method definitions in namespace Retro
42
namespace Retro {
43
 
44
//------------------------------------------+-----------------------------------
45
//! Default constructor
46
 
47
Rw11VirtTerm::Rw11VirtTerm(Rw11Unit* punit)
48
  : Rw11Virt(punit),
49
    fChannelId(),
50
    fRcvCb()
51
{
52 20 wfjm
  fStats.Define(kStatNVTRcvPoll,     "NVTRcvPoll", "VT RcvPollHandler() calls");
53
  fStats.Define(kStatNVTSnd,         "NVTSnd",       "VT Snd() calls");
54
  fStats.Define(kStatNVTRcvByt,      "NVTRcvByt",    "VT bytes received");
55
  fStats.Define(kStatNVTSndByt,      "NVTSndByt",    "VT bytes send");
56 19 wfjm
}
57
 
58
//------------------------------------------+-----------------------------------
59
//! Destructor
60
 
61
Rw11VirtTerm::~Rw11VirtTerm()
62
{}
63
 
64
//------------------------------------------+-----------------------------------
65
//! FIXME_docs
66
 
67
Rw11VirtTerm* Rw11VirtTerm::New(const std::string& url, Rw11Unit* punit,
68
                                RerrMsg& emsg)
69
{
70
  string scheme = RparseUrl::FindScheme(url, "tcp");
71
  unique_ptr<Rw11VirtTerm> p;
72
 
73
  if        (scheme == "pty") {             // scheme -> pty:
74
    p.reset(new Rw11VirtTermPty(punit));
75
    if (p->Open(url, emsg)) return p.release();
76
 
77
  } else if (scheme == "tcp") {             // scheme -> tcp:
78
    p.reset(new Rw11VirtTermTcp(punit));
79
    if (p->Open(url, emsg)) return p.release();
80
 
81
  } else {                                  // scheme -> no match
82
    emsg.Init("Rw11VirtTerm::New", string("Scheme '") + scheme +
83
              "' is not supported");
84
 
85
  }
86
  return 0;
87
}
88
 
89
//------------------------------------------+-----------------------------------
90
//! FIXME_docs
91
 
92
void Rw11VirtTerm::Dump(std::ostream& os, int ind, const char* text) const
93
{
94
  RosFill bl(ind);
95
  os << bl << (text?text:"--") << "Rw11VirtTerm @ " << this << endl;
96
 
97
  os << bl << "  fChannelId:      " << fChannelId << endl;
98
  Rw11Virt::Dump(os, ind, " ^");
99
  return;
100
}
101
 
102
} // end namespace Retro

powered by: WebSVN 2.1.0

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