diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 17a41c20..5470fce5 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -17,15 +17,22 @@ software or firmware builds or that the documentation is consistent. The full set of tests is only run for tagged releases._ ### Summary -- more compact dumps, add Dump(..,detail); trace output with cntl name +- remove double inheritance in RtclRw11Unit* stack + - RtclRw11Unit: drop fpCpu, use added Cpu()=0 instead + - RtclRw11UnitBase: add TUV,TB; add TUV* ObjUV(); inherit from TB + - RtclRw11Unit(Disk|Stream|Tape|Term): define ObjUV();inherit from RtclRw11Unit + - RtclRw11Unit(dev): inherit from RtclRw11UnitBase +- trace output with controller name + - Rw11Cntl*: use controller name as message prefix +- more compact dumps, add Dump(..,detail) - RlinkCommand: add CommandInfo() - RtclCmdBase: add GetArgsDump() - RlinkCommandList: Dump(): add detail arg - Rstats: add NameMaxLength(); Print(): add counter name - Rw11Cntl: use Dump(detail) for PrimClist ect - - Rw11CntlBase,Rw11Rdma*: Dump(): add detail arg - - Rw11Cntl*: Dump(): add detail arg; use cntl name as message prefix -- RtclRw11Cntl: M_dump: use GetArgsDump and Dump detail + - Rw11(Cntl|Unit|Virt)*,: Dump(): add detail arg + - many other classes: Dump(): add detail arg + - RtclRw11(Cntl|Unit|*): M_dump: use GetArgsDump and Dump detail - RtimerFd: first practical version - use clock_gettime instead of gettimeofday - add Rw11VirtDiskOver (simple overlay file container) diff --git a/tools/src/librwxxtpp/RtclRw11Unit.cpp b/tools/src/librwxxtpp/RtclRw11Unit.cpp index 7e917fe6..8cbdf748 100644 --- a/tools/src/librwxxtpp/RtclRw11Unit.cpp +++ b/tools/src/librwxxtpp/RtclRw11Unit.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11Unit.cpp 868 2017-04-07 20:09:33Z mueller $ +// $Id: RtclRw11Unit.cpp 870 2017-04-08 18:24:34Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.2 drop fpCpu, use added Cpu()=0 instead // 2017-04-07 868 1.1.1 M_dump: use GetArgsDump and Dump detail // 2017-04-02 863 1.1 add fpVirt; add DetachCleanup() // 2013-03-03 494 1.0 Initial version @@ -21,7 +22,7 @@ /*! \file - \version $Id: RtclRw11Unit.cpp 868 2017-04-07 20:09:33Z mueller $ + \version $Id: RtclRw11Unit.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11Unit. */ @@ -46,9 +47,8 @@ namespace Retro { //------------------------------------------+----------------------------------- //! Default constructor -RtclRw11Unit::RtclRw11Unit(const std::string& type, Rw11Cpu* pcpu) +RtclRw11Unit::RtclRw11Unit(const std::string& type) : RtclProxyBase(type), - fpCpu(pcpu), fGets(), fSets(), fpVirt() @@ -84,7 +84,7 @@ void RtclRw11Unit::DetachCleanup() int RtclRw11Unit::M_get(RtclArgs& args) { // synchronize with server thread - boost::lock_guard lock(fpCpu->Connect()); + boost::lock_guard lock(Cpu().Connect()); return fGets.M_get(args); } @@ -94,7 +94,7 @@ int RtclRw11Unit::M_get(RtclArgs& args) int RtclRw11Unit::M_set(RtclArgs& args) { // synchronize with server thread - boost::lock_guard lock(fpCpu->Connect()); + boost::lock_guard lock(Cpu().Connect()); return fSets.M_set(args); } @@ -110,7 +110,7 @@ int RtclRw11Unit::M_attach(RtclArgs& args) RerrMsg emsg; // synchronize with server thread - boost::lock_guard lock(fpCpu->Connect()); + boost::lock_guard lock(Cpu().Connect()); DetachCleanup(); if (!Obj().Attach(url, emsg)) return args.Quit(emsg); @@ -126,7 +126,7 @@ int RtclRw11Unit::M_detach(RtclArgs& args) if (!args.AllDone()) return kERR; // synchronize with server thread - boost::lock_guard lock(fpCpu->Connect()); + boost::lock_guard lock(Cpu().Connect()); Obj().Detach(); return kOK; } @@ -140,7 +140,7 @@ int RtclRw11Unit::M_virt(RtclArgs& args) "Bad state: fpVirt == nullptr"); // synchronize with server thread - boost::lock_guard lock(fpCpu->Connect()); + boost::lock_guard lock(Cpu().Connect()); return fpVirt->DispatchCmd(args); } diff --git a/tools/src/librwxxtpp/RtclRw11Unit.hpp b/tools/src/librwxxtpp/RtclRw11Unit.hpp index c31885da..0643da43 100644 --- a/tools/src/librwxxtpp/RtclRw11Unit.hpp +++ b/tools/src/librwxxtpp/RtclRw11Unit.hpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11Unit.hpp 863 2017-04-02 11:43:15Z mueller $ +// $Id: RtclRw11Unit.hpp 870 2017-04-08 18:24:34Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.2 drop fpCpu, use added Cpu()=0 instead // 2017-04-02 863 1.1 add fpVirt,DetachCleanup(),AttachDone(),M_virt() // 2013-03-03 494 1.0 Initial version // 2013-02-16 488 0.1 First draft @@ -21,7 +22,7 @@ /*! \file - \version $Id: RtclRw11Unit.hpp 863 2017-04-02 11:43:15Z mueller $ + \version $Id: RtclRw11Unit.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11Unit. */ @@ -47,12 +48,11 @@ namespace Retro { class RtclRw11Unit : public RtclProxyBase { public: - RtclRw11Unit(const std::string& type, Rw11Cpu* pcpu); + RtclRw11Unit(const std::string& type); virtual ~RtclRw11Unit(); virtual Rw11Unit& Obj() = 0; - RtclGetList& GetList(); - RtclSetList& SetList(); + virtual Rw11Cpu& Cpu() const = 0; protected: virtual void AttachDone() = 0; @@ -66,7 +66,6 @@ namespace Retro { int M_default(RtclArgs& args); protected: - Rw11Cpu* fpCpu; RtclGetList fGets; RtclSetList fSets; boost::scoped_ptr fpVirt; @@ -74,6 +73,6 @@ namespace Retro { } // end namespace Retro -#include "RtclRw11Unit.ipp" +//#include "RtclRw11Unit.ipp" #endif diff --git a/tools/src/librwxxtpp/RtclRw11Unit.ipp b/tools/src/librwxxtpp/RtclRw11Unit.ipp deleted file mode 100644 index d53e80c3..00000000 --- a/tools/src/librwxxtpp/RtclRw11Unit.ipp +++ /dev/null @@ -1,45 +0,0 @@ -// $Id: RtclRw11Unit.ipp 863 2017-04-02 11:43:15Z mueller $ -// -// Copyright 2013- by Walter F.J. Mueller -// -// 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-03-03 494 1.0 Initial version -// 2013-02-22 490 0.1 First draft -// --------------------------------------------------------------------------- - -/*! - \file - \version $Id: RtclRw11Unit.ipp 863 2017-04-02 11:43:15Z mueller $ - \brief Implemenation (inline) of RtclRw11Unit. -*/ - -// all method definitions in namespace Retro -namespace Retro { - -//------------------------------------------+----------------------------------- -//! FIXME_docs - -inline RtclGetList& RtclRw11Unit::GetList() -{ - return fGets; -} - -//------------------------------------------+----------------------------------- -//! FIXME_docs - -inline RtclSetList& RtclRw11Unit::SetList() -{ - return fSets; -} - -} // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitBase.hpp b/tools/src/librwxxtpp/RtclRw11UnitBase.hpp index 06c42315..a414bf26 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitBase.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitBase.hpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11UnitBase.hpp 863 2017-04-02 11:43:15Z mueller $ +// $Id: RtclRw11UnitBase.hpp 870 2017-04-08 18:24:34Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.2 add TUV,TB; add TUV* ObjUV(); inherit from TB // 2017-04-02 863 1.1 add AttachDone() // 2013-03-06 495 1.0 Initial version // 2013-02-16 488 0.1 First draft @@ -21,7 +22,7 @@ /*! \file - \version $Id: RtclRw11UnitBase.hpp 863 2017-04-02 11:43:15Z mueller $ + \version $Id: RtclRw11UnitBase.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitBase. */ @@ -34,22 +35,24 @@ namespace Retro { - template - class RtclRw11UnitBase : public RtclRw11Unit { + template + class RtclRw11UnitBase : public TB { public: RtclRw11UnitBase(const std::string& type, - const boost::shared_ptr& spunit); + const boost::shared_ptr& spunit); ~RtclRw11UnitBase(); - TO& Obj(); - const boost::shared_ptr& ObjSPtr(); + virtual TU& Obj(); + virtual TUV& ObjUV(); + virtual Rw11Cpu& Cpu() const; + const boost::shared_ptr& ObjSPtr(); protected: virtual void AttachDone(); int M_stats(RtclArgs& args); protected: - boost::shared_ptr fspObj; //!< sptr to managed object + boost::shared_ptr fspObj; //!< sptr to managed object }; } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitBase.ipp b/tools/src/librwxxtpp/RtclRw11UnitBase.ipp index 5044ea5d..484622e1 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitBase.ipp +++ b/tools/src/librwxxtpp/RtclRw11UnitBase.ipp @@ -1,4 +1,4 @@ -// $Id: RtclRw11UnitBase.ipp 863 2017-04-02 11:43:15Z mueller $ +// $Id: RtclRw11UnitBase.ipp 870 2017-04-08 18:24:34Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.3 add TUV,TB; add TUV* ObjUV(); inherit from TB // 2017-04-02 863 1.2 add AttachDone() // 2015-05-14 680 1.1 fGets: add enabled (moved from RtclRw11UnitDisk) // 2013-03-06 495 1.0 Initial version @@ -21,7 +22,7 @@ /*! \file - \version $Id: RtclRw11UnitBase.ipp 863 2017-04-02 11:43:15Z mueller $ + \version $Id: RtclRw11UnitBase.ipp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation (all inline) of RtclRw11UnitBase. */ @@ -36,34 +37,55 @@ // all method definitions in namespace Retro namespace Retro { +// Note on coding style: +// all base class members must be qualified with "this->" to ensure proper +// name lookup. Otherwise one gets errors like "no declarations were found +// by argument-dependent lookup at the point of instantiation" +// +// Reason is the according to C++ standart in a first pass all names which +// are not template parameter dependent are resolved. If a name is not found +// one gets above mentioned error. All other names are looked up in a second +// pass. Adding "this->" makes the name template parameter dependent. +// +// Prefixing a "TC::" can also be used, e.g. for constants like TB::kOK. + //------------------------------------------+----------------------------------- //! Constructor -template -inline RtclRw11UnitBase::RtclRw11UnitBase(const std::string& type, - const boost::shared_ptr& spunit) - : RtclRw11Unit(type, &(spunit->Cntl().Cpu())), +template +inline RtclRw11UnitBase::RtclRw11UnitBase(const std::string& type, + const boost::shared_ptr& spunit) + : TB(type), fspObj(spunit) { - AddMeth("stats", boost::bind(&RtclRw11UnitBase::M_stats, this, _1)); - TO* pobj = fspObj.get(); - fGets.Add ("index", boost::bind(&TO::Index, pobj)); - fGets.Add ("name", boost::bind(&TO::Name, pobj)); - fGets.Add ("enabled", boost::bind(&TO::Enabled, pobj)); + this->AddMeth("stats", boost::bind(&RtclRw11UnitBase::M_stats, + this, _1)); + TU* pobj = fspObj.get(); + + // the following construction is neccessary because the base class is a + // template argument. Access to "this->fGets" is done via a local variable + // 'gets' to a local variable. Otherwise processing of the template functions + // Add<...> will cause obscure "expected primary-expression before ‘>’ " + // error messages. Simply too much nested templating... + + RtclGetList& gets = this->fGets; + gets.Add ("index", boost::bind(&TU::Index, pobj)); + gets.Add ("name", boost::bind(&TU::Name, pobj)); + gets.Add ("enabled", boost::bind(&TU::Enabled, pobj)); } //------------------------------------------+----------------------------------- //! FIXME_docs -template -inline RtclRw11UnitBase::~RtclRw11UnitBase() +template +inline RtclRw11UnitBase::~RtclRw11UnitBase() {} //------------------------------------------+----------------------------------- //! FIXME_docs -template -inline TO& RtclRw11UnitBase::Obj() +template +inline TU& RtclRw11UnitBase::Obj() { return *fspObj; } @@ -71,8 +93,26 @@ inline TO& RtclRw11UnitBase::Obj() //------------------------------------------+----------------------------------- //! FIXME_docs -template -inline const boost::shared_ptr& RtclRw11UnitBase::ObjSPtr() +template +inline TUV& RtclRw11UnitBase::ObjUV() +{ + return *fspObj; +} + +//------------------------------------------+----------------------------------- +//! FIXME_docs + +template +inline Rw11Cpu& RtclRw11UnitBase::Cpu() const +{ + return fspObj->Cpu(); +} + +//------------------------------------------+----------------------------------- +//! FIXME_docs + +template +inline const boost::shared_ptr& RtclRw11UnitBase::ObjSPtr() { return fspObj; } @@ -80,30 +120,30 @@ inline const boost::shared_ptr& RtclRw11UnitBase::ObjSPtr() //------------------------------------------+----------------------------------- //! FIXME_docs -template -void RtclRw11UnitBase::AttachDone() +template +void RtclRw11UnitBase::AttachDone() { if (!Obj().Virt()) return; RtclRw11Virt* pvirt=RtclRw11VirtFactory(Obj().Virt()); if (!pvirt) return; - fpVirt.reset(pvirt); - AddMeth("virt", boost::bind(&RtclRw11Unit::M_virt, this, _1)); + this->fpVirt.reset(pvirt); + this->AddMeth("virt", boost::bind(&RtclRw11Unit::M_virt, this, _1)); return; } //------------------------------------------+----------------------------------- //! FIXME_docs -template -int RtclRw11UnitBase::M_stats(RtclArgs& args) +template +int RtclRw11UnitBase::M_stats(RtclArgs& args) { RtclStats::Context cntx; - if (!RtclStats::GetArgs(args, cntx)) return kERR; - if (!RtclStats::Collect(args, cntx, Obj().Stats())) return kERR; + if (!RtclStats::GetArgs(args, cntx)) return TB::kERR; + if (!RtclStats::Collect(args, cntx, Obj().Stats())) return TB::kERR; if (Obj().Virt()) { - if (!RtclStats::Collect(args, cntx, Obj().Virt()->Stats())) return kERR; + if (!RtclStats::Collect(args, cntx, Obj().Virt()->Stats())) return TB::kERR; } - return kOK; + return TB::kOK; } } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitDL11.cpp b/tools/src/librwxxtpp/RtclRw11UnitDL11.cpp index f1e4d5c2..ec0ba767 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitDL11.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitDL11.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitDL11.cpp 504 2013-04-13 15:37:24Z mueller $ +// $Id: RtclRw11UnitDL11.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,13 +13,14 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2013-03-01 493 1.0 Initial version // 2013-02-16 488 0.1 First draft // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitDL11.cpp 504 2013-04-13 15:37:24Z mueller $ + \version $Id: RtclRw11UnitDL11.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitDL11. */ @@ -41,9 +42,10 @@ namespace Retro { RtclRw11UnitDL11::RtclRw11UnitDL11(Tcl_Interp* interp, const std::string& unitcmd, const boost::shared_ptr& spunit) - : RtclRw11UnitBase("Rw11UnitDL11", spunit), - RtclRw11UnitTerm(this, spunit.get()) + : RtclRw11UnitBase("Rw11UnitDL11", spunit) { + SetupGetSet(); CreateObjectCmd(interp, unitcmd.c_str()); } diff --git a/tools/src/librwxxtpp/RtclRw11UnitDL11.hpp b/tools/src/librwxxtpp/RtclRw11UnitDL11.hpp index 549f4cdf..6587a3fe 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitDL11.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitDL11.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitDL11.hpp 504 2013-04-13 15:37:24Z mueller $ +// $Id: RtclRw11UnitDL11.hpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2013-03-01 493 1.0 Initial version // 2013-02-16 488 0.1 First draft // --------------------------------------------------------------------------- @@ -20,7 +21,7 @@ /*! \file - \version $Id: RtclRw11UnitDL11.hpp 504 2013-04-13 15:37:24Z mueller $ + \version $Id: RtclRw11UnitDL11.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitDL11. */ @@ -35,8 +36,8 @@ namespace Retro { -class RtclRw11UnitDL11 : public RtclRw11UnitBase, - public RtclRw11UnitTerm { + class RtclRw11UnitDL11 : public RtclRw11UnitBase { public: RtclRw11UnitDL11(Tcl_Interp* interp, const std::string& unitcmd, diff --git a/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp b/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp index 25aa3dea..aaddb1c9 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitDisk.cpp 863 2017-04-02 11:43:15Z mueller $ +// $Id: RtclRw11UnitDisk.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013-2015 by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 use Rw11UnitDisk& ObjUV(); inherit from RtclRw11Unit // 2015-05-14 680 1.1.1 fGets: remove enabled, now in RtclRw11UnitBase // 2015-03-21 659 1.1 fGets: add enabled // 2013-04-19 507 1.0 Initial version @@ -21,7 +22,7 @@ /*! \file - \version $Id: RtclRw11UnitDisk.cpp 863 2017-04-02 11:43:15Z mueller $ + \version $Id: RtclRw11UnitDisk.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitDisk. */ @@ -40,30 +41,9 @@ namespace Retro { //------------------------------------------+----------------------------------- //! Constructor -RtclRw11UnitDisk::RtclRw11UnitDisk(RtclRw11Unit* ptcl, Rw11UnitDisk* pobj) - : fpTcl(ptcl), - fpObj(pobj) -{ - RtclGetList& gets = ptcl->GetList(); - RtclSetList& sets = ptcl->SetList(); - gets.Add ("type", - boost::bind(&Rw11UnitDisk::Type, pobj)); - gets.Add ("ncylinder", - boost::bind(&Rw11UnitDisk::NCylinder, pobj)); - gets.Add ("nhead", - boost::bind(&Rw11UnitDisk::NHead, pobj)); - gets.Add ("nsector", - boost::bind(&Rw11UnitDisk::NSector, pobj)); - gets.Add ("blocksize", - boost::bind(&Rw11UnitDisk::BlockSize, pobj)); - gets.Add ("nblock", - boost::bind(&Rw11UnitDisk::NBlock, pobj)); - gets.Add ("wprot", - boost::bind(&Rw11UnitDisk::WProt, pobj)); - - sets.Add ("type", - boost::bind(&Rw11UnitDisk::SetType,pobj, _1)); -} +RtclRw11UnitDisk::RtclRw11UnitDisk(const std::string& type) + : RtclRw11Unit(type) +{} //------------------------------------------+----------------------------------- //! FIXME_docs @@ -71,5 +51,35 @@ RtclRw11UnitDisk::RtclRw11UnitDisk(RtclRw11Unit* ptcl, Rw11UnitDisk* pobj) RtclRw11UnitDisk::~RtclRw11UnitDisk() {} +//------------------------------------------+----------------------------------- +//! FIXME_docs + +void RtclRw11UnitDisk::SetupGetSet() +{ + // this can't be in ctor because pure virtual is called which is available + // only when more derived class is being constructed. SetupGetSet() must be + // called in ctor of a more derived class. + + Rw11UnitDisk* pobj = &ObjUV(); + + fGets.Add ("type", + boost::bind(&Rw11UnitDisk::Type, pobj)); + fGets.Add ("ncylinder", + boost::bind(&Rw11UnitDisk::NCylinder, pobj)); + fGets.Add ("nhead", + boost::bind(&Rw11UnitDisk::NHead, pobj)); + fGets.Add ("nsector", + boost::bind(&Rw11UnitDisk::NSector, pobj)); + fGets.Add ("blocksize", + boost::bind(&Rw11UnitDisk::BlockSize, pobj)); + fGets.Add ("nblock", + boost::bind(&Rw11UnitDisk::NBlock, pobj)); + fGets.Add ("wprot", + boost::bind(&Rw11UnitDisk::WProt, pobj)); + + fSets.Add ("type", + boost::bind(&Rw11UnitDisk::SetType,pobj, _1)); + return; +} } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitDisk.hpp b/tools/src/librwxxtpp/RtclRw11UnitDisk.hpp index b2a177af..e17f3297 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitDisk.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitDisk.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitDisk.hpp 863 2017-04-02 11:43:15Z mueller $ +// $Id: RtclRw11UnitDisk.hpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 use Rw11UnitDisk& ObjUV(); inherit from RtclRw11Unit // 2013-04-19 507 1.0 Initial version // 2013-02-22 490 0.1 First draft // --------------------------------------------------------------------------- @@ -20,7 +21,7 @@ /*! \file - \version $Id: RtclRw11UnitDisk.hpp 863 2017-04-02 11:43:15Z mueller $ + \version $Id: RtclRw11UnitDisk.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitDisk. */ @@ -33,16 +34,16 @@ namespace Retro { - class RtclRw11UnitDisk { + class RtclRw11UnitDisk : public RtclRw11Unit { public: - RtclRw11UnitDisk(RtclRw11Unit* ptcl, Rw11UnitDisk* pobj); + RtclRw11UnitDisk(const std::string& type); ~RtclRw11UnitDisk(); - protected: + virtual Rw11UnitDisk& ObjUV() = 0; protected: - RtclRw11Unit* fpTcl; - Rw11UnitDisk* fpObj; + void SetupGetSet(); + }; } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitLP11.cpp b/tools/src/librwxxtpp/RtclRw11UnitLP11.cpp index bffc6b64..30894c5e 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitLP11.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitLP11.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitLP11.cpp 515 2013-05-04 17:28:59Z mueller $ +// $Id: RtclRw11UnitLP11.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,12 +13,13 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2013-05-01 513 1.0 Initial version // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitLP11.cpp 515 2013-05-04 17:28:59Z mueller $ + \version $Id: RtclRw11UnitLP11.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitLP11. */ @@ -40,9 +41,10 @@ namespace Retro { RtclRw11UnitLP11::RtclRw11UnitLP11(Tcl_Interp* interp, const std::string& unitcmd, const boost::shared_ptr& spunit) - : RtclRw11UnitBase("Rw11UnitLP11", spunit), - RtclRw11UnitStream(this, spunit.get()) + : RtclRw11UnitBase("Rw11UnitLP11", spunit) { + SetupGetSet(); CreateObjectCmd(interp, unitcmd.c_str()); } diff --git a/tools/src/librwxxtpp/RtclRw11UnitLP11.hpp b/tools/src/librwxxtpp/RtclRw11UnitLP11.hpp index b8e16fed..811ff385 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitLP11.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitLP11.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitLP11.hpp 515 2013-05-04 17:28:59Z mueller $ +// $Id: RtclRw11UnitLP11.hpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,13 +13,14 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2013-05-01 513 1.0 Initial version // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitLP11.hpp 515 2013-05-04 17:28:59Z mueller $ + \version $Id: RtclRw11UnitLP11.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitLP11. */ @@ -34,8 +35,8 @@ namespace Retro { -class RtclRw11UnitLP11 : public RtclRw11UnitBase, - public RtclRw11UnitStream { +class RtclRw11UnitLP11 : public RtclRw11UnitBase { public: RtclRw11UnitLP11(Tcl_Interp* interp, const std::string& unitcmd, diff --git a/tools/src/librwxxtpp/RtclRw11UnitPC11.cpp b/tools/src/librwxxtpp/RtclRw11UnitPC11.cpp index 9f69cf7b..70192739 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitPC11.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitPC11.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitPC11.cpp 584 2014-08-22 19:38:12Z mueller $ +// $Id: RtclRw11UnitPC11.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013-2014 by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,13 +13,14 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2014-08-22 584 1.0.1 use nullptr // 2013-05-03 515 1.0 Initial version // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitPC11.cpp 584 2014-08-22 19:38:12Z mueller $ + \version $Id: RtclRw11UnitPC11.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitPC11. */ @@ -41,10 +42,11 @@ namespace Retro { RtclRw11UnitPC11::RtclRw11UnitPC11(Tcl_Interp* interp, const std::string& unitcmd, const boost::shared_ptr& spunit) - : RtclRw11UnitBase("Rw11UnitPC11", spunit), - RtclRw11UnitStream(this, spunit.get()) + : RtclRw11UnitBase("Rw11UnitPC11", spunit) { // create default unit command + SetupGetSet(); CreateObjectCmd(interp, unitcmd.c_str()); // for 1st PC11, create also alias diff --git a/tools/src/librwxxtpp/RtclRw11UnitPC11.hpp b/tools/src/librwxxtpp/RtclRw11UnitPC11.hpp index fcccd5a6..9ae7269c 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitPC11.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitPC11.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitPC11.hpp 515 2013-05-04 17:28:59Z mueller $ +// $Id: RtclRw11UnitPC11.hpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,13 +13,14 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2013-05-03 515 1.0 Initial version // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitPC11.hpp 515 2013-05-04 17:28:59Z mueller $ + \version $Id: RtclRw11UnitPC11.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitPC11. */ @@ -34,8 +35,8 @@ namespace Retro { -class RtclRw11UnitPC11 : public RtclRw11UnitBase, - public RtclRw11UnitStream { +class RtclRw11UnitPC11 : public RtclRw11UnitBase { public: RtclRw11UnitPC11(Tcl_Interp* interp, const std::string& unitcmd, diff --git a/tools/src/librwxxtpp/RtclRw11UnitRHRP.cpp b/tools/src/librwxxtpp/RtclRw11UnitRHRP.cpp index 625458ca..eb6cd5b2 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitRHRP.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitRHRP.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitRHRP.cpp 680 2015-05-14 13:29:46Z mueller $ +// $Id: RtclRw11UnitRHRP.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2015- by Walter F.J. Mueller +// Copyright 2015-2017 by Walter F.J. Mueller // // 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 @@ -13,13 +13,14 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2015-05-14 680 1.0 Initial version // 2015-03-21 659 0.1 First draft // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitRHRP.cpp 680 2015-05-14 13:29:46Z mueller $ + \version $Id: RtclRw11UnitRHRP.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitRHRP. */ @@ -41,9 +42,10 @@ namespace Retro { RtclRw11UnitRHRP::RtclRw11UnitRHRP( Tcl_Interp* interp, const std::string& unitcmd, const boost::shared_ptr& spunit) - : RtclRw11UnitBase("Rw11UnitRHRP", spunit), - RtclRw11UnitDisk(this, spunit.get()) + : RtclRw11UnitBase("Rw11UnitRHRP", spunit) { + SetupGetSet(); CreateObjectCmd(interp, unitcmd.c_str()); } diff --git a/tools/src/librwxxtpp/RtclRw11UnitRHRP.hpp b/tools/src/librwxxtpp/RtclRw11UnitRHRP.hpp index 65e93ffd..7a9e3763 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitRHRP.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitRHRP.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitRHRP.hpp 680 2015-05-14 13:29:46Z mueller $ +// $Id: RtclRw11UnitRHRP.hpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2015- by Walter F.J. Mueller +// Copyright 2015-2017 by Walter F.J. Mueller // // 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 @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2015-05-14 680 1.0 Initial version // 2015-03-21 659 0.1 First draft // --------------------------------------------------------------------------- @@ -20,7 +21,7 @@ /*! \file - \version $Id: RtclRw11UnitRHRP.hpp 680 2015-05-14 13:29:46Z mueller $ + \version $Id: RtclRw11UnitRHRP.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitRHRP. */ @@ -35,8 +36,8 @@ namespace Retro { - class RtclRw11UnitRHRP : public RtclRw11UnitBase, - public RtclRw11UnitDisk { + class RtclRw11UnitRHRP : public RtclRw11UnitBase { public: RtclRw11UnitRHRP(Tcl_Interp* interp, const std::string& unitcmd, diff --git a/tools/src/librwxxtpp/RtclRw11UnitRK11.cpp b/tools/src/librwxxtpp/RtclRw11UnitRK11.cpp index 903e2a7b..37f8cbe9 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitRK11.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitRK11.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitRK11.cpp 509 2013-04-21 20:46:20Z mueller $ +// $Id: RtclRw11UnitRK11.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,13 +13,14 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2013-02-22 490 1.0 Initial version // 2013-02-16 488 0.1 First draft // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitRK11.cpp 509 2013-04-21 20:46:20Z mueller $ + \version $Id: RtclRw11UnitRK11.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitRK11. */ @@ -41,9 +42,10 @@ namespace Retro { RtclRw11UnitRK11::RtclRw11UnitRK11( Tcl_Interp* interp, const std::string& unitcmd, const boost::shared_ptr& spunit) - : RtclRw11UnitBase("Rw11UnitRK11", spunit), - RtclRw11UnitDisk(this, spunit.get()) + : RtclRw11UnitBase("Rw11UnitRK11", spunit) { + SetupGetSet(); CreateObjectCmd(interp, unitcmd.c_str()); } diff --git a/tools/src/librwxxtpp/RtclRw11UnitRK11.hpp b/tools/src/librwxxtpp/RtclRw11UnitRK11.hpp index 919deefa..3d4909ef 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitRK11.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitRK11.hpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11UnitRK11.hpp 509 2013-04-21 20:46:20Z mueller $ +// $Id: RtclRw11UnitRK11.hpp 870 2017-04-08 18:24:34Z mueller $ // // Copyright 2013- by Walter F.J. Mueller // @@ -20,7 +20,7 @@ /*! \file - \version $Id: RtclRw11UnitRK11.hpp 509 2013-04-21 20:46:20Z mueller $ + \version $Id: RtclRw11UnitRK11.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitRK11. */ @@ -35,8 +35,8 @@ namespace Retro { - class RtclRw11UnitRK11 : public RtclRw11UnitBase, - public RtclRw11UnitDisk { + class RtclRw11UnitRK11 : public RtclRw11UnitBase { public: RtclRw11UnitRK11(Tcl_Interp* interp, const std::string& unitcmd, diff --git a/tools/src/librwxxtpp/RtclRw11UnitRL11.cpp b/tools/src/librwxxtpp/RtclRw11UnitRL11.cpp index 1e940964..19db271f 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitRL11.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitRL11.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitRL11.cpp 561 2014-06-09 17:22:50Z mueller $ +// $Id: RtclRw11UnitRL11.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2014- by Walter F.J. Mueller +// Copyright 2014-2017 by Walter F.J. Mueller // // 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 @@ -13,12 +13,13 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2014-06-08 561 1.0 Initial version // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitRL11.cpp 561 2014-06-09 17:22:50Z mueller $ + \version $Id: RtclRw11UnitRL11.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitRL11. */ @@ -40,9 +41,10 @@ namespace Retro { RtclRw11UnitRL11::RtclRw11UnitRL11( Tcl_Interp* interp, const std::string& unitcmd, const boost::shared_ptr& spunit) - : RtclRw11UnitBase("Rw11UnitRL11", spunit), - RtclRw11UnitDisk(this, spunit.get()) + : RtclRw11UnitBase("Rw11UnitRL11", spunit) { + SetupGetSet(); CreateObjectCmd(interp, unitcmd.c_str()); } diff --git a/tools/src/librwxxtpp/RtclRw11UnitRL11.hpp b/tools/src/librwxxtpp/RtclRw11UnitRL11.hpp index 57c7cc8f..a9096d50 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitRL11.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitRL11.hpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11UnitRL11.hpp 647 2015-02-17 22:35:36Z mueller $ +// $Id: RtclRw11UnitRL11.hpp 870 2017-04-08 18:24:34Z mueller $ // // Copyright 2014- by Walter F.J. Mueller // @@ -19,7 +19,7 @@ /*! \file - \version $Id: RtclRw11UnitRL11.hpp 647 2015-02-17 22:35:36Z mueller $ + \version $Id: RtclRw11UnitRL11.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitRL11. */ @@ -34,8 +34,8 @@ namespace Retro { - class RtclRw11UnitRL11 : public RtclRw11UnitBase, - public RtclRw11UnitDisk { + class RtclRw11UnitRL11 : public RtclRw11UnitBase { public: RtclRw11UnitRL11(Tcl_Interp* interp, const std::string& unitcmd, diff --git a/tools/src/librwxxtpp/RtclRw11UnitStream.cpp b/tools/src/librwxxtpp/RtclRw11UnitStream.cpp index 3da8e39f..987cd9b4 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitStream.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitStream.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitStream.cpp 515 2013-05-04 17:28:59Z mueller $ +// $Id: RtclRw11UnitStream.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,12 +13,13 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 use Rw11UnitStream& ObjUV(); inh from RtclRw11Unit // 2013-05-01 513 1.0 Initial version // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitStream.cpp 515 2013-05-04 17:28:59Z mueller $ + \version $Id: RtclRw11UnitStream.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitStream. */ @@ -37,18 +38,9 @@ namespace Retro { //------------------------------------------+----------------------------------- //! Constructor -RtclRw11UnitStream::RtclRw11UnitStream(RtclRw11Unit* ptcl, Rw11UnitStream* pobj) - : fpTcl(ptcl), - fpObj(pobj) -{ - RtclGetList& gets = ptcl->GetList(); - RtclSetList& sets = ptcl->SetList(); - gets.Add ("pos", - boost::bind(&Rw11UnitStream::Pos, pobj)); - - sets.Add ("pos", - boost::bind(&Rw11UnitStream::SetPos,pobj, _1)); -} +RtclRw11UnitStream::RtclRw11UnitStream(const std::string& type) + : RtclRw11Unit(type) +{} //------------------------------------------+----------------------------------- //! FIXME_docs @@ -57,4 +49,22 @@ RtclRw11UnitStream::~RtclRw11UnitStream() {} +//------------------------------------------+----------------------------------- +//! FIXME_docs + +void RtclRw11UnitStream::SetupGetSet() +{ + // this can't be in ctor because pure virtual is called which is available + // only when more derived class is being constructed. SetupGetSet() must be + // called in ctor of a more derived class. + + Rw11UnitStream* pobj = &ObjUV(); + + fGets.Add ("pos", + boost::bind(&Rw11UnitStream::Pos, pobj)); + + fSets.Add ("pos", + boost::bind(&Rw11UnitStream::SetPos,pobj, _1)); + return; +} } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitStream.hpp b/tools/src/librwxxtpp/RtclRw11UnitStream.hpp index b1004b75..96846b96 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitStream.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitStream.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitStream.hpp 515 2013-05-04 17:28:59Z mueller $ +// $Id: RtclRw11UnitStream.hpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,13 +13,14 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 use Rw11UnitStream& ObjUV(); inh from RtclRw11Unit // 2013-05-01 513 1.0 Initial version // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitStream.hpp 515 2013-05-04 17:28:59Z mueller $ + \version $Id: RtclRw11UnitStream.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitStream. */ @@ -32,17 +33,16 @@ namespace Retro { - class RtclRw11UnitStream { + class RtclRw11UnitStream : public RtclRw11Unit { public: - RtclRw11UnitStream(RtclRw11Unit* ptcl, - Rw11UnitStream* pobj); + RtclRw11UnitStream(const std::string& type); ~RtclRw11UnitStream(); - protected: + virtual Rw11UnitStream& ObjUV() = 0; protected: - RtclRw11Unit* fpTcl; - Rw11UnitStream* fpObj; + void SetupGetSet(); + }; } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitTM11.cpp b/tools/src/librwxxtpp/RtclRw11UnitTM11.cpp index fc895576..6c529ce1 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitTM11.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitTM11.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitTM11.cpp 686 2015-06-04 21:08:08Z mueller $ +// $Id: RtclRw11UnitTM11.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2015- by Walter F.J. Mueller +// Copyright 2015-2017 by Walter F.J. Mueller // // 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 @@ -13,12 +13,13 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2015-05-17 683 1.0 Initial version // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitTM11.cpp 686 2015-06-04 21:08:08Z mueller $ + \version $Id: RtclRw11UnitTM11.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitTM11. */ @@ -40,9 +41,10 @@ namespace Retro { RtclRw11UnitTM11::RtclRw11UnitTM11( Tcl_Interp* interp, const std::string& unitcmd, const boost::shared_ptr& spunit) - : RtclRw11UnitBase("Rw11UnitTM11", spunit), - RtclRw11UnitTape(this, spunit.get()) + : RtclRw11UnitBase("Rw11UnitTM11", spunit) { + SetupGetSet(); CreateObjectCmd(interp, unitcmd.c_str()); } diff --git a/tools/src/librwxxtpp/RtclRw11UnitTM11.hpp b/tools/src/librwxxtpp/RtclRw11UnitTM11.hpp index cb0c39da..29ee031b 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitTM11.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitTM11.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitTM11.hpp 686 2015-06-04 21:08:08Z mueller $ +// $Id: RtclRw11UnitTM11.hpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2015- by Walter F.J. Mueller +// Copyright 2015-2017 by Walter F.J. Mueller // // 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 @@ -13,13 +13,14 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 inherit from RtclRw11UnitBase // 2015-05-17 683 1.0 Initial version // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitTM11.hpp 686 2015-06-04 21:08:08Z mueller $ + \version $Id: RtclRw11UnitTM11.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitTM11. */ @@ -34,8 +35,8 @@ namespace Retro { - class RtclRw11UnitTM11 : public RtclRw11UnitBase, - public RtclRw11UnitTape { + class RtclRw11UnitTM11 : public RtclRw11UnitBase { public: RtclRw11UnitTM11(Tcl_Interp* interp, const std::string& unitcmd, diff --git a/tools/src/librwxxtpp/RtclRw11UnitTape.cpp b/tools/src/librwxxtpp/RtclRw11UnitTape.cpp index 88710448..b7b39fc4 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitTape.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitTape.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitTape.cpp 686 2015-06-04 21:08:08Z mueller $ +// $Id: RtclRw11UnitTape.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2015- by Walter F.J. Mueller +// Copyright 2015-2017 by Walter F.J. Mueller // // 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 @@ -13,13 +13,14 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 use Rw11UnitTape& ObjUV(); inherit from RtclRw11Unit // 2015-06-04 686 1.0 Initial version // 2015-05-17 683 0.1 First draft // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitTape.cpp 686 2015-06-04 21:08:08Z mueller $ + \version $Id: RtclRw11UnitTape.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitTape. */ @@ -38,40 +39,9 @@ namespace Retro { //------------------------------------------+----------------------------------- //! Constructor -RtclRw11UnitTape::RtclRw11UnitTape(RtclRw11Unit* ptcl, Rw11UnitTape* pobj) - : fpTcl(ptcl), - fpObj(pobj) -{ - RtclGetList& gets = ptcl->GetList(); - RtclSetList& sets = ptcl->SetList(); - gets.Add ("type", - boost::bind(&Rw11UnitTape::Type, pobj)); - gets.Add ("wprot", - boost::bind(&Rw11UnitTape::WProt, pobj)); - gets.Add ("capacity", - boost::bind(&Rw11UnitTape::Capacity, pobj)); - gets.Add ("bot", - boost::bind(&Rw11UnitTape::Bot, pobj)); - gets.Add ("eot", - boost::bind(&Rw11UnitTape::Eot, pobj)); - gets.Add ("eom", - boost::bind(&Rw11UnitTape::Eom, pobj)); - gets.Add ("posfile", - boost::bind(&Rw11UnitTape::PosFile, pobj)); - gets.Add ("posrecord", - boost::bind(&Rw11UnitTape::PosRecord, pobj)); - - sets.Add ("type", - boost::bind(&Rw11UnitTape::SetType,pobj, _1)); - sets.Add ("wprot", - boost::bind(&Rw11UnitTape::SetWProt,pobj, _1)); - sets.Add ("capacity", - boost::bind(&Rw11UnitTape::SetCapacity,pobj, _1)); - sets.Add ("posfile", - boost::bind(&Rw11UnitTape::SetPosFile,pobj, _1)); - sets.Add ("posrecord", - boost::bind(&Rw11UnitTape::SetPosRecord,pobj, _1)); -} +RtclRw11UnitTape::RtclRw11UnitTape(const std::string& type) + : RtclRw11Unit(type) +{} //------------------------------------------+----------------------------------- //! FIXME_docs @@ -79,5 +49,45 @@ RtclRw11UnitTape::RtclRw11UnitTape(RtclRw11Unit* ptcl, Rw11UnitTape* pobj) RtclRw11UnitTape::~RtclRw11UnitTape() {} +//------------------------------------------+----------------------------------- +//! FIXME_docs + +void RtclRw11UnitTape::SetupGetSet() +{ + // this can't be in ctor because pure virtual is called which is available + // only when more derived class is being constructed. SetupGetSet() must be + // called in ctor of a more derived class. + + Rw11UnitTape* pobj = &ObjUV(); + + fGets.Add ("type", + boost::bind(&Rw11UnitTape::Type, pobj)); + fGets.Add ("wprot", + boost::bind(&Rw11UnitTape::WProt, pobj)); + fGets.Add ("capacity", + boost::bind(&Rw11UnitTape::Capacity, pobj)); + fGets.Add ("bot", + boost::bind(&Rw11UnitTape::Bot, pobj)); + fGets.Add ("eot", + boost::bind(&Rw11UnitTape::Eot, pobj)); + fGets.Add ("eom", + boost::bind(&Rw11UnitTape::Eom, pobj)); + fGets.Add ("posfile", + boost::bind(&Rw11UnitTape::PosFile, pobj)); + fGets.Add ("posrecord", + boost::bind(&Rw11UnitTape::PosRecord, pobj)); + + fSets.Add ("type", + boost::bind(&Rw11UnitTape::SetType,pobj, _1)); + fSets.Add ("wprot", + boost::bind(&Rw11UnitTape::SetWProt,pobj, _1)); + fSets.Add ("capacity", + boost::bind(&Rw11UnitTape::SetCapacity,pobj, _1)); + fSets.Add ("posfile", + boost::bind(&Rw11UnitTape::SetPosFile,pobj, _1)); + fSets.Add ("posrecord", + boost::bind(&Rw11UnitTape::SetPosRecord,pobj, _1)); + return; +} } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitTape.hpp b/tools/src/librwxxtpp/RtclRw11UnitTape.hpp index 69669e16..915e52e3 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitTape.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitTape.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitTape.hpp 683 2015-05-17 21:54:35Z mueller $ +// $Id: RtclRw11UnitTape.hpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2015- by Walter F.J. Mueller +// Copyright 2015-2017 by Walter F.J. Mueller // // 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 @@ -13,13 +13,14 @@ // // Revision History: // Date Rev Version Comment -// 2015-05-17 683 0.1 First draft +// 2017-04-08 870 1.1 use Rw11UnitTape& ObjUV(); inherit from RtclRw11Unit +// 2015-05-17 683 1.0 Initial version // --------------------------------------------------------------------------- /*! \file - \version $Id: RtclRw11UnitTape.hpp 683 2015-05-17 21:54:35Z mueller $ + \version $Id: RtclRw11UnitTape.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitTape. */ @@ -32,16 +33,17 @@ namespace Retro { - class RtclRw11UnitTape { + class RtclRw11UnitTape : public RtclRw11Unit { public: - RtclRw11UnitTape(RtclRw11Unit* ptcl, Rw11UnitTape* pobj); + RtclRw11UnitTape(const std::string& type); ~RtclRw11UnitTape(); + virtual Rw11UnitTape& ObjUV() = 0; + protected: + void SetupGetSet(); + - protected: - RtclRw11Unit* fpTcl; - Rw11UnitTape* fpObj; }; } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp b/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp index feba8b63..e740677d 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitTerm.cpp 511 2013-04-27 13:51:46Z mueller $ +// $Id: RtclRw11UnitTerm.cpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 use Rw11UnitTerm& ObjUV(); inherit from RtclRw11Unit // 2013-04-26 511 1.0.1 add M_type // 2013-03-03 494 1.0 Initial version // 2013-03-01 493 0.1 First draft @@ -20,7 +21,7 @@ /*! \file - \version $Id: RtclRw11UnitTerm.cpp 511 2013-04-27 13:51:46Z mueller $ + \version $Id: RtclRw11UnitTerm.cpp 870 2017-04-08 18:24:34Z mueller $ \brief Implemenation of RtclRw11UnitTerm. */ @@ -39,34 +40,10 @@ namespace Retro { //------------------------------------------+----------------------------------- //! Constructor -RtclRw11UnitTerm::RtclRw11UnitTerm(RtclRw11Unit* ptcl, Rw11UnitTerm* pobj) - : fpTcl(ptcl), - fpObj(pobj) +RtclRw11UnitTerm::RtclRw11UnitTerm(const std::string& type) + : RtclRw11Unit(type) { - ptcl->AddMeth("type", boost::bind(&RtclRw11UnitTerm::M_type, this, _1)); - - RtclGetList& gets = ptcl->GetList(); - RtclSetList& sets = ptcl->SetList(); - - gets.Add ("channelid", - boost::bind(&Rw11UnitTerm::ChannelId, pobj)); - gets.Add ("to7bit", - boost::bind(&Rw11UnitTerm::To7bit, pobj)); - gets.Add ("toenpc", - boost::bind(&Rw11UnitTerm::ToEnpc, pobj)); - gets.Add ("ti7bit", - boost::bind(&Rw11UnitTerm::Ti7bit, pobj)); - gets.Add ("log", - boost::bind(&Rw11UnitTerm::Log, pobj)); - - sets.Add ("to7bit", - boost::bind(&Rw11UnitTerm::SetTo7bit,pobj, _1)); - sets.Add ("toenpc", - boost::bind(&Rw11UnitTerm::SetToEnpc,pobj, _1)); - sets.Add ("ti7bit", - boost::bind(&Rw11UnitTerm::SetTi7bit,pobj, _1)); - sets.Add ("log", - boost::bind(&Rw11UnitTerm::SetLog,pobj, _1)); + AddMeth("type", boost::bind(&RtclRw11UnitTerm::M_type, this, _1)); } //------------------------------------------+----------------------------------- @@ -82,12 +59,45 @@ int RtclRw11UnitTerm::M_type(RtclArgs& args) { string text; if (!args.GetArg("text", text)) return TCL_ERROR; - if (!args.AllDone()) return TCL_ERROR; - fpObj->RcvCallback((const uint8_t*)text.data(), text.size()); + ObjUV().RcvCallback((const uint8_t*)text.data(), text.size()); return TCL_OK; } +//------------------------------------------+----------------------------------- +//! FIXME_docs + +void RtclRw11UnitTerm::SetupGetSet() +{ + // this can't be in ctor because pure virtual is called which is available + // only when more derived class is being constructed. SetupGetSet() must be + // called in ctor of a more derived class. + + Rw11UnitTerm* pobj = &ObjUV(); + + fGets.Add ("channelid", + boost::bind(&Rw11UnitTerm::ChannelId, pobj)); + fGets.Add ("to7bit", + boost::bind(&Rw11UnitTerm::To7bit, pobj)); + fGets.Add ("toenpc", + boost::bind(&Rw11UnitTerm::ToEnpc, pobj)); + fGets.Add ("ti7bit", + boost::bind(&Rw11UnitTerm::Ti7bit, pobj)); + fGets.Add ("log", + boost::bind(&Rw11UnitTerm::Log, pobj)); + + fSets.Add ("to7bit", + boost::bind(&Rw11UnitTerm::SetTo7bit,pobj, _1)); + fSets.Add ("toenpc", + boost::bind(&Rw11UnitTerm::SetToEnpc,pobj, _1)); + fSets.Add ("ti7bit", + boost::bind(&Rw11UnitTerm::SetTi7bit,pobj, _1)); + fSets.Add ("log", + boost::bind(&Rw11UnitTerm::SetLog,pobj, _1)); + return; +} + + } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitTerm.hpp b/tools/src/librwxxtpp/RtclRw11UnitTerm.hpp index 3d594667..90b839b8 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitTerm.hpp +++ b/tools/src/librwxxtpp/RtclRw11UnitTerm.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11UnitTerm.hpp 511 2013-04-27 13:51:46Z mueller $ +// $Id: RtclRw11UnitTerm.hpp 870 2017-04-08 18:24:34Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2017 by Walter F.J. Mueller // // 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 @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2017-04-08 870 1.1 use Rw11UnitTerm& ObjUV(); inherit from RtclRw11Unit // 2013-04-26 511 1.0.1 add M_type // 2013-03-03 494 1.0 Initial version // 2013-03-01 493 0.1 First draft @@ -21,7 +22,7 @@ /*! \file - \version $Id: RtclRw11UnitTerm.hpp 511 2013-04-27 13:51:46Z mueller $ + \version $Id: RtclRw11UnitTerm.hpp 870 2017-04-08 18:24:34Z mueller $ \brief Declaration of class RtclRw11UnitTerm. */ @@ -34,17 +35,17 @@ namespace Retro { - class RtclRw11UnitTerm { + class RtclRw11UnitTerm : public RtclRw11Unit { public: - RtclRw11UnitTerm(RtclRw11Unit* ptcl, Rw11UnitTerm* pobj); + RtclRw11UnitTerm(const std::string& type); ~RtclRw11UnitTerm(); + virtual Rw11UnitTerm& ObjUV() = 0; + protected: int M_type(RtclArgs& args); + void SetupGetSet(); - protected: - RtclRw11Unit* fpTcl; - Rw11UnitTerm* fpObj; }; } // end namespace Retro