URL
https://opencores.org/ocsvn/w11/w11/trunk
Subversion Repositories w11
[/] [w11/] [tags/] [w11a_V0.6/] [tools/] [src/] [librw11/] [Rw11UnitVirt.ipp] - Rev 24
Compare with Previous | Blame | View Log
// $Id: Rw11UnitVirt.ipp 515 2013-05-04 17:28:59Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 2, or at your option any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for complete details.
//
// Revision History:
// Date Rev Version Comment
// 2013-05-03 515 1.1 use AttachDone(),DetachCleanup(),DetachDone()
// 2013-03-03 494 1.0 Initial version
// 2013-02-05 483 0.1 First draft
// ---------------------------------------------------------------------------
/*!
\file
\version $Id: Rw11UnitVirt.ipp 515 2013-05-04 17:28:59Z mueller $
\brief Implemenation (inline) of Rw11UnitVirt.
*/
#include "boost/thread/locks.hpp"
#include "librtools/RosFill.hpp"
#include "Rw11UnitVirt.hpp"
/*!
\class Retro::Rw11UnitVirt
\brief FIXME_docs
*/
// all method definitions in namespace Retro
namespace Retro {
//------------------------------------------+-----------------------------------
//! Default constructor
template <class TV>
Rw11UnitVirt<TV>::Rw11UnitVirt(Rw11Cntl* pcntl, size_t index)
: Rw11Unit(pcntl, index),
fpVirt()
{}
//------------------------------------------+-----------------------------------
//! Destructor
template <class TV>
Rw11UnitVirt<TV>::~Rw11UnitVirt()
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <class TV>
inline TV* Rw11UnitVirt<TV>::Virt() const
{
return fpVirt.get();
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <class TV>
inline bool Rw11UnitVirt<TV>::Attach(const std::string& url, RerrMsg& emsg)
{
// synchronize with server thread
boost::lock_guard<RlinkConnect> lock(Connect());
if (fpVirt) Detach();
fpVirt.reset(TV::New(url, this, emsg));
if (fpVirt) AttachDone();
return fpVirt;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <class TV>
inline void Rw11UnitVirt<TV>::Detach()
{
// synchronize with server thread
boost::lock_guard<RlinkConnect> lock(Connect());
if (!fpVirt) return;
DetachCleanup();
fpVirt.reset();
DetachDone();
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <class TV>
void Rw11UnitVirt<TV>::Dump(std::ostream& os, int ind,
const char* text) const
{
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11UnitVirt @ " << this << std::endl;
if (fpVirt) {
fpVirt->Dump(os, ind+2, "*fpVirt: ");
} else {
os << bl << " fpVirt: " << fpVirt.get() << std::endl;
}
Rw11Unit::Dump(os, ind, " ^");
return;
}
} // end namespace Retro