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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librw11/] [Rw11UnitVirt.ipp] - Blame information for rev 33

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 wfjm
// $Id: Rw11UnitVirt.ipp 680 2015-05-14 13:29:46Z mueller $
2 19 wfjm
//
3 30 wfjm
// Copyright 2013-2015 by Walter F.J. Mueller 
4 19 wfjm
//
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 30 wfjm
// 2015-05-13   680   1.2    Attach(): check for Enabled()
17 27 wfjm
// 2014-11-02   600   1.1.1  add (bool) cast, needed in 4.8.2
18 21 wfjm
// 2013-05-03   515   1.1    use AttachDone(),DetachCleanup(),DetachDone()
19 19 wfjm
// 2013-03-03   494   1.0    Initial version
20
// 2013-02-05   483   0.1    First draft
21
// ---------------------------------------------------------------------------
22
 
23
/*!
24
  \file
25 30 wfjm
  \version $Id: Rw11UnitVirt.ipp 680 2015-05-14 13:29:46Z mueller $
26 19 wfjm
  \brief   Implemenation (inline) of Rw11UnitVirt.
27
*/
28
 
29
#include "boost/thread/locks.hpp"
30
 
31
#include "librtools/RosFill.hpp"
32
 
33
#include "Rw11UnitVirt.hpp"
34
 
35
/*!
36
  \class Retro::Rw11UnitVirt
37
  \brief FIXME_docs
38
*/
39
 
40
// all method definitions in namespace Retro
41
namespace Retro {
42
 
43
//------------------------------------------+-----------------------------------
44
//! Default constructor
45
 
46
template 
47
Rw11UnitVirt::Rw11UnitVirt(Rw11Cntl* pcntl, size_t index)
48
  : Rw11Unit(pcntl, index),
49
    fpVirt()
50
{}
51
 
52
//------------------------------------------+-----------------------------------
53
//! Destructor
54
 
55
template 
56
Rw11UnitVirt::~Rw11UnitVirt()
57
{}
58
 
59
//------------------------------------------+-----------------------------------
60
//! FIXME_docs
61
 
62
template 
63
inline TV* Rw11UnitVirt::Virt() const
64
{
65
  return fpVirt.get();
66
}
67
 
68
//------------------------------------------+-----------------------------------
69
//! FIXME_docs
70
 
71
template 
72
inline bool Rw11UnitVirt::Attach(const std::string& url, RerrMsg& emsg)
73
{
74
  // synchronize with server thread
75
  boost::lock_guard lock(Connect());
76 21 wfjm
  if (fpVirt) Detach();
77 30 wfjm
  if (!Enabled()) {
78
    emsg.Init("Rw11UnitVirt::Attach","unit not enabled");
79
    return false;
80
  }
81 19 wfjm
  fpVirt.reset(TV::New(url, this, emsg));
82 21 wfjm
  if (fpVirt) AttachDone();
83 27 wfjm
  return (bool)fpVirt;
84 19 wfjm
}
85
 
86
//------------------------------------------+-----------------------------------
87
//! FIXME_docs
88
 
89
template 
90
inline void Rw11UnitVirt::Detach()
91
{
92
  // synchronize with server thread
93
  boost::lock_guard lock(Connect());
94 21 wfjm
  if (!fpVirt) return;
95
  DetachCleanup();
96 19 wfjm
  fpVirt.reset();
97 21 wfjm
  DetachDone();
98 19 wfjm
  return;
99
}
100
 
101
//------------------------------------------+-----------------------------------
102
//! FIXME_docs
103
 
104
template 
105
void Rw11UnitVirt::Dump(std::ostream& os, int ind,
106
                               const char* text) const
107
{
108
  RosFill bl(ind);
109
  os << bl << (text?text:"--") << "Rw11UnitVirt @ " << this << std::endl;
110
  if (fpVirt) {
111
    fpVirt->Dump(os, ind+2, "*fpVirt: ");
112
  } else {
113
    os << bl << "  fpVirt:          " << fpVirt.get()   << std::endl;
114
  }
115
 
116
  Rw11Unit::Dump(os, ind, " ^");
117
  return;
118
}
119
 
120
} // end namespace Retro

powered by: WebSVN 2.1.0

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