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