diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 639f0717..16ee7c38 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -105,6 +105,8 @@ The full set of tests is only run for tagged releases. - replace boost with std - use std::unique_ptr instead of boost::scoped_ptr - use std::shared_ptr instead of boost + - use std::function instead of boost + - use std::bind or in most cases a lambda instead of boost::bind - reduce usage of pointers in APIs - add HasPort/HasVirt(); Port() and Virt() return reference - rw11/shell.tcl: add workaround for tclreadline and `after` interference diff --git a/tools/src/librlink/ReventLoop.cpp b/tools/src/librlink/ReventLoop.cpp index 0726e962..5ba16d25 100644 --- a/tools/src/librlink/ReventLoop.cpp +++ b/tools/src/librlink/ReventLoop.cpp @@ -1,4 +1,4 @@ -// $Id: ReventLoop.cpp 1066 2018-11-10 11:21:53Z mueller $ +// $Id: ReventLoop.cpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.2.3 AddPollHandler(): use rval ref and move // 2018-11-09 1066 1.2.2 use emplace_back // 2017-04-07 868 1.2.1 Dump(): add detail arg // 2015-04-04 662 1.2 BUGFIX: fix race in Stop(), add UnStop,StopPending @@ -32,7 +33,6 @@ #include #include -#include "boost/bind.hpp" #include "boost/thread/locks.hpp" #include "librtools/Rexception.hpp" @@ -78,8 +78,7 @@ ReventLoop::~ReventLoop() // by default handlers should start with: // if (pfd.revents & (~pfd.events)) return -1; -void ReventLoop::AddPollHandler(const pollhdl_t& pollhdl, - int fd, short events) +void ReventLoop::AddPollHandler(pollhdl_t&& pollhdl, int fd, short events) { boost::lock_guard lock(fPollDscMutex); @@ -91,7 +90,7 @@ void ReventLoop::AddPollHandler(const pollhdl_t& pollhdl, } } - fPollDsc.emplace_back(PollDsc(pollhdl,fd,events)); + fPollDsc.emplace_back(move(pollhdl),fd,events); fUpdatePoll = true; if (fspLog && fTraceLevel >= 1) { diff --git a/tools/src/librlink/ReventLoop.hpp b/tools/src/librlink/ReventLoop.hpp index c2e66ee3..c863ffa3 100644 --- a/tools/src/librlink/ReventLoop.hpp +++ b/tools/src/librlink/ReventLoop.hpp @@ -1,4 +1,4 @@ -// $Id: ReventLoop.hpp 1078 2018-12-08 14:19:03Z mueller $ +// $Id: ReventLoop.hpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.2.4 AddPollHandler(): use rval ref and move +// 2018-12-14 1081 1.2.3 use std::function instead of boost // 2018-12-07 1078 1.2.2 use std::shared_ptr instead of boost // 2017-04-07 868 1.2.1 Dump(): add detail arg // 2015-04-04 662 1.2 BUGFIX: fix race in Stop(), add UnStop,StopPending @@ -35,9 +37,9 @@ #include #include #include +#include #include "boost/utility.hpp" -#include "boost/function.hpp" #include "boost/thread/mutex.hpp" #include "librtools/RlogFile.hpp" @@ -46,12 +48,12 @@ namespace Retro { class ReventLoop : private boost::noncopyable { public: - typedef boost::function pollhdl_t; + typedef std::function pollhdl_t; ReventLoop(); virtual ~ReventLoop(); - void AddPollHandler(const pollhdl_t& pollhdl, + void AddPollHandler(pollhdl_t&& pollhdl, int fd, short events=POLLIN); bool TestPollHandler(int fd, short events=POLLIN); void RemovePollHandler(int fd, short events, bool nothrow=false); diff --git a/tools/src/librlink/RlinkPortCuff.cpp b/tools/src/librlink/RlinkPortCuff.cpp index 9d22dfe9..96aee5fb 100644 --- a/tools/src/librlink/RlinkPortCuff.cpp +++ b/tools/src/librlink/RlinkPortCuff.cpp @@ -1,4 +1,4 @@ -// $Id: RlinkPortCuff.cpp 1066 2018-11-10 11:21:53Z mueller $ +// $Id: RlinkPortCuff.cpp 1081 2018-12-14 22:29:42Z mueller $ // // Copyright 2012-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-14 1081 1.1.8 use std::bind instead of boost // 2018-11-09 1066 1.1.7 use auto // 2018-10-27 1059 1.1.6 coverity fixup (uncaught exception in dtor) // 2017-04-15 875 1.1.5 Open(): set default scheme @@ -243,7 +244,7 @@ bool RlinkPortCuff::Open(const std::string& url, RerrMsg& emsg) libusb_set_pollfd_notifiers(fpUsbContext, ThunkPollfdAdd, ThunkPollfdRemove, this); - fDriverThread = boost::thread(boost::bind(&RlinkPortCuff::Driver, this)); + fDriverThread = boost::thread(std::bind(&RlinkPortCuff::Driver, this)); fIsOpen = true; diff --git a/tools/src/librlink/RlinkServer.cpp b/tools/src/librlink/RlinkServer.cpp index d582ceaa..04405e13 100644 --- a/tools/src/librlink/RlinkServer.cpp +++ b/tools/src/librlink/RlinkServer.cpp @@ -1,4 +1,4 @@ -// $Id: RlinkServer.cpp 1079 2018-12-09 10:56:59Z mueller $ +// $Id: RlinkServer.cpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 2.2.7 for std::function setups: use rval ref and move +// 2018-12-14 1081 2.2.6 use std::bind instead of boost // 2018-12-07 1078 2.2.5 use std::shared_ptr instead of boost // 2018-10-27 1059 2.2.4 coverity fixup (uncaught exception in dtor) // 2017-04-07 868 2.2.3 Dump(): add detail arg @@ -34,7 +36,6 @@ */ #include "boost/thread/locks.hpp" -#include "boost/bind.hpp" #include "librtools/Rexception.hpp" #include "librtools/RosFill.hpp" @@ -76,7 +77,8 @@ RlinkServer::RlinkServer() RlinkCommand::kStat_M_RbNak | RlinkCommand::kStat_M_RbErr); - fELoop.AddPollHandler(boost::bind(&RlinkServer::WakeupHandler, this, _1), + fELoop.AddPollHandler([this](const pollfd& pfd) + { return WakeupHandler(pfd); }, fWakeupEvent, POLLIN); // Statistic setup @@ -135,7 +137,7 @@ void RlinkServer::SetConnect(const std::shared_ptr& spconn) //------------------------------------------+----------------------------------- //! FIXME_docs -void RlinkServer::AddAttnHandler(const attnhdl_t& attnhdl, uint16_t mask, +void RlinkServer::AddAttnHandler(attnhdl_t&& attnhdl, uint16_t mask, void* cdata) { if (mask == 0) @@ -150,7 +152,7 @@ void RlinkServer::AddAttnHandler(const attnhdl_t& attnhdl, uint16_t mask, "Bad args: duplicate handler"); } } - fAttnDsc.push_back(AttnDsc(attnhdl, id)); + fAttnDsc.emplace_back(move(attnhdl), id); return; } @@ -205,10 +207,10 @@ void RlinkServer::RemoveAttnHandler(uint16_t mask, void* cdata) //------------------------------------------+----------------------------------- //! FIXME_docs -void RlinkServer::QueueAction(const actnhdl_t& actnhdl) +void RlinkServer::QueueAction(actnhdl_t&& actnhdl) { boost::lock_guard lock(*fspConn); - fActnList.push_back(actnhdl); + fActnList.push_back(move(actnhdl)); if (IsActiveOutside()) Wakeup(); return; } @@ -216,11 +218,10 @@ void RlinkServer::QueueAction(const actnhdl_t& actnhdl) //------------------------------------------+----------------------------------- //! FIXME_docs -void RlinkServer::AddPollHandler(const pollhdl_t& pollhdl, - int fd, short events) +void RlinkServer::AddPollHandler(pollhdl_t&& pollhdl, int fd, short events) { boost::lock_guard lock(*fspConn); - fELoop.AddPollHandler(pollhdl, fd, events); + fELoop.AddPollHandler(move(pollhdl), fd, events); if (IsActiveOutside()) Wakeup(); return; } @@ -415,13 +416,14 @@ void RlinkServer::StartOrResume(bool resume) // setup poll handler for Rlink traffic int rlinkfd = fspConn->Port().FdRead(); if (!fELoop.TestPollHandler(rlinkfd, POLLIN)) - fELoop.AddPollHandler(boost::bind(&RlinkServer::RlinkHandler, this, _1), + fELoop.AddPollHandler([this](const pollfd& pfd) + { return RlinkHandler(pfd); }, rlinkfd, POLLIN); // and start server thread fELoop.UnStop(); - fServerThread = boost::thread(boost::bind(&RlinkServerEventLoop::EventLoop, - &fELoop)); + fServerThread = boost::thread(std::bind(&RlinkServerEventLoop::EventLoop, + &fELoop)); if (resume) { RerrMsg emsg; diff --git a/tools/src/librlink/RlinkServer.hpp b/tools/src/librlink/RlinkServer.hpp index ebfb8a2e..baa4762a 100644 --- a/tools/src/librlink/RlinkServer.hpp +++ b/tools/src/librlink/RlinkServer.hpp @@ -1,4 +1,4 @@ -// $Id: RlinkServer.hpp 1078 2018-12-08 14:19:03Z mueller $ +// $Id: RlinkServer.hpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 2.2.4 for std::function setups: use rval ref and move +// 2018-12-14 1081 2.2.3 use std::function instead of boost // 2018-12-07 1078 2.2.2 use std::shared_ptr instead of boost // 2017-04-07 868 2.2.1 Dump(): add detail arg // 2015-01-10 632 2.2 Exec() without emsg now void, will throw @@ -38,6 +40,7 @@ #include #include #include +#include #include "boost/utility.hpp" #include "boost/thread/thread.hpp" @@ -63,9 +66,9 @@ namespace Retro { AttnArgs(uint16_t apatt, uint16_t amask); }; - typedef ReventLoop::pollhdl_t pollhdl_t; - typedef boost::function attnhdl_t; - typedef boost::function actnhdl_t; + typedef ReventLoop::pollhdl_t pollhdl_t; + typedef std::function attnhdl_t; + typedef std::function actnhdl_t; explicit RlinkServer(); virtual ~RlinkServer(); @@ -79,15 +82,15 @@ namespace Retro { bool Exec(RlinkCommandList& clist, RerrMsg& emsg); void Exec(RlinkCommandList& clist); - void AddAttnHandler(const attnhdl_t& attnhdl, uint16_t mask, + void AddAttnHandler(attnhdl_t&& attnhdl, uint16_t mask, void* cdata = nullptr); void RemoveAttnHandler(uint16_t mask, void* cdata = nullptr); void GetAttnInfo(AttnArgs& args, RlinkCommandList& clist); void GetAttnInfo(AttnArgs& args); - void QueueAction(const actnhdl_t& actnhdl); + void QueueAction(actnhdl_t&& actnhdl); - void AddPollHandler(const pollhdl_t& pollhdl, + void AddPollHandler(pollhdl_t&& pollhdl, int fd, short events=POLLIN); bool TestPollHandler(int fd, short events=POLLIN); void RemovePollHandler(int fd, short events, bool nothrow=false); @@ -164,7 +167,7 @@ namespace Retro { attnhdl_t fHandler; AttnId fId; AttnDsc(); - AttnDsc(attnhdl_t hdl, const AttnId& id); + AttnDsc(attnhdl_t&& hdl, const AttnId& id); }; std::shared_ptr fspConn; diff --git a/tools/src/librlink/RlinkServer.ipp b/tools/src/librlink/RlinkServer.ipp index 28677b32..8705dd34 100644 --- a/tools/src/librlink/RlinkServer.ipp +++ b/tools/src/librlink/RlinkServer.ipp @@ -1,4 +1,4 @@ -// $Id: RlinkServer.ipp 1078 2018-12-08 14:19:03Z mueller $ +// $Id: RlinkServer.ipp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 2.2.2 for std::function setups: use rval ref and move // 2018-12-07 1078 2.2.1 use std::shared_ptr instead of boost // 2015-01-10 632 2.2 Exec() without emsg now void, will throw // 2014-12-30 625 2.1 adopt to Rlink V4 attn logic @@ -190,8 +191,8 @@ inline RlinkServer::AttnDsc::AttnDsc() //------------------------------------------+----------------------------------- //! Constructor -inline RlinkServer::AttnDsc::AttnDsc(attnhdl_t hdl, const AttnId& id) - : fHandler(hdl), +inline RlinkServer::AttnDsc::AttnDsc(attnhdl_t&& hdl, const AttnId& id) + : fHandler(move(hdl)), fId(id) {} diff --git a/tools/src/librlinktpp/RtclAttnShuttle.cpp b/tools/src/librlinktpp/RtclAttnShuttle.cpp index abf466d3..a646b96d 100644 --- a/tools/src/librlinktpp/RtclAttnShuttle.cpp +++ b/tools/src/librlinktpp/RtclAttnShuttle.cpp @@ -1,4 +1,4 @@ -// $Id: RtclAttnShuttle.cpp 1059 2018-10-27 10:34:16Z mueller $ +// $Id: RtclAttnShuttle.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.1.2 use lambda instead of bind // 2018-10-27 1059 1.1.1 coverity fixup (uncaught exception in dtor) // 2014-12-30 625 1.1 adopt to Rlink V4 attn logic // 2014-11-08 602 1.0.3 cast int first to ptrdiff_t, than to ClientData @@ -29,8 +30,6 @@ #include -#include "boost/bind.hpp" - #include "librtools/Rexception.hpp" #include "librtools/Rtools.hpp" @@ -82,7 +81,8 @@ RtclAttnShuttle::~RtclAttnShuttle() void RtclAttnShuttle::Add(RlinkServer* pserv, Tcl_Interp* interp) { // connect to RlinkServer - pserv->AddAttnHandler(boost::bind(&RtclAttnShuttle::AttnHandler, this, _1), + pserv->AddAttnHandler([this](RlinkServer::AttnArgs& args) + { return AttnHandler(args); }, fMask, (void*)this); fpServ = pserv; diff --git a/tools/src/librlinktpp/RtclRlinkConnect.cpp b/tools/src/librlinktpp/RtclRlinkConnect.cpp index 97599699..5e9c1efe 100644 --- a/tools/src/librlinktpp/RtclRlinkConnect.cpp +++ b/tools/src/librlinktpp/RtclRlinkConnect.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRlinkConnect.cpp 1079 2018-12-09 10:56:59Z mueller $ +// $Id: RtclRlinkConnect.cpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2011-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.6.5 use lambda instead of bind // 2018-12-08 1079 1.6.4 use HasPort(); Port() returns now ref // 2018-12-07 1077 1.6.3 use SetLastExpectBlock move semantics // 2018-11-16 1070 1.6.2 use auto; use range loop @@ -55,7 +56,6 @@ #include -#include "boost/bind.hpp" #include "boost/thread/locks.hpp" #include "librtcltools/Rtcl.hpp" @@ -88,24 +88,24 @@ RtclRlinkConnect::RtclRlinkConnect(Tcl_Interp* interp, const char* name) fGets(), fSets() { - AddMeth("open", boost::bind(&RtclRlinkConnect::M_open, this, _1)); - AddMeth("close", boost::bind(&RtclRlinkConnect::M_close, this, _1)); - AddMeth("init", boost::bind(&RtclRlinkConnect::M_init, this, _1)); - AddMeth("exec", boost::bind(&RtclRlinkConnect::M_exec, this, _1)); - AddMeth("amap", boost::bind(&RtclRlinkConnect::M_amap, this, _1)); - AddMeth("errcnt", boost::bind(&RtclRlinkConnect::M_errcnt, this, _1)); - AddMeth("wtlam", boost::bind(&RtclRlinkConnect::M_wtlam, this, _1)); - AddMeth("oob", boost::bind(&RtclRlinkConnect::M_oob, this, _1)); - AddMeth("rawread", boost::bind(&RtclRlinkConnect::M_rawread, this, _1)); - AddMeth("rawrblk", boost::bind(&RtclRlinkConnect::M_rawrblk, this, _1)); - AddMeth("rawwblk", boost::bind(&RtclRlinkConnect::M_rawwblk, this, _1)); - AddMeth("stats", boost::bind(&RtclRlinkConnect::M_stats, this, _1)); - AddMeth("log", boost::bind(&RtclRlinkConnect::M_log, this, _1)); - AddMeth("print", boost::bind(&RtclRlinkConnect::M_print, this, _1)); - AddMeth("dump", boost::bind(&RtclRlinkConnect::M_dump, this, _1)); - AddMeth("get", boost::bind(&RtclRlinkConnect::M_get, this, _1)); - AddMeth("set", boost::bind(&RtclRlinkConnect::M_set, this, _1)); - AddMeth("$default", boost::bind(&RtclRlinkConnect::M_default, this, _1)); + AddMeth("open", [this](RtclArgs& args){ return M_open(args); }); + AddMeth("close", [this](RtclArgs& args){ return M_close(args); }); + AddMeth("init", [this](RtclArgs& args){ return M_init(args); }); + AddMeth("exec", [this](RtclArgs& args){ return M_exec(args); }); + AddMeth("amap", [this](RtclArgs& args){ return M_amap(args); }); + AddMeth("errcnt", [this](RtclArgs& args){ return M_errcnt(args); }); + AddMeth("wtlam", [this](RtclArgs& args){ return M_wtlam(args); }); + AddMeth("oob", [this](RtclArgs& args){ return M_oob(args); }); + AddMeth("rawread", [this](RtclArgs& args){ return M_rawread(args); }); + AddMeth("rawrblk", [this](RtclArgs& args){ return M_rawrblk(args); }); + AddMeth("rawwblk", [this](RtclArgs& args){ return M_rawwblk(args); }); + AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); + AddMeth("log", [this](RtclArgs& args){ return M_log(args); }); + AddMeth("print", [this](RtclArgs& args){ return M_print(args); }); + AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); + AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); + AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); + AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); for (size_t i=0; i<8; i++) { fCmdnameObj[i] = Tcl_NewStringObj(RlinkCommand::CommandName(i), -1); @@ -114,68 +114,54 @@ RtclRlinkConnect::RtclRlinkConnect(Tcl_Interp* interp, const char* name) // attributes of RlinkConnect RlinkConnect* pobj = &Obj(); - fGets.Add ("baseaddr", - boost::bind(&RlinkConnect::LogBaseAddr, pobj)); - fGets.Add ("basedata", - boost::bind(&RlinkConnect::LogBaseData, pobj)); - fGets.Add ("basestat", - boost::bind(&RlinkConnect::LogBaseStat, pobj)); - fGets.Add ("printlevel", - boost::bind(&RlinkConnect::PrintLevel, pobj)); - fGets.Add ("dumplevel", - boost::bind(&RlinkConnect::DumpLevel, pobj)); - fGets.Add ("tracelevel", - boost::bind(&RlinkConnect::TraceLevel, pobj)); - fGets.Add ("timeout", - boost::bind(&RlinkConnect::Timeout, pobj)); - fGets.Add ("logfile", - boost::bind(&RlinkConnect::LogFileName, pobj)); + fGets.Add ("baseaddr", [pobj](){ return pobj->LogBaseAddr(); }); + fGets.Add ("basedata", [pobj](){ return pobj->LogBaseData(); }); + fGets.Add ("basestat", [pobj](){ return pobj->LogBaseStat(); }); + fGets.Add ("printlevel", [pobj](){ return pobj->PrintLevel(); }); + fGets.Add ("dumplevel", [pobj](){ return pobj->DumpLevel(); }); + fGets.Add ("tracelevel", [pobj](){ return pobj->TraceLevel(); }); + fGets.Add ("timeout", [pobj](){ return pobj->Timeout(); }); + fGets.Add("logfile", [pobj](){ return pobj->LogFileName(); }); - fGets.Add ("initdone", - boost::bind(&RlinkConnect::LinkInitDone, pobj)); - fGets.Add ("sysid", - boost::bind(&RlinkConnect::SysId, pobj)); - fGets.Add ("usracc", - boost::bind(&RlinkConnect::UsrAcc, pobj)); - fGets.Add ("rbufsize", - boost::bind(&RlinkConnect::RbufSize, pobj)); - fGets.Add ("bsizemax", - boost::bind(&RlinkConnect::BlockSizeMax, pobj)); - fGets.Add ("bsizeprudent", - boost::bind(&RlinkConnect::BlockSizePrudent, pobj)); - fGets.Add ("hasrbmon", - boost::bind(&RlinkConnect::HasRbmon, pobj)); + fGets.Add ("initdone", [pobj](){ return pobj->LinkInitDone(); }); + fGets.Add ("sysid", [pobj](){ return pobj->SysId(); }); + fGets.Add ("usracc", [pobj](){ return pobj->UsrAcc(); }); + fGets.Add ("rbufsize", [pobj](){ return pobj->RbufSize(); }); + fGets.Add ("bsizemax", [pobj](){ return pobj->BlockSizeMax(); }); + fGets.Add ("bsizeprudent", + [pobj](){ return pobj->BlockSizePrudent(); }); + fGets.Add ("hasrbmon", [pobj](){ return pobj->HasRbmon(); }); - fSets.Add ("baseaddr", - boost::bind(&RlinkConnect::SetLogBaseAddr, pobj, _1)); + fSets.Add ("baseaddr", + [pobj](uint32_t v){ pobj->SetLogBaseAddr(v); }); fSets.Add ("basedata", - boost::bind(&RlinkConnect::SetLogBaseData, pobj, _1)); + [pobj](uint32_t v){ pobj->SetLogBaseData(v); }); fSets.Add ("basestat", - boost::bind(&RlinkConnect::SetLogBaseStat, pobj, _1)); + [pobj](uint32_t v){ pobj->SetLogBaseStat(v); }); fSets.Add ("printlevel", - boost::bind(&RlinkConnect::SetPrintLevel, pobj, _1)); + [pobj](uint32_t v){ pobj->SetPrintLevel(v); }); fSets.Add ("dumplevel", - boost::bind(&RlinkConnect::SetDumpLevel, pobj, _1)); + [pobj](uint32_t v){ pobj->SetDumpLevel(v); }); fSets.Add ("tracelevel", - boost::bind(&RlinkConnect::SetTraceLevel, pobj, _1)); + [pobj](uint32_t v){ pobj->SetTraceLevel(v); }); fSets.Add ("timeout", - boost::bind(&RlinkConnect::SetTimeout, pobj, _1)); + [pobj](const Rtime& v){ pobj->SetTimeout(v); }); fSets.Add ("logfile", - boost::bind(&RlinkConnect::SetLogFileName, pobj, _1)); + [pobj](const string& v){ pobj->SetLogFileName(v); }); // attributes of buildin RlinkContext RlinkContext* pcntx = &Obj().Context(); fGets.Add ("statchecked", - boost::bind(&RlinkContext::StatusIsChecked, pcntx)); + [pcntx](){ return pcntx->StatusIsChecked(); }); fGets.Add ("statvalue", - boost::bind(&RlinkContext::StatusValue, pcntx)); + [pcntx](){ return pcntx->StatusValue(); }); fGets.Add ("statmask", - boost::bind(&RlinkContext::StatusMask, pcntx)); + [pcntx](){ return pcntx->StatusMask(); }); fSets.Add ("statvalue", - boost::bind(&RlinkContext::SetStatusValue, pcntx, _1)); + [pcntx](uint8_t v){ pcntx->SetStatusValue(v); }); fSets.Add ("statmask", - boost::bind(&RlinkContext::SetStatusMask, pcntx, _1)); + [pcntx](uint8_t v){ pcntx->SetStatusMask(v); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librlinktpp/RtclRlinkPort.cpp b/tools/src/librlinktpp/RtclRlinkPort.cpp index 484234ac..d7fe8e00 100644 --- a/tools/src/librlinktpp/RtclRlinkPort.cpp +++ b/tools/src/librlinktpp/RtclRlinkPort.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRlinkPort.cpp 1079 2018-12-09 10:56:59Z mueller $ +// $Id: RtclRlinkPort.cpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.4.1 use lambda instead of bind // 2018-12-08 1079 1.4 use ref not ptr for RlinkPort // 2018-12-01 1076 1.3 use unique_ptr // 2017-04-29 888 1.2 LogFileName(): returns now const std::string& @@ -35,8 +36,6 @@ #include -#include "boost/bind.hpp" - #include "librtcltools/Rtcl.hpp" #include "librtcltools/RtclOPtr.hpp" #include "librtcltools/RtclNameSet.hpp" @@ -70,18 +69,18 @@ RtclRlinkPort::RtclRlinkPort(Tcl_Interp* interp, const char* name) fSets() { CreateObjectCmd(interp, name); - AddMeth("open", boost::bind(&RtclRlinkPort::M_open, this, _1)); - AddMeth("close", boost::bind(&RtclRlinkPort::M_close, this, _1)); - AddMeth("errcnt", boost::bind(&RtclRlinkPort::M_errcnt, this, _1)); - AddMeth("rawread", boost::bind(&RtclRlinkPort::M_rawread, this, _1)); - AddMeth("rawrblk", boost::bind(&RtclRlinkPort::M_rawrblk, this, _1)); - AddMeth("rawwblk", boost::bind(&RtclRlinkPort::M_rawwblk, this, _1)); - AddMeth("stats", boost::bind(&RtclRlinkPort::M_stats, this, _1)); - AddMeth("log", boost::bind(&RtclRlinkPort::M_log, this, _1)); - AddMeth("dump", boost::bind(&RtclRlinkPort::M_dump, this, _1)); - AddMeth("get", boost::bind(&RtclRlinkPort::M_get, this, _1)); - AddMeth("set", boost::bind(&RtclRlinkPort::M_set, this, _1)); - AddMeth("$default", boost::bind(&RtclRlinkPort::M_default, this, _1)); + AddMeth("open", [this](RtclArgs& args){ return M_open(args); }); + AddMeth("close", [this](RtclArgs& args){ return M_close(args); }); + AddMeth("errcnt", [this](RtclArgs& args){ return M_errcnt(args); }); + AddMeth("rawread", [this](RtclArgs& args){ return M_rawread(args); }); + AddMeth("rawrblk", [this](RtclArgs& args){ return M_rawrblk(args); }); + AddMeth("rawwblk", [this](RtclArgs& args){ return M_rawwblk(args); }); + AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); + AddMeth("log", [this](RtclArgs& args){ return M_log(args); }); + AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); + AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); + AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); + AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); SetupGetSet(); } @@ -255,18 +254,16 @@ void RtclRlinkPort::SetupGetSet() fGets.Clear(); fSets.Clear(); - fGets.Add ("logfile", - boost::bind(&RtclRlinkPort::LogFileName, this)); + fGets.Add ("logfile", [this](){ return LogFileName(); }); fSets.Add ("logfile", - boost::bind(&RtclRlinkPort::SetLogFileName, this, _1)); + [this](const string& v){ SetLogFileName(v); }); if (!fupObj) return; + RlinkPort* pobj = fupObj.get(); - fGets.Add ("tracelevel", - boost::bind(&RlinkPort::TraceLevel, fupObj.get())); + fGets.Add ("tracelevel", [pobj](){ return pobj->TraceLevel(); }); fSets.Add ("tracelevel", - boost::bind(&RlinkPort::SetTraceLevel, fupObj.get(), - _1)); + [pobj](uint32_t v){pobj->SetTraceLevel(v); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librlinktpp/RtclRlinkServer.cpp b/tools/src/librlinktpp/RtclRlinkServer.cpp index 186a9b17..91b1f1dc 100644 --- a/tools/src/librlinktpp/RtclRlinkServer.cpp +++ b/tools/src/librlinktpp/RtclRlinkServer.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRlinkServer.cpp 1076 2018-12-02 12:45:49Z mueller $ +// $Id: RtclRlinkServer.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-14 1081 1.2.1 use std::bind instead of boost // 2018-12-01 1076 1.2 use unique_ptr // 2018-11-16 1070 1.1.2 use auto; use range loop // 2017-04-02 865 1.1.1 M_dump: use GetArgsDump and Dump detail @@ -39,8 +40,6 @@ #include #include -#include "boost/bind.hpp" - #include "librtools/RosPrintBvi.hpp" #include "librtcltools/Rtcl.hpp" #include "librtcltools/RtclOPtr.hpp" @@ -70,36 +69,35 @@ RtclRlinkServer::RtclRlinkServer(Tcl_Interp* interp, const char* name) fGets(), fSets() { - AddMeth("server", boost::bind(&RtclRlinkServer::M_server, this, _1)); - AddMeth("attn", boost::bind(&RtclRlinkServer::M_attn, this, _1)); - AddMeth("stats", boost::bind(&RtclRlinkServer::M_stats, this, _1)); - AddMeth("print", boost::bind(&RtclRlinkServer::M_print, this, _1)); - AddMeth("dump", boost::bind(&RtclRlinkServer::M_dump, this, _1)); - AddMeth("get", boost::bind(&RtclRlinkServer::M_get, this, _1)); - AddMeth("set", boost::bind(&RtclRlinkServer::M_set, this, _1)); - AddMeth("$default", boost::bind(&RtclRlinkServer::M_default, this, _1)); + AddMeth("server", [this](RtclArgs& args){ return M_server(args); }); + AddMeth("attn", [this](RtclArgs& args){ return M_attn(args); }); + AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); + AddMeth("print", [this](RtclArgs& args){ return M_print(args); }); + AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); + AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); + AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); + AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); // attributes of RlinkConnect RlinkServer* pobj = &Obj(); - fGets.Add ("tracelevel", - boost::bind(&RlinkServer::TraceLevel, pobj)); + fGets.Add ("tracelevel", [pobj](){ return pobj->TraceLevel(); }); fSets.Add ("tracelevel", - boost::bind(&RlinkServer::SetTraceLevel, pobj, _1)); + [pobj](uint32_t v){ pobj->SetTraceLevel(v); }); // attributes of buildin RlinkContext RlinkContext* pcntx = &Obj().Context(); - fGets.Add ("statchecked", - boost::bind(&RlinkContext::StatusIsChecked, pcntx)); - fGets.Add ("statvalue", - boost::bind(&RlinkContext::StatusValue, pcntx)); - fGets.Add ("statmask", - boost::bind(&RlinkContext::StatusMask, pcntx)); + fGets.Add ("statchecked", + [pcntx](){ return pcntx->StatusIsChecked(); }); + fGets.Add ("statvalue", + [pcntx](){ return pcntx->StatusValue(); }); + fGets.Add ("statmask", + [pcntx](){ return pcntx->StatusMask(); }); fSets.Add ("statvalue", - boost::bind(&RlinkContext::SetStatusValue, pcntx, _1)); + [pcntx](uint8_t v){ pcntx->SetStatusValue(v); }); fSets.Add ("statmask", - boost::bind(&RlinkContext::SetStatusMask, pcntx, _1)); + [pcntx](uint8_t v){ pcntx->SetStatusMask(v); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librtcltools/RtclCmdBase.cpp b/tools/src/librtcltools/RtclCmdBase.cpp index e97ef22a..2550cbfc 100644 --- a/tools/src/librtcltools/RtclCmdBase.cpp +++ b/tools/src/librtcltools/RtclCmdBase.cpp @@ -1,4 +1,4 @@ -// $Id: RtclCmdBase.cpp 1066 2018-11-10 11:21:53Z mueller $ +// $Id: RtclCmdBase.cpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2011-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.1.3 AddMeth(): use rval ref and move semantics // 2018-11-09 1066 1.1.2 use auto // 2017-04-02 865 1.1.1 add GetArgsDump() // 2017-04-02 863 1.1 add DelMeth(),TstMeth(); add M_info() and '?' @@ -137,9 +138,9 @@ int RtclCmdBase::DispatchCmd(RtclArgs& args) //------------------------------------------+----------------------------------- //! FIXME_docs -void RtclCmdBase::AddMeth(const std::string& name, const methfo_t& methfo) +void RtclCmdBase::AddMeth(const std::string& name, methfo_t&& methfo) { - auto ret = fMethMap.emplace(name, methfo); + auto ret = fMethMap.emplace(name, move(methfo)); if (ret.second == false) // or use !(ret.second) throw Rexception("RtclCmdBase::AddMeth:", string("Bad args: duplicate name: '") + name + "'"); diff --git a/tools/src/librtcltools/RtclCmdBase.hpp b/tools/src/librtcltools/RtclCmdBase.hpp index 1c92ddd0..02b7c35a 100644 --- a/tools/src/librtcltools/RtclCmdBase.hpp +++ b/tools/src/librtcltools/RtclCmdBase.hpp @@ -1,6 +1,6 @@ -// $Id: RtclCmdBase.hpp 1066 2018-11-10 11:21:53Z mueller $ +// $Id: RtclCmdBase.hpp 1083 2018-12-15 19:19:16Z mueller $ // -// Copyright 2013-2017 by Walter F.J. Mueller +// Copyright 2013-2018 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,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.1.3 AddMeth(): use rval ref and move semantics +// 2018-12-14 1081 1.1.2 use std::function instead of boost // 2017-04-02 865 1.1.1 add GetArgsDump() // 2017-04-02 863 1.1 add DelMeth(),TstMeth(); add M_info() and '?' // rename fMapMeth -> fMethMap @@ -32,9 +34,9 @@ #include #include +#include #include "boost/utility.hpp" -#include "boost/function.hpp" #include "RtclArgs.hpp" @@ -42,7 +44,7 @@ namespace Retro { class RtclCmdBase : private boost::noncopyable { public: - typedef boost::function methfo_t; + typedef std::function methfo_t; typedef std::map mmap_t; typedef mmap_t::iterator mmap_it_t; @@ -52,7 +54,7 @@ namespace Retro { virtual ~RtclCmdBase(); int DispatchCmd(RtclArgs& args); - void AddMeth(const std::string& name, const methfo_t& methfo); + void AddMeth(const std::string& name, methfo_t&& methfo); void DelMeth(const std::string& name); bool TstMeth(const std::string& name); diff --git a/tools/src/librtcltools/RtclGet.hpp b/tools/src/librtcltools/RtclGet.hpp index 403a707a..492b9221 100644 --- a/tools/src/librtcltools/RtclGet.hpp +++ b/tools/src/librtcltools/RtclGet.hpp @@ -1,6 +1,6 @@ -// $Id: RtclGet.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclGet.hpp 1083 2018-12-15 19:19:16Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2018 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,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.0.2 ctor: use rval ref and move semantics +// 2018-12-14 1081 1.0.1 use std::function instead of boost // 2013-02-12 487 1.0 Initial version // --------------------------------------------------------------------------- @@ -28,8 +30,7 @@ #include #include - -#include "boost/function.hpp" +#include #include "RtclGetBase.hpp" @@ -38,13 +39,13 @@ namespace Retro { template class RtclGet : public RtclGetBase { public: - explicit RtclGet(const boost::function& get); + explicit RtclGet(std::function&& get); ~RtclGet(); virtual Tcl_Obj* operator()() const; protected: - boost::function fGet; + std::function fGet; }; diff --git a/tools/src/librtcltools/RtclGet.ipp b/tools/src/librtcltools/RtclGet.ipp index 637ad0bc..0f16baf0 100644 --- a/tools/src/librtcltools/RtclGet.ipp +++ b/tools/src/librtcltools/RtclGet.ipp @@ -1,6 +1,6 @@ -// $Id: RtclGet.ipp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclGet.ipp 1083 2018-12-15 19:19:16Z mueller $ // -// Copyright 2013-2017 by Walter F.J. Mueller +// Copyright 2013-2018 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,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.2.2 ctor: use rval ref and move semantics +// 2018-12-14 1081 1.2.1 use std::function instead of boost // 2017-04-16 876 1.2 add Tcl_Obj* // 2017-02-20 854 1.1 add Rtime // 2013-02-12 487 1.0 Initial version @@ -37,8 +39,8 @@ namespace Retro { //! FIXME_docs template -inline RtclGet::RtclGet(const boost::function& get) - : fGet(get) +inline RtclGet::RtclGet(std::function&& get) + : fGet(move(get)) {} //------------------------------------------+----------------------------------- diff --git a/tools/src/librtcltools/RtclGetList.hpp b/tools/src/librtcltools/RtclGetList.hpp index 1bf3455b..833e38ab 100644 --- a/tools/src/librtcltools/RtclGetList.hpp +++ b/tools/src/librtcltools/RtclGetList.hpp @@ -1,4 +1,4 @@ -// $Id: RtclGetList.hpp 1076 2018-12-02 12:45:49Z mueller $ +// $Id: RtclGetList.hpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.2.2 Add(): use rval ref and move semantics +// 2018-12-14 1081 1.2.1 use std::function instead of boost // 2018-12-01 1076 1.2 use unique_ptr // 2015-01-08 631 1.1 add Clear() // 2013-02-12 487 1.0 Initial version @@ -31,9 +33,9 @@ #include #include #include +#include #include "boost/utility.hpp" -#include "boost/function.hpp" #include "RtclGet.hpp" #include "librtcltools/RtclArgs.hpp" @@ -50,8 +52,7 @@ namespace Retro { void Add(const std::string& name, get_uptr_t&& upget); template - void Add(const std::string& name, - const boost::function& get); + void Add(const std::string& name, std::function&& get); void Clear(); int M_get(RtclArgs& args); diff --git a/tools/src/librtcltools/RtclGetList.ipp b/tools/src/librtcltools/RtclGetList.ipp index 4ab4a8ed..a9882e76 100644 --- a/tools/src/librtcltools/RtclGetList.ipp +++ b/tools/src/librtcltools/RtclGetList.ipp @@ -1,4 +1,4 @@ -// $Id: RtclGetList.ipp 1076 2018-12-02 12:45:49Z mueller $ +// $Id: RtclGetList.ipp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.1.2 Add(): use rval ref and move semantics +// 2018-12-14 1081 1.1.1 use std::function instead of boost // 2018-12-01 1076 1.1 use unique_ptr // 2013-02-12 487 1.0 Initial version // --------------------------------------------------------------------------- @@ -30,9 +32,9 @@ namespace Retro { template inline void RtclGetList::Add(const std::string& name, - const boost::function& get) + std::function&& get) { - Add(name, get_uptr_t(new RtclGet(get))); + Add(name, get_uptr_t(new RtclGet(move(get)))); return; } diff --git a/tools/src/librtcltools/RtclSet.hpp b/tools/src/librtcltools/RtclSet.hpp index 761b5409..806c04f4 100644 --- a/tools/src/librtcltools/RtclSet.hpp +++ b/tools/src/librtcltools/RtclSet.hpp @@ -1,6 +1,6 @@ -// $Id: RtclSet.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclSet.hpp 1083 2018-12-15 19:19:16Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2018 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,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.0.2 ctor: use rval ref and move semantics +// 2018-12-14 1081 1.0.1 use std::function instead of boost // 2013-02-12 487 1.0 Initial version // --------------------------------------------------------------------------- @@ -28,8 +30,7 @@ #include #include - -#include "boost/function.hpp" +#include #include "librtools/Rexception.hpp" #include "RtclSetBase.hpp" @@ -39,13 +40,13 @@ namespace Retro { template class RtclSet : public RtclSetBase { public: - explicit RtclSet(const boost::function& set); + explicit RtclSet(std::function&& set); ~RtclSet(); virtual void operator()(RtclArgs& args) const; protected: - boost::function fSet; + std::function fSet; }; diff --git a/tools/src/librtcltools/RtclSet.ipp b/tools/src/librtcltools/RtclSet.ipp index c56eed2f..0062d03b 100644 --- a/tools/src/librtcltools/RtclSet.ipp +++ b/tools/src/librtcltools/RtclSet.ipp @@ -1,6 +1,6 @@ -// $Id: RtclSet.ipp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclSet.ipp 1083 2018-12-15 19:19:16Z mueller $ // -// Copyright 2013-2017 by Walter F.J. Mueller +// Copyright 2013-2018 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,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.1.2 ctor: use rval ref and move semantics +// 2018-12-14 1081 1.1.1 use std::function instead of boost // 2017-02-20 854 1.1 add Rtime // 2013-02-12 487 1.0 Initial version // --------------------------------------------------------------------------- @@ -39,8 +41,8 @@ namespace Retro { //! FIXME_docs template -inline RtclSet::RtclSet(const boost::function& set) - : fSet(set) +inline RtclSet::RtclSet(std::function&& set) + : fSet(move(set)) {} //------------------------------------------+----------------------------------- diff --git a/tools/src/librtcltools/RtclSetList.hpp b/tools/src/librtcltools/RtclSetList.hpp index 74872464..0f7618b7 100644 --- a/tools/src/librtcltools/RtclSetList.hpp +++ b/tools/src/librtcltools/RtclSetList.hpp @@ -1,4 +1,4 @@ -// $Id: RtclSetList.hpp 1076 2018-12-02 12:45:49Z mueller $ +// $Id: RtclSetList.hpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.2.2 Add(): use rval ref and move semantics +// 2018-12-14 1081 1.2.1 use std::function instead of boost // 2018-12-01 1076 1.2 use unique_ptr // 2015-01-08 631 1.1 add Clear() // 2013-02-12 487 1.0 Initial version @@ -31,9 +33,9 @@ #include #include #include +#include #include "boost/utility.hpp" -#include "boost/function.hpp" #include "RtclSet.hpp" #include "librtcltools/RtclArgs.hpp" @@ -51,7 +53,7 @@ namespace Retro { template void Add(const std::string& name, - const boost::function& set); + std::function&& set); void Clear(); int M_set(RtclArgs& args); diff --git a/tools/src/librtcltools/RtclSetList.ipp b/tools/src/librtcltools/RtclSetList.ipp index 0fba798d..88b95bb7 100644 --- a/tools/src/librtcltools/RtclSetList.ipp +++ b/tools/src/librtcltools/RtclSetList.ipp @@ -1,4 +1,4 @@ -// $Id: RtclSetList.ipp 1076 2018-12-02 12:45:49Z mueller $ +// $Id: RtclSetList.ipp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.1.2 Add(): use rval ref and move semantics +// 2018-12-14 1081 1.1.1 use std::function instead of boost // 2018-12-01 1076 1.1 use unique_ptr // 2013-02-12 487 1.0 Initial version // --------------------------------------------------------------------------- @@ -29,10 +31,10 @@ namespace Retro { //! FIXME_docs template -inline void RtclSetList::Add(const std::string& name, - const boost::function& set) +inline void RtclSetList::Add(const std::string& name, + std::function&& set) { - Add(name, set_uptr_t(new RtclSet(set))); + Add(name, set_uptr_t(new RtclSet(move(set)))); return; } diff --git a/tools/src/librw11/Rw11.cpp b/tools/src/librw11/Rw11.cpp index f9e098ab..d62db899 100644 --- a/tools/src/librw11/Rw11.cpp +++ b/tools/src/librw11/Rw11.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11.cpp 1078 2018-12-08 14:19:03Z mueller $ +// $Id: Rw11.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,7 +13,8 @@ // // Revision History: // Date Rev Version Comment -// 2018-12-07 1078 1.1.2 use std::shared_ptr instead of boost +// 2018-12-15 1082 1.1.3 use lambda instead of bind +// 2018-12-09 1080 1.1.2 use std::shared_ptr instead of boost and range loop // 2017-04-07 868 1.1.1 Dump(): add detail arg // 2014-12-30 625 1.1 adopt to Rlink V4 attn logic // 2013-03-06 495 1.0 Initial version @@ -68,7 +69,8 @@ Rw11::~Rw11() void Rw11::SetServer(const std::shared_ptr& spserv) { fspServ = spserv; - fspServ->AddAttnHandler(boost::bind(&Rw11::AttnHandler, this, _1), + fspServ->AddAttnHandler([this](RlinkServer::AttnArgs& args) + { return AttnHandler(args); }, uint16_t(1)< // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 0.5.5 use lambda instead of bind // 2018-12-09 1080 0.5.4 use HasVirt(); Virt() returns ref // 2018-12-08 1078 0.5.3 BUGFIX: Start(Tx|Rx)Ring, was broken in r1049 // when fixing -Wunused-variable warnings @@ -33,8 +34,6 @@ #include -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -353,7 +352,8 @@ void Rw11CntlDEUNA::Start() UnitSetup(0); // add attn handler - Server().AddAttnHandler(boost::bind(&Rw11CntlDEUNA::AttnHandler, this, _1), + Server().AddAttnHandler([this](RlinkServer::AttnArgs& args) + { return AttnHandler(args); }, uint16_t(1)< // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.3.2 use lambda instead of bind // 2017-05-14 897 1.3 add RcvChar(),TraceChar(); trace received chars // 2017-04-02 865 1.2.3 Dump(): add detail arg // 2017-03-03 858 1.2.2 use cntl name as message prefix @@ -30,8 +31,6 @@ \brief Implemenation of Rw11CntlDL11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -123,7 +122,8 @@ void Rw11CntlDL11::Start() fPC_xbuf = Cpu().AddRibr(fPrimClist, fBase+kXBUF); // add attn handler - Server().AddAttnHandler(boost::bind(&Rw11CntlDL11::AttnHandler, this, _1), + Server().AddAttnHandler([this](RlinkServer::AttnArgs& args) + { return AttnHandler(args); }, uint16_t(1)< // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.2.5 use lambda instead of bind +// 2018-12-09 1080 1.2.4 use HasVirt() // 2017-04-02 865 1.2.3 Dump(): add detail arg // 2017-03-03 858 1.2.2 use cntl name as message prefix // 2017-02-25 855 1.2.1 shorten ctor code @@ -27,8 +29,6 @@ \brief Implemenation of Rw11CntlLP11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -110,7 +110,8 @@ void Rw11CntlLP11::Start() fPC_buf = Cpu().AddRibr(fPrimClist, fBase+kBUF); // add attn handler - Server().AddAttnHandler(boost::bind(&Rw11CntlLP11::AttnHandler, this, _1), + Server().AddAttnHandler([this](RlinkServer::AttnArgs& args) + { return AttnHandler(args); }, uint16_t(1)< // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.3.3 use lambda instead of bind // 2018-12-09 1080 1.3.2 use HasVirt(); Virt() returns ref // 2018-10-28 1062 1.3.1 replace boost/foreach // 2017-05-14 897 1.3 trace received chars @@ -28,8 +29,6 @@ \brief Implemenation of Rw11CntlPC11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -122,7 +121,8 @@ void Rw11CntlPC11::Start() fPC_pbuf = Cpu().AddRibr(fPrimClist, fBase+kPBUF); // add attn handler - Server().AddAttnHandler(boost::bind(&Rw11CntlPC11::AttnHandler, this, _1), + Server().AddAttnHandler([this](RlinkServer::AttnArgs& args) + { return AttnHandler(args); }, uint16_t(1)< // Other credits: @@ -15,6 +15,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.0.8 use std::bind or lambda instead of bind // 2018-12-09 1080 1.0.7 use HasVirt(); Virt() returns ref // 2018-10-28 1062 1.0.6 replace boost/foreach // 2017-04-02 865 1.0.5 Dump(): add detail arg @@ -31,8 +32,6 @@ \brief Implemenation of Rw11CntlRHRP. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -187,8 +186,12 @@ Rw11CntlRHRP::Rw11CntlRHRP() fRd_fu(0), fRd_ovr(false), fRdma(this, - boost::bind(&Rw11CntlRHRP::RdmaPreExecCB, this, _1, _2, _3, _4), - boost::bind(&Rw11CntlRHRP::RdmaPostExecCB, this, _1, _2, _3, _4)) + std::bind(&Rw11CntlRHRP::RdmaPreExecCB, this, + placeholders::_1, placeholders::_2, + placeholders::_3, placeholders::_4), + std::bind(&Rw11CntlRHRP::RdmaPostExecCB, this, + placeholders::_1, placeholders::_2, + placeholders::_3, placeholders::_4)) { // must be here because Units have a back-ptr (not available at Rw11CntlBase) for (size_t i=0; i // Other credits: @@ -15,6 +15,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 2.0.8 use std::bind or lambda instead of boost // 2018-12-09 1080 2.0.7 use HasVirt(); Virt() returns ref // 2018-10-28 1062 2.0.6 replace boost/foreach // 2017-04-02 865 2.0.5 Dump(): add detail arg @@ -35,8 +36,6 @@ \brief Implemenation of Rw11CntlRK11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -154,8 +153,12 @@ Rw11CntlRK11::Rw11CntlRK11() fRd_fu(0), fRd_ovr(false), fRdma(this, - boost::bind(&Rw11CntlRK11::RdmaPreExecCB, this, _1, _2, _3, _4), - boost::bind(&Rw11CntlRK11::RdmaPostExecCB, this, _1, _2, _3, _4)) + std::bind(&Rw11CntlRK11::RdmaPreExecCB, this, + placeholders::_1, placeholders::_2, + placeholders::_3, placeholders::_4), + std::bind(&Rw11CntlRK11::RdmaPostExecCB, this, + placeholders::_1, placeholders::_2, + placeholders::_3, placeholders::_4)) { // must be here because Units have a back-ptr (not available at Rw11CntlBase) for (size_t i=0; i // Other credits: @@ -16,6 +16,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.0.8 use std::bind or lambda instead of bind // 2018-12-09 1080 1.0.7 use HasVirt(); Virt() returns ref // 2018-10-28 1062 1.0.6 replace boost/foreach // 2017-04-02 865 1.0.5 Dump(): add detail arg @@ -32,8 +33,6 @@ \brief Implemenation of Rw11CntlRL11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -195,8 +194,12 @@ Rw11CntlRL11::Rw11CntlRL11() fRd_fu(0), fRd_ovr(false), fRdma(this, - boost::bind(&Rw11CntlRL11::RdmaPreExecCB, this, _1, _2, _3, _4), - boost::bind(&Rw11CntlRL11::RdmaPostExecCB, this, _1, _2, _3, _4)) + std::bind(&Rw11CntlRL11::RdmaPreExecCB, this, + placeholders::_1, placeholders::_2, + placeholders::_3, placeholders::_4), + std::bind(&Rw11CntlRL11::RdmaPostExecCB, this, + placeholders::_1, placeholders::_2, + placeholders::_3, placeholders::_4)) { // must be here because Units have a back-ptr (not available at Rw11CntlBase) for (size_t i=0; i // Other credits: @@ -15,6 +15,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.0.7 use std::bind or lambda instead of boost // 2018-12-09 1080 1.0.6 use HasVirt(); Virt() returns ref // 2018-10-28 1062 1.0.5 replace boost/foreach // 2017-04-02 865 1.0.4 Dump(): add detail arg @@ -30,8 +31,6 @@ \brief Implemenation of Rw11CntlTM11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "librtools/RosPrintBvi.hpp" #include "librtools/RosPrintf.hpp" @@ -140,8 +139,12 @@ Rw11CntlTM11::Rw11CntlTM11() fRd_opcode(0), fBuf(), fRdma(this, - boost::bind(&Rw11CntlTM11::RdmaPreExecCB, this, _1, _2, _3, _4), - boost::bind(&Rw11CntlTM11::RdmaPostExecCB, this, _1, _2, _3, _4)) + std::bind(&Rw11CntlTM11::RdmaPreExecCB, this, + placeholders::_1, placeholders::_2, + placeholders::_3, placeholders::_4), + std::bind(&Rw11CntlTM11::RdmaPostExecCB, this, + placeholders::_1, placeholders::_2, + placeholders::_3, placeholders::_4)) { // must be here because Units have a back-ptr (not available at Rw11CntlBase) for (size_t i=0; i // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.1.3 for std::function setups: use rval ref and move +// 2018-12-15 1082 1.1.2 use lambda instead of bind // 2017-04-02 865 1.1.1 Dump(): add detail arg // 2015-02-17 647 1.1 PreExecCB with nwdone and nwnext // 2015-01-04 627 1.0 Initial version @@ -25,8 +27,6 @@ #include -#include "boost/bind.hpp" - #include "librtools/Rexception.hpp" #include "librtools/RosFill.hpp" #include "librtools/RosPrintf.hpp" @@ -47,11 +47,10 @@ namespace Retro { //------------------------------------------+----------------------------------- //! Constructor -Rw11Rdma::Rw11Rdma(Rw11Cntl* pcntl, const precb_t& precb, - const postcb_t& postcb) +Rw11Rdma::Rw11Rdma(Rw11Cntl* pcntl, precb_t&& precb, postcb_t&& postcb) : fpCntlBase(pcntl), - fPreExecCB(precb), - fPostExecCB(postcb), + fPreExecCB(move(precb)), + fPostExecCB(move(postcb)), fChunksize(0), fStatus(kStatusDone), fIsWMem(false), @@ -96,7 +95,7 @@ void Rw11Rdma::QueueRMem(uint32_t addr, uint16_t* block, size_t size, { fStats.Inc(kStatNQueRMem); SetupRdma(false, addr, block, size, mode); - Server().QueueAction(boost::bind(&Rw11Rdma::RdmaHandler, this)); + Server().QueueAction([this](){ return RdmaHandler(); }); return; } @@ -108,7 +107,7 @@ void Rw11Rdma::QueueWMem(uint32_t addr, const uint16_t* block, size_t size, { fStats.Inc(kStatNQueWMem); SetupRdma(true, addr, const_cast(block), size, mode); - Server().QueueAction(boost::bind(&Rw11Rdma::RdmaHandler, this)); + Server().QueueAction([this](){ return RdmaHandler(); }); return; } diff --git a/tools/src/librw11/Rw11Rdma.hpp b/tools/src/librw11/Rw11Rdma.hpp index ba7f3a4a..5655b4c8 100644 --- a/tools/src/librw11/Rw11Rdma.hpp +++ b/tools/src/librw11/Rw11Rdma.hpp @@ -1,6 +1,6 @@ -// $Id: Rw11Rdma.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11Rdma.hpp 1083 2018-12-15 19:19:16Z mueller $ // -// Copyright 2015-2017 by Walter F.J. Mueller +// Copyright 2015-2018 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,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.1.3 for std::function setups: use rval ref and move +// 2018-12-14 1081 1.1.2 use std::function instead of boost // 2017-04-02 865 1.1.1 Dump(): add detail arg // 2015-02-17 647 1.1 PreExecCB with nwdone and nwnext // 2015-01-04 627 1.0 Initial version @@ -27,8 +29,9 @@ #ifndef included_Retro_Rw11Rdma #define included_Retro_Rw11Rdma 1 +#include + #include "boost/utility.hpp" -#include "boost/function.hpp" #include "librtools/Rstats.hpp" #include "librtools/RerrMsg.hpp" @@ -41,13 +44,13 @@ namespace Retro { class Rw11Rdma : public Rbits, private boost::noncopyable { public: - typedef boost::function precb_t; - typedef boost::function postcb_t; + typedef std::function precb_t; + typedef std::function postcb_t; - Rw11Rdma(Rw11Cntl* pcntl, const precb_t& precb, - const postcb_t& postcb); + Rw11Rdma(Rw11Cntl* pcntl, precb_t&& precb, + postcb_t&& postcb); virtual ~Rw11Rdma(); Rw11Cntl& CntlBase() const; diff --git a/tools/src/librw11/Rw11RdmaDisk.cpp b/tools/src/librw11/Rw11RdmaDisk.cpp index 968a5229..8272248f 100644 --- a/tools/src/librw11/Rw11RdmaDisk.cpp +++ b/tools/src/librw11/Rw11RdmaDisk.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11RdmaDisk.cpp 1047 2018-09-16 11:08:41Z mueller $ +// $Id: Rw11RdmaDisk.cpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2015-2018 by Walter F.J. Mueller // @@ -42,9 +42,8 @@ namespace Retro { //------------------------------------------+----------------------------------- //! Constructor -Rw11RdmaDisk::Rw11RdmaDisk(Rw11Cntl* pcntl, const precb_t& precb, - const postcb_t& postcb) - : Rw11Rdma(pcntl, precb, postcb), +Rw11RdmaDisk::Rw11RdmaDisk(Rw11Cntl* pcntl, precb_t&& precb, postcb_t&& postcb) + : Rw11Rdma(pcntl, move(precb), move(postcb)), fBuf(), fpUnit(nullptr), fNWord(0), diff --git a/tools/src/librw11/Rw11RdmaDisk.hpp b/tools/src/librw11/Rw11RdmaDisk.hpp index e0730842..c7761f5b 100644 --- a/tools/src/librw11/Rw11RdmaDisk.hpp +++ b/tools/src/librw11/Rw11RdmaDisk.hpp @@ -1,6 +1,6 @@ -// $Id: Rw11RdmaDisk.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11RdmaDisk.hpp 1083 2018-12-15 19:19:16Z mueller $ // -// Copyright 2015-2017 by Walter F.J. Mueller +// Copyright 2015-2018 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 +// 2018-12-15 1083 1.0.2 for std::function setups: use rval ref and move // 2017-04-02 865 1.0.1 Dump(): add detail arg // 2015-01-04 627 1.0 Initial version // --------------------------------------------------------------------------- @@ -35,8 +36,8 @@ namespace Retro { class Rw11RdmaDisk : public Rw11Rdma { public: - Rw11RdmaDisk(Rw11Cntl* pcntl, const precb_t& precb, - const postcb_t& postcb); + Rw11RdmaDisk(Rw11Cntl* pcntl, precb_t&& precb, + postcb_t&& postcb); ~Rw11RdmaDisk(); void QueueDiskRead(uint32_t addr, size_t size, uint16_t mode, diff --git a/tools/src/librw11/Rw11UnitDEUNA.cpp b/tools/src/librw11/Rw11UnitDEUNA.cpp index ca23043b..c6b1b4d4 100644 --- a/tools/src/librw11/Rw11UnitDEUNA.cpp +++ b/tools/src/librw11/Rw11UnitDEUNA.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11UnitDEUNA.cpp 1080 2018-12-09 20:30:33Z mueller $ +// $Id: Rw11UnitDEUNA.cpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2014-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-14 1081 1.0.3 use std::bind instead of boost // 2018-12-09 1080 1.0.2 use HasVirt(); Virt() returns ref // 2018-12-01 1076 1.0.1 use unique_ptr // 2017-01-29 847 1.0 Initial version @@ -24,8 +25,6 @@ \brief Implemenation of Rw11UnitDEUNA. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "Rw11CntlDEUNA.hpp" @@ -73,8 +72,8 @@ void Rw11UnitDEUNA::Dump(std::ostream& os, int ind, const char* text, void Rw11UnitDEUNA::AttachDone() { - Virt().SetupRcvCallback(boost::bind(&Rw11CntlDEUNA::RcvCallback, - &Cntl(), _1)); + Virt().SetupRcvCallback(std::bind(&Rw11CntlDEUNA::RcvCallback, + &Cntl(), placeholders::_1)); Cntl().UnitSetup(0); return; } diff --git a/tools/src/librw11/Rw11UnitDL11.cpp b/tools/src/librw11/Rw11UnitDL11.cpp index 7bf04aa6..af1b69ea 100644 --- a/tools/src/librw11/Rw11UnitDL11.cpp +++ b/tools/src/librw11/Rw11UnitDL11.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11UnitDL11.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11UnitDL11.cpp 1081 2018-12-14 22:29:42Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -23,8 +23,6 @@ \brief Implemenation of Rw11UnitDL11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "Rw11CntlDL11.hpp" diff --git a/tools/src/librw11/Rw11UnitLP11.cpp b/tools/src/librw11/Rw11UnitLP11.cpp index ec0462e2..a322d791 100644 --- a/tools/src/librw11/Rw11UnitLP11.cpp +++ b/tools/src/librw11/Rw11UnitLP11.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11UnitLP11.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11UnitLP11.cpp 1081 2018-12-14 22:29:42Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -22,8 +22,6 @@ \brief Implemenation of Rw11UnitLP11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "Rw11CntlLP11.hpp" diff --git a/tools/src/librw11/Rw11UnitPC11.cpp b/tools/src/librw11/Rw11UnitPC11.cpp index c9989cee..9a0750fa 100644 --- a/tools/src/librw11/Rw11UnitPC11.cpp +++ b/tools/src/librw11/Rw11UnitPC11.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11UnitPC11.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11UnitPC11.cpp 1081 2018-12-14 22:29:42Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -22,8 +22,6 @@ \brief Implemenation of Rw11UnitPC11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "Rw11CntlPC11.hpp" diff --git a/tools/src/librw11/Rw11UnitRHRP.cpp b/tools/src/librw11/Rw11UnitRHRP.cpp index ae286e72..9e92a22f 100644 --- a/tools/src/librw11/Rw11UnitRHRP.cpp +++ b/tools/src/librw11/Rw11UnitRHRP.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11UnitRHRP.cpp 1080 2018-12-09 20:30:33Z mueller $ +// $Id: Rw11UnitRHRP.cpp 1081 2018-12-14 22:29:42Z mueller $ // // Copyright 2015-2018 by Walter F.J. Mueller // @@ -24,8 +24,6 @@ \brief Implemenation of Rw11UnitRHRP. */ -#include "boost/bind.hpp" - #include "librtools/Rexception.hpp" #include "librtools/RosFill.hpp" #include "Rw11CntlRHRP.hpp" diff --git a/tools/src/librw11/Rw11UnitRK11.cpp b/tools/src/librw11/Rw11UnitRK11.cpp index b925c847..f0ea4171 100644 --- a/tools/src/librw11/Rw11UnitRK11.cpp +++ b/tools/src/librw11/Rw11UnitRK11.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11UnitRK11.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11UnitRK11.cpp 1081 2018-12-14 22:29:42Z mueller $ // // Copyright 2013-2017 by Walter F.J. Mueller // @@ -23,8 +23,6 @@ \brief Implemenation of Rw11UnitRK11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "Rw11CntlRK11.hpp" diff --git a/tools/src/librw11/Rw11UnitRL11.cpp b/tools/src/librw11/Rw11UnitRL11.cpp index ff692118..7e762c0a 100644 --- a/tools/src/librw11/Rw11UnitRL11.cpp +++ b/tools/src/librw11/Rw11UnitRL11.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11UnitRL11.cpp 1080 2018-12-09 20:30:33Z mueller $ +// $Id: Rw11UnitRL11.cpp 1081 2018-12-14 22:29:42Z mueller $ // // Copyright 2014-2018 by Walter F.J. Mueller // @@ -24,8 +24,6 @@ \brief Implemenation of Rw11UnitRL11. */ -#include "boost/bind.hpp" - #include "librtools/Rexception.hpp" #include "librtools/RosFill.hpp" #include "Rw11CntlRL11.hpp" diff --git a/tools/src/librw11/Rw11UnitTM11.cpp b/tools/src/librw11/Rw11UnitTM11.cpp index 44275455..2fd0737c 100644 --- a/tools/src/librw11/Rw11UnitTM11.cpp +++ b/tools/src/librw11/Rw11UnitTM11.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11UnitTM11.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11UnitTM11.cpp 1081 2018-12-14 22:29:42Z mueller $ // // Copyright 2015-2017 by Walter F.J. Mueller // @@ -22,8 +22,6 @@ \brief Implemenation of Rw11UnitTM11. */ -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "Rw11CntlTM11.hpp" diff --git a/tools/src/librw11/Rw11UnitTerm.cpp b/tools/src/librw11/Rw11UnitTerm.cpp index e85a444f..745a57a3 100644 --- a/tools/src/librw11/Rw11UnitTerm.cpp +++ b/tools/src/librw11/Rw11UnitTerm.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11UnitTerm.cpp 1080 2018-12-09 20:30:33Z mueller $ +// $Id: Rw11UnitTerm.cpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-14 1081 1.1.5 use std::bind instead of boost // 2018-12-09 1080 1.1.4 use HasVirt(); Virt() returns ref // 2018-12-01 1076 1.1.3 use unique_ptr // 2017-04-07 868 1.1.2 Dump(): add detail arg @@ -28,7 +29,6 @@ */ #include "boost/thread/locks.hpp" -#include "boost/bind.hpp" #include "librtools/RparseUrl.hpp" #include "librtools/RosPrintf.hpp" @@ -294,8 +294,8 @@ void Rw11UnitTerm::Dump(std::ostream& os, int ind, const char* text, void Rw11UnitTerm::AttachDone() { - Virt().SetupRcvCallback(boost::bind(&Rw11UnitTerm::RcvCallback, - this, _1, _2)); + Virt().SetupRcvCallback(std::bind(&Rw11UnitTerm::RcvCallback, + this, placeholders::_1, placeholders::_2)); return; } diff --git a/tools/src/librw11/Rw11VirtEth.hpp b/tools/src/librw11/Rw11VirtEth.hpp index 4bb6f854..58b78796 100644 --- a/tools/src/librw11/Rw11VirtEth.hpp +++ b/tools/src/librw11/Rw11VirtEth.hpp @@ -1,4 +1,4 @@ -// $Id: Rw11VirtEth.hpp 1076 2018-12-02 12:45:49Z mueller $ +// $Id: Rw11VirtEth.hpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2014-2018 by Walter F.J. Mueller // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.1.2 SetupRcvCallback(): use rval ref and move semantics +// 2018-12-14 1081 1.1.1 use std::function instead of boost // 2018-12-02 1076 1.1 use unique_ptr for New() // 2017-04-07 868 1.0 Initial version // 2014-06-09 561 0.1 First draft @@ -28,8 +30,7 @@ #include #include - -#include "boost/function.hpp" +#include #include "RethBuf.hpp" @@ -39,14 +40,14 @@ namespace Retro { class Rw11VirtEth : public Rw11Virt { public: - typedef boost::function&)> rcvcbfo_t; + typedef std::function&)> rcvcbfo_t; explicit Rw11VirtEth(Rw11Unit* punit); ~Rw11VirtEth(); virtual const std::string& ChannelId() const; - void SetupRcvCallback(const rcvcbfo_t& rcvcbfo); + void SetupRcvCallback(rcvcbfo_t&& rcvcbfo); virtual bool Snd(const RethBuf& ebuf, RerrMsg& emsg) = 0; virtual void Dump(std::ostream& os, int ind=0, const char* text=0, diff --git a/tools/src/librw11/Rw11VirtEth.ipp b/tools/src/librw11/Rw11VirtEth.ipp index a5061d98..699f38e0 100644 --- a/tools/src/librw11/Rw11VirtEth.ipp +++ b/tools/src/librw11/Rw11VirtEth.ipp @@ -1,6 +1,6 @@ -// $Id: Rw11VirtEth.ipp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11VirtEth.ipp 1083 2018-12-15 19:19:16Z mueller $ // -// Copyright 2014-2017 by Walter F.J. Mueller +// Copyright 2014-2018 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 +// 2018-12-15 1083 1.0.1 SetupRcvCallback(): use rval ref and move semantics // 2017-01-29 847 1.0 Initial version // 2014-06-09 561 0.1 First draft // --------------------------------------------------------------------------- @@ -37,9 +38,9 @@ inline const std::string& Rw11VirtEth::ChannelId() const //------------------------------------------+----------------------------------- //! FIXME_docs -inline void Rw11VirtEth::SetupRcvCallback(const rcvcbfo_t& rcvcbfo) +inline void Rw11VirtEth::SetupRcvCallback(rcvcbfo_t&& rcvcbfo) { - fRcvCb = rcvcbfo; + fRcvCb = move(rcvcbfo); return; } diff --git a/tools/src/librw11/Rw11VirtEthTap.cpp b/tools/src/librw11/Rw11VirtEthTap.cpp index 359dae73..c2f7473a 100644 --- a/tools/src/librw11/Rw11VirtEthTap.cpp +++ b/tools/src/librw11/Rw11VirtEthTap.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11VirtEthTap.cpp 1075 2018-12-01 11:55:07Z mueller $ +// $Id: Rw11VirtEthTap.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2014-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.0.3 use lambda instead of bind // 2018-11-30 1075 1.0.2 use list-init // 2018-10-27 1059 1.0.1 coverity fixup (uncaught exception in dtor) // BUGFIX: coverity (buffer not null terminated) @@ -35,8 +36,6 @@ #include #include -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "librtools/Rtools.hpp" @@ -105,8 +104,8 @@ bool Rw11VirtEthTap::Open(const std::string& url, RerrMsg& emsg) fFd = fd; - Server().AddPollHandler(boost::bind(&Rw11VirtEthTap::RcvPollHandler, - this, _1), + Server().AddPollHandler([this](const pollfd& pfd) + { return RcvPollHandler(pfd); }, fFd, POLLIN); return true; } diff --git a/tools/src/librw11/Rw11VirtTerm.hpp b/tools/src/librw11/Rw11VirtTerm.hpp index cd287c25..61117b0b 100644 --- a/tools/src/librw11/Rw11VirtTerm.hpp +++ b/tools/src/librw11/Rw11VirtTerm.hpp @@ -1,4 +1,4 @@ -// $Id: Rw11VirtTerm.hpp 1076 2018-12-02 12:45:49Z mueller $ +// $Id: Rw11VirtTerm.hpp 1083 2018-12-15 19:19:16Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,8 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1083 1.1.2 SetupRcvCallback(): use rval ref and move semantics +// 2018-12-14 1081 1.1.1 use std::function instead of boost // 2018-12-02 1076 1.1 use unique_ptr for New() // 2017-04-07 868 1.0.1 Dump(): add detail arg // 2013-03-06 495 1.0 Initial version @@ -28,8 +30,7 @@ #define included_Retro_Rw11VirtTerm 1 #include - -#include "boost/function.hpp" +#include #include "Rw11Virt.hpp" @@ -37,14 +38,14 @@ namespace Retro { class Rw11VirtTerm : public Rw11Virt { public: - typedef boost::function rcvcbfo_t; + typedef std::function rcvcbfo_t; explicit Rw11VirtTerm(Rw11Unit* punit); ~Rw11VirtTerm(); virtual const std::string& ChannelId() const; - void SetupRcvCallback(const rcvcbfo_t& rcvcbfo); + void SetupRcvCallback(rcvcbfo_t&& rcvcbfo); virtual bool Snd(const uint8_t* data, size_t count, RerrMsg& emsg) = 0; virtual void Dump(std::ostream& os, int ind=0, const char* text=0, diff --git a/tools/src/librw11/Rw11VirtTerm.ipp b/tools/src/librw11/Rw11VirtTerm.ipp index 59c64846..7b8f314d 100644 --- a/tools/src/librw11/Rw11VirtTerm.ipp +++ b/tools/src/librw11/Rw11VirtTerm.ipp @@ -1,6 +1,6 @@ -// $Id: Rw11VirtTerm.ipp 983 2018-01-02 20:35:59Z mueller $ +// $Id: Rw11VirtTerm.ipp 1083 2018-12-15 19:19:16Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2018 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 +// 2018-12-15 1083 1.0.1 SetupRcvCallback(): use rval ref and move semantics // 2013-03-06 495 1.0 Initial version // 2013-02-19 490 0.1 First draft // --------------------------------------------------------------------------- @@ -37,9 +38,9 @@ inline const std::string& Rw11VirtTerm::ChannelId() const //------------------------------------------+----------------------------------- //! FIXME_docs -inline void Rw11VirtTerm::SetupRcvCallback(const rcvcbfo_t& rcvcbfo) +inline void Rw11VirtTerm::SetupRcvCallback(rcvcbfo_t&& rcvcbfo) { - fRcvCb = rcvcbfo; + fRcvCb = move(rcvcbfo); return; } diff --git a/tools/src/librw11/Rw11VirtTermPty.cpp b/tools/src/librw11/Rw11VirtTermPty.cpp index 26e8e759..3b1965d9 100644 --- a/tools/src/librw11/Rw11VirtTermPty.cpp +++ b/tools/src/librw11/Rw11VirtTermPty.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11VirtTermPty.cpp 1059 2018-10-27 10:34:16Z mueller $ +// $Id: Rw11VirtTermPty.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.0.4 use lambda instead of bind // 2018-10-27 1059 1.0.3 coverity fixup (uncaught exception in dtor) // 2017-04-15 875 1.0.2 Open(): set default scheme // 2017-04-07 868 1.0.1 Dump(): add detail arg @@ -31,8 +32,6 @@ #include #include -#include "boost/bind.hpp" - #include "librtools/RosFill.hpp" #include "Rw11VirtTermPty.hpp" @@ -103,8 +102,8 @@ bool Rw11VirtTermPty::Open(const std::string& url, RerrMsg& emsg) fFd = fd; fChannelId = pname; - Server().AddPollHandler(boost::bind(&Rw11VirtTermPty::RcvPollHandler, - this, _1), + Server().AddPollHandler([this](const pollfd& pfd) + { return RcvPollHandler(pfd); }, fFd, POLLIN); return true; diff --git a/tools/src/librw11/Rw11VirtTermTcp.cpp b/tools/src/librw11/Rw11VirtTermTcp.cpp index 5236663b..6eca8bfe 100644 --- a/tools/src/librw11/Rw11VirtTermTcp.cpp +++ b/tools/src/librw11/Rw11VirtTermTcp.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11VirtTermTcp.cpp 1075 2018-12-01 11:55:07Z mueller $ +// $Id: Rw11VirtTermTcp.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.0.10 use lambda instead of bind // 2018-11-30 1075 1.0.9 use list-init // 2018-11-11 1066 1.0.8 coverity fixup (unchecked return value) // 2018-10-27 1059 1.0.7 coverity fixup (uncaught exception in dtor) @@ -182,8 +183,8 @@ bool Rw11VirtTermTcp::Open(const std::string& url, RerrMsg& emsg) lmsg << "TermTcp: listen on " << fChannelId << " for " << Unit().Name(); } - Server().AddPollHandler(boost::bind(&Rw11VirtTermTcp::ListenPollHandler, - this, _1), + Server().AddPollHandler([this](const pollfd& pfd) + { return ListenPollHandler(pfd); }, fFdListen, POLLIN); return true; @@ -339,8 +340,8 @@ int Rw11VirtTermTcp::ListenPollHandler(const pollfd& pfd) fState = ts_Stream; Server().RemovePollHandler(fFdListen); - Server().AddPollHandler(boost::bind(&Rw11VirtTermTcp::RcvPollHandler, - this, _1), + Server().AddPollHandler([this](const pollfd& pfd) + { return RcvPollHandler(pfd); }, fFd, POLLIN); return 0; } @@ -426,8 +427,8 @@ int Rw11VirtTermTcp::RcvPollHandler(const pollfd& pfd) } close(fFd); fFd = -1; - Server().AddPollHandler(boost::bind(&Rw11VirtTermTcp::ListenPollHandler, - this, _1), + Server().AddPollHandler([this](const pollfd& pfd) + { return ListenPollHandler(pfd); }, fFdListen, POLLIN); fState = ts_Listen; return -1; diff --git a/tools/src/librwxxtpp/RtclRw11.cpp b/tools/src/librwxxtpp/RtclRw11.cpp index 31125fc5..b64b4ec6 100644 --- a/tools/src/librwxxtpp/RtclRw11.cpp +++ b/tools/src/librwxxtpp/RtclRw11.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclRw11.cpp 1082 2018-12-15 13:56:20Z mueller $ // -// Copyright 2013-2017 by Walter F.J. Mueller +// Copyright 2013-2018 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 +// 2018-12-15 1082 1.0.5 use lambda instead of bind // 2017-04-16 876 1.0.4 add CpuCommands() // 2017-04-07 868 1.0.3 M_dump: use GetArgsDump and Dump detail // 2017-04-02 866 1.0.2 add M_set; handle default disk scheme @@ -32,8 +33,6 @@ #include #include -#include "boost/bind.hpp" - #include "librtools/RosPrintf.hpp" #include "librtcltools/RtclContext.hpp" #include "librlinktpp/RtclRlinkServer.hpp" @@ -63,21 +62,22 @@ RtclRw11::RtclRw11(Tcl_Interp* interp, const char* name) fGets(), fSets() { - AddMeth("get", boost::bind(&RtclRw11::M_get, this, _1)); - AddMeth("set", boost::bind(&RtclRw11::M_set, this, _1)); - AddMeth("start", boost::bind(&RtclRw11::M_start, this, _1)); - AddMeth("dump", boost::bind(&RtclRw11::M_dump, this, _1)); - AddMeth("$default", boost::bind(&RtclRw11::M_default, this, _1)); + AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); + AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); + AddMeth("start", [this](RtclArgs& args){ return M_start(args); }); + AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); + AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); Rw11* pobj = &Obj(); - fGets.Add ("started",boost::bind(&Rw11::IsStarted, pobj)); - fGets.Add ("diskscheme", - boost::bind(&Rw11VirtDisk::DefaultScheme)); + fGets.Add ("started", [pobj](){ return pobj->IsStarted(); }); + fGets.Add ("diskscheme", + [](){ return Rw11VirtDisk::DefaultScheme(); }); + fGets.Add ("cpus", [this](){ return CpuCommands(); }); - fSets.Add ("diskscheme", - boost::bind(&Rw11VirtDisk::SetDefaultScheme, _1)); - fGets.Add ("cpus", - boost::bind(&RtclRw11::CpuCommands, this)); + fSets.Add ("diskscheme", + [](const string& v) + { Rw11VirtDisk::SetDefaultScheme(v);} ); + } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11.hpp b/tools/src/librwxxtpp/RtclRw11.hpp index 2065b10e..997208c1 100644 --- a/tools/src/librwxxtpp/RtclRw11.hpp +++ b/tools/src/librwxxtpp/RtclRw11.hpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11.hpp 1078 2018-12-08 14:19:03Z mueller $ +// $Id: RtclRw11.hpp 1081 2018-12-14 22:29:42Z mueller $ // -// Copyright 2013-2017 by Walter F.J. Mueller +// Copyright 2013-2018 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 +// 2018-12-07 1078 1.1 use std::shared_ptr instead of boost // 2017-04-16 876 1.0.3 add CpuCommands() // 2017-04-02 866 1.0.2 add M_set // 2015-03-28 660 1.0.1 add M_get diff --git a/tools/src/librwxxtpp/RtclRw11Cntl.cpp b/tools/src/librwxxtpp/RtclRw11Cntl.cpp index 80435d27..a3e2f1dc 100644 --- a/tools/src/librwxxtpp/RtclRw11Cntl.cpp +++ b/tools/src/librwxxtpp/RtclRw11Cntl.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11Cntl.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclRw11Cntl.cpp 1082 2018-12-15 13:56:20Z mueller $ // -// Copyright 2013-2017 by Walter F.J. Mueller +// Copyright 2013-2018 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 +// 2018-12-15 1082 1.1.3 use lambda instead of bind // 2017-04-16 877 1.1.2 add UnitCommands(); add Class() // 2017-04-02 865 1.0.2 M_dump: use GetArgsDump and Dump detail // 2015-03-27 660 1.0.1 add M_start @@ -26,7 +27,6 @@ */ #include "boost/thread/locks.hpp" -#include "boost/bind.hpp" #include "librtcltools/RtclStats.hpp" #include "librtcltools/RtclOPtr.hpp" @@ -53,18 +53,16 @@ RtclRw11Cntl::RtclRw11Cntl(const std::string& type, fGets(), fSets() { - AddMeth("get", boost::bind(&RtclRw11Cntl::M_get, this, _1)); - AddMeth("set", boost::bind(&RtclRw11Cntl::M_set, this, _1)); - AddMeth("probe", boost::bind(&RtclRw11Cntl::M_probe, this, _1)); - AddMeth("start", boost::bind(&RtclRw11Cntl::M_start, this, _1)); - AddMeth("stats", boost::bind(&RtclRw11Cntl::M_stats, this, _1)); - AddMeth("dump", boost::bind(&RtclRw11Cntl::M_dump, this, _1)); - AddMeth("$default", boost::bind(&RtclRw11Cntl::M_default, this, _1)); + AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); + AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); + AddMeth("probe", [this](RtclArgs& args){ return M_probe(args); }); + AddMeth("start", [this](RtclArgs& args){ return M_start(args); }); + AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); + AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); + AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); - fGets.Add ("units", - boost::bind(&RtclRw11Cntl::UnitCommands, this)); - fGets.Add ("class", - boost::bind(&RtclRw11Cntl::Class, this)); + fGets.Add ("units", [this](){ return UnitCommands(); }); + fGets.Add ("class", [this](){ return Class(); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11CntlBase.ipp b/tools/src/librwxxtpp/RtclRw11CntlBase.ipp index 8cd06f69..da876645 100644 --- a/tools/src/librwxxtpp/RtclRw11CntlBase.ipp +++ b/tools/src/librwxxtpp/RtclRw11CntlBase.ipp @@ -1,4 +1,4 @@ -// $Id: RtclRw11CntlBase.ipp 1078 2018-12-08 14:19:03Z mueller $ +// $Id: RtclRw11CntlBase.ipp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.2.2 use lambda instead of bind // 2018-12-07 1078 1.2.1 use std::shared_ptr instead of boost // 2017-04-16 877 1.2 add class in ctor // 2017-02-04 848 1.1 add in fGets: found,pdataint,pdatarem @@ -45,22 +46,22 @@ inline RtclRw11CntlBase::RtclRw11CntlBase(const std::string& type, : RtclRw11Cntl(type,cclass), fspObj(new TC()) { - AddMeth("bootcode", boost::bind(&RtclRw11CntlBase::M_bootcode,this, _1)); + AddMeth("bootcode", [this](RtclArgs& args){ return M_bootcode(args); }); TC* pobj = fspObj.get(); - fGets.Add("type", boost::bind(&TC::Type, pobj)); - fGets.Add("name", boost::bind(&TC::Name, pobj)); - fGets.Add ("base", boost::bind(&TC::Base, pobj)); - fGets.Add ("lam", boost::bind(&TC::Lam, pobj)); - fGets.Add ("found", boost::bind(&TC::ProbeFound, pobj)); - fGets.Add ("pdataint", boost::bind(&TC::ProbeDataInt, pobj)); - fGets.Add ("pdatarem", boost::bind(&TC::ProbeDataRem, pobj)); - fGets.Add ("enable",boost::bind(&TC::Enable, pobj)); - fGets.Add ("started",boost::bind(&TC::IsStarted, pobj)); - fGets.Add ("trace", boost::bind(&TC::TraceLevel,pobj)); - - fSets.Add ("enable", boost::bind(&TC::SetEnable,pobj,_1)); - fSets.Add ("trace", boost::bind(&TC::SetTraceLevel,pobj,_1)); + fGets.Add("type", [pobj](){ return pobj->Type(); }); + fGets.Add("name", [pobj](){ return pobj->Name(); }); + fGets.Add ("base", [pobj](){ return pobj->Base(); }); + fGets.Add ("lam", [pobj](){ return pobj->Lam(); }); + fGets.Add ("found", [pobj](){ return pobj->ProbeFound(); }); + fGets.Add ("pdataint", [pobj](){ return pobj->ProbeDataInt(); }); + fGets.Add ("pdatarem", [pobj](){ return pobj->ProbeDataRem(); }); + fGets.Add ("enable", [pobj](){ return pobj->Enable(); }); + fGets.Add ("started", [pobj](){ return pobj->IsStarted(); }); + fGets.Add ("trace", [pobj](){ return pobj->TraceLevel(); }); + + fSets.Add ("enable", [pobj](bool v){ pobj->SetEnable(v); }); + fSets.Add ("trace", [pobj](uint32_t v){ pobj->SetTraceLevel(v); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11CntlDEUNA.cpp b/tools/src/librwxxtpp/RtclRw11CntlDEUNA.cpp index db52d572..87c4b1a9 100644 --- a/tools/src/librwxxtpp/RtclRw11CntlDEUNA.cpp +++ b/tools/src/librwxxtpp/RtclRw11CntlDEUNA.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11CntlDEUNA.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclRw11CntlDEUNA.cpp 1082 2018-12-15 13:56:20Z mueller $ // -// Copyright 2014-2017 by Walter F.J. Mueller +// Copyright 2014-2018 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 +// 2018-12-15 1082 1.0.1 use lambda instead of bind // 2017-04-16 878 1.0 Initial version // 2014-06-09 561 0.1 First draft // --------------------------------------------------------------------------- @@ -46,23 +47,19 @@ RtclRw11CntlDEUNA::RtclRw11CntlDEUNA() : RtclRw11CntlBase("Rw11CntlDEUNA","ether") { Rw11CntlDEUNA* pobj = &Obj(); - fGets.Add ("dpa", - boost::bind(&Rw11CntlDEUNA::MacDefault, pobj)); - fGets.Add ("rxpoll", - boost::bind(&Rw11CntlDEUNA::RxPollTime, pobj)); - fGets.Add ("rxqlim", - boost::bind(&Rw11CntlDEUNA::RxQueLimit, pobj)); - fGets.Add ("run", - boost::bind(&Rw11CntlDEUNA::Running, pobj)); + fGets.Add ("dpa", [pobj](){ return pobj->MacDefault(); }); + fGets.Add ("rxpoll", [pobj](){ return pobj->RxPollTime(); }); + fGets.Add ("rxqlim", [pobj](){ return pobj->RxQueLimit(); }); + fGets.Add ("run", [pobj](){ return pobj->Running(); }); fSets.Add ("type", - boost::bind(&Rw11CntlDEUNA::SetType,pobj, _1)); + [pobj](const string& v){ pobj->SetType(v); }); fSets.Add ("dpa", - boost::bind(&Rw11CntlDEUNA::SetMacDefault,pobj, _1)); + [pobj](const string& v){ pobj->SetMacDefault(v); }); fSets.Add ("rxpoll", - boost::bind(&Rw11CntlDEUNA::SetRxPollTime,pobj, _1)); + [pobj](const Rtime& v){ pobj->SetRxPollTime(v); }); fSets.Add ("rxqlim", - boost::bind(&Rw11CntlDEUNA::SetRxQueLimit,pobj, _1)); + [pobj](size_t v){ pobj->SetRxQueLimit(v); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11CntlDL11.cpp b/tools/src/librwxxtpp/RtclRw11CntlDL11.cpp index 252591e4..1601e8d6 100644 --- a/tools/src/librwxxtpp/RtclRw11CntlDL11.cpp +++ b/tools/src/librwxxtpp/RtclRw11CntlDL11.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11CntlDL11.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclRw11CntlDL11.cpp 1082 2018-12-15 13:56:20Z mueller $ // -// Copyright 2013-2017 by Walter F.J. Mueller +// Copyright 2013-2018 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 +// 2018-12-15 1082 1.1.1 use lambda instead of bind // 2017-04-16 878 1.1 add class in ctor; derive from RtclRw11CntlTermBase // 2013-05-04 516 1.0.1 add RxRlim support (receive interrupt rate limit) // 2013-03-06 495 1.0 Initial version @@ -46,10 +47,8 @@ RtclRw11CntlDL11::RtclRw11CntlDL11() : RtclRw11CntlTermBase("Rw11CntlDL11","term") { Rw11CntlDL11* pobj = &Obj(); - fGets.Add ("rxrlim", - boost::bind(&Rw11CntlDL11::RxRlim, pobj)); - fSets.Add ("rxrlim", - boost::bind(&Rw11CntlDL11::SetRxRlim,pobj, _1)); + fGets.Add ("rxrlim", [pobj](){ return pobj->RxRlim(); }); + fSets.Add ("rxrlim", [pobj](uint16_t v){ pobj->SetRxRlim(v); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11CntlRdmaBase.ipp b/tools/src/librwxxtpp/RtclRw11CntlRdmaBase.ipp index c07119b1..2d528f58 100644 --- a/tools/src/librwxxtpp/RtclRw11CntlRdmaBase.ipp +++ b/tools/src/librwxxtpp/RtclRw11CntlRdmaBase.ipp @@ -1,6 +1,6 @@ -// $Id: RtclRw11CntlRdmaBase.ipp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclRw11CntlRdmaBase.ipp 1082 2018-12-15 13:56:20Z mueller $ // -// Copyright 2017- by Walter F.J. Mueller +// Copyright 2017-2018 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 +// 2018-12-15 1082 1.2.1 use lambda instead of bind // 2017-04-16 877 1.2 add class in ctor // 2017-02-04 848 1.1 add in fGets: found,pdataint,pdatarem // 2013-03-06 495 1.0 Initial version @@ -46,10 +47,8 @@ inline RtclRw11CntlRdmaBase::RtclRw11CntlRdmaBase(const std::string& type, TC* pobj = &this->Obj(); RtclGetList& gets = this->fGets; RtclSetList& sets = this->fSets; - gets.Add ("chunksize", - boost::bind(&TC::ChunkSize, pobj)); - sets.Add ("chunksize", - boost::bind(&TC::SetChunkSize, pobj, _1)); + gets.Add ("chunksize", [pobj](){ return pobj->ChunkSize(); }); + sets.Add ("chunksize", [pobj](size_t v){ pobj->SetChunkSize(v); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11Cpu.cpp b/tools/src/librwxxtpp/RtclRw11Cpu.cpp index c9f3b67c..ee258b70 100644 --- a/tools/src/librwxxtpp/RtclRw11Cpu.cpp +++ b/tools/src/librwxxtpp/RtclRw11Cpu.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11Cpu.cpp 1077 2018-12-07 19:37:03Z mueller $ +// $Id: RtclRw11Cpu.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.2.21 use lambda instead of bind // 2018-12-07 1077 1.2.20 use SetLastExpectBlock move semantics // 2018-11-16 1070 1.2.19 use auto; use emplace_back; use range loop // 2018-09-23 1050 1.2.18 add HasPcnt() @@ -63,7 +64,6 @@ #include #include -#include "boost/bind.hpp" #include "boost/thread/locks.hpp" #include "librtools/RerrMsg.hpp" @@ -103,26 +103,25 @@ RtclRw11Cpu::RtclRw11Cpu(const std::string& type) fGets(), fSets() { - AddMeth("add", boost::bind(&RtclRw11Cpu::M_add, this, _1)); - AddMeth("imap", boost::bind(&RtclRw11Cpu::M_imap, this, _1)); - AddMeth("rmap", boost::bind(&RtclRw11Cpu::M_rmap, this, _1)); - AddMeth("cp", boost::bind(&RtclRw11Cpu::M_cp, this, _1)); - AddMeth("wtcpu", boost::bind(&RtclRw11Cpu::M_wtcpu, this, _1)); - AddMeth("deposit", boost::bind(&RtclRw11Cpu::M_deposit, this, _1)); - AddMeth("examine", boost::bind(&RtclRw11Cpu::M_examine, this, _1)); - AddMeth("lsmem", boost::bind(&RtclRw11Cpu::M_lsmem, this, _1)); - AddMeth("ldabs", boost::bind(&RtclRw11Cpu::M_ldabs, this, _1)); - AddMeth("ldasm", boost::bind(&RtclRw11Cpu::M_ldasm, this, _1)); - AddMeth("boot", boost::bind(&RtclRw11Cpu::M_boot, this, _1)); - AddMeth("get", boost::bind(&RtclRw11Cpu::M_get, this, _1)); - AddMeth("set", boost::bind(&RtclRw11Cpu::M_set, this, _1)); - AddMeth("stats", boost::bind(&RtclRw11Cpu::M_stats, this, _1)); - AddMeth("show", boost::bind(&RtclRw11Cpu::M_show, this, _1)); - AddMeth("dump", boost::bind(&RtclRw11Cpu::M_dump, this, _1)); - AddMeth("$default", boost::bind(&RtclRw11Cpu::M_default, this, _1)); + AddMeth("add", [this](RtclArgs& args){ return M_add(args); }); + AddMeth("imap", [this](RtclArgs& args){ return M_imap(args); }); + AddMeth("rmap", [this](RtclArgs& args){ return M_rmap(args); }); + AddMeth("cp", [this](RtclArgs& args){ return M_cp(args); }); + AddMeth("wtcpu", [this](RtclArgs& args){ return M_wtcpu(args); }); + AddMeth("deposit", [this](RtclArgs& args){ return M_deposit(args); }); + AddMeth("examine", [this](RtclArgs& args){ return M_examine(args); }); + AddMeth("lsmem", [this](RtclArgs& args){ return M_lsmem(args); }); + AddMeth("ldabs", [this](RtclArgs& args){ return M_ldabs(args); }); + AddMeth("ldasm", [this](RtclArgs& args){ return M_ldasm(args); }); + AddMeth("boot", [this](RtclArgs& args){ return M_boot(args); }); + AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); + AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); + AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); + AddMeth("show", [this](RtclArgs& args){ return M_show(args); }); + AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); + AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); - fGets.Add ("cntls", - boost::bind(&RtclRw11Cpu::ControllerCommands, this)); + fGets.Add ("cntls", [this](){ return ControllerCommands(); }); } //------------------------------------------+----------------------------------- @@ -1480,18 +1479,18 @@ int RtclRw11Cpu::M_default(RtclArgs& args) void RtclRw11Cpu::SetupGetSet() { Rw11Cpu* pobj = &Obj(); - fGets.Add("type", boost::bind(&Rw11Cpu::Type, pobj)); - fGets.Add ("index", boost::bind(&Rw11Cpu::Index, pobj)); - fGets.Add ("base", boost::bind(&Rw11Cpu::Base, pobj)); - fGets.Add ("ibase", boost::bind(&Rw11Cpu::IBase, pobj)); - fGets.Add ("hasscnt", boost::bind(&Rw11Cpu::HasScnt, pobj)); - fGets.Add ("haspcnt", boost::bind(&Rw11Cpu::HasPcnt, pobj)); - fGets.Add ("hascmon", boost::bind(&Rw11Cpu::HasCmon, pobj)); - fGets.Add ("hashbpt", boost::bind(&Rw11Cpu::HasHbpt, pobj)); - fGets.Add ("hasibmon", boost::bind(&Rw11Cpu::HasIbmon, pobj)); - fGets.Add ("haskw11l", boost::bind(&Rw11Cpu::HasKw11l, pobj)); - fGets.Add ("haskw11p", boost::bind(&Rw11Cpu::HasKw11p, pobj)); - fGets.Add ("hasiist", boost::bind(&Rw11Cpu::HasIist, pobj)); + fGets.Add("type", [pobj](){ return pobj->Type(); }); + fGets.Add ("index", [pobj](){ return pobj->Index(); }); + fGets.Add ("base", [pobj](){ return pobj->Base(); }); + fGets.Add ("ibase", [pobj](){ return pobj->IBase(); }); + fGets.Add ("hasscnt", [pobj](){ return pobj->HasScnt(); }); + fGets.Add ("haspcnt", [pobj](){ return pobj->HasPcnt(); }); + fGets.Add ("hascmon", [pobj](){ return pobj->HasCmon(); }); + fGets.Add ("hashbpt", [pobj](){ return pobj->HasHbpt(); }); + fGets.Add ("hasibmon", [pobj](){ return pobj->HasIbmon(); }); + fGets.Add ("haskw11l", [pobj](){ return pobj->HasKw11l(); }); + fGets.Add ("haskw11p", [pobj](){ return pobj->HasKw11p(); }); + fGets.Add ("hasiist", [pobj](){ return pobj->HasIist(); }); return; } diff --git a/tools/src/librwxxtpp/RtclRw11Unit.cpp b/tools/src/librwxxtpp/RtclRw11Unit.cpp index d7d2cbdb..d76b4ef2 100644 --- a/tools/src/librwxxtpp/RtclRw11Unit.cpp +++ b/tools/src/librwxxtpp/RtclRw11Unit.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11Unit.cpp 1076 2018-12-02 12:45:49Z mueller $ +// $Id: RtclRw11Unit.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.3.1 use lambda instead of bind // 2018-12-01 1076 1.3 use unique_ptr instead of scoped_ptr // 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 @@ -27,7 +28,6 @@ */ #include "boost/thread/locks.hpp" -#include "boost/bind.hpp" #include "librtools/Rexception.hpp" #include "librtcltools/RtclStats.hpp" @@ -53,12 +53,12 @@ RtclRw11Unit::RtclRw11Unit(const std::string& type) fSets(), fupVirt() { - AddMeth("get", boost::bind(&RtclRw11Unit::M_get, this, _1)); - AddMeth("set", boost::bind(&RtclRw11Unit::M_set, this, _1)); - AddMeth("attach", boost::bind(&RtclRw11Unit::M_attach, this, _1)); - AddMeth("detach", boost::bind(&RtclRw11Unit::M_detach, this, _1)); - AddMeth("dump", boost::bind(&RtclRw11Unit::M_dump, this, _1)); - AddMeth("$default", boost::bind(&RtclRw11Unit::M_default, this, _1)); + AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); + AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); + AddMeth("attach", [this](RtclArgs& args){ return M_attach(args); }); + AddMeth("detach", [this](RtclArgs& args){ return M_detach(args); }); + AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); + AddMeth("$default", [this](RtclArgs& args){ return M_default(args); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11UnitBase.ipp b/tools/src/librwxxtpp/RtclRw11UnitBase.ipp index 8b59abcb..efad75a0 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitBase.ipp +++ b/tools/src/librwxxtpp/RtclRw11UnitBase.ipp @@ -1,4 +1,4 @@ -// $Id: RtclRw11UnitBase.ipp 1080 2018-12-09 20:30:33Z mueller $ +// $Id: RtclRw11UnitBase.ipp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.3.5 use lambda instead of bind // 2018-12-09 1080 1.3.4 use HasVirt(); Virt() returns ref // 2018-12-07 1078 1.3.3 use std::shared_ptr instead of boost // 2018-12-01 1076 1.3.2 use unique_ptr @@ -61,8 +62,8 @@ inline RtclRw11UnitBase::RtclRw11UnitBase(const std::string& type, : TB(type), fspObj(spunit) { - this->AddMeth("stats", boost::bind(&RtclRw11UnitBase::M_stats, - this, _1)); + this->AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); + TU* pobj = fspObj.get(); // the following construction is neccessary because the base class is a @@ -72,11 +73,13 @@ inline RtclRw11UnitBase::RtclRw11UnitBase(const std::string& type, // 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)); - gets.Add ("attached", boost::bind(&TU::IsAttached, pobj)); - gets.Add ("attachurl",boost::bind(&TU::AttachUrl,pobj)); + gets.Add ("index", [pobj](){ return pobj->Index(); }); + gets.Add ("name", [pobj](){ return pobj->Name(); }); + gets.Add ("enabled", [pobj](){ return pobj->Enabled(); }); + gets.Add ("attached", + [pobj](){ return pobj->IsAttached(); }); + gets.Add ("attachurl", + [pobj](){ return pobj->AttachUrl(); }); } //------------------------------------------+----------------------------------- @@ -132,7 +135,7 @@ void RtclRw11UnitBase::AttachDone() std::unique_ptr pvirt(RtclRw11VirtFactory(&Obj().Virt())); if (!pvirt) return; this->fupVirt = move(pvirt); - this->AddMeth("virt", boost::bind(&RtclRw11Unit::M_virt, this, _1)); + this->AddMeth("virt", [this](RtclArgs& args){ return this->M_virt(args); }); return; } diff --git a/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp b/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp index 544d4081..1a4d6c15 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11UnitDisk.cpp 1053 2018-10-06 20:34:52Z mueller $ +// $Id: RtclRw11UnitDisk.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.2.2 use lambda instead of bind // 2018-10-06 1053 1.2.1 move using after includes (clang warning) // 2017-04-08 870 1.2 use Rw11UnitDisk& ObjUV(); inherit from RtclRw11Unit // 2015-05-14 680 1.1.1 fGets: remove enabled, now in RtclRw11UnitBase @@ -62,23 +63,16 @@ void RtclRw11UnitDisk::SetupGetSet() 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)); + fGets.Add ("type", [pobj](){ return pobj->Type(); }); + fGets.Add ("ncylinder", [pobj](){ return pobj->NCylinder(); }); + fGets.Add ("nhead", [pobj](){ return pobj->NHead(); }); + fGets.Add ("nsector", [pobj](){ return pobj->NSector(); }); + fGets.Add ("blocksize", [pobj](){ return pobj->BlockSize(); }); + fGets.Add ("nblock", [pobj](){ return pobj->NBlock(); }); + fGets.Add ("wprot", [pobj](){ return pobj->WProt(); }); fSets.Add ("type", - boost::bind(&Rw11UnitDisk::SetType,pobj, _1)); + [pobj](const string& v){ pobj->SetType(v); }); return; } diff --git a/tools/src/librwxxtpp/RtclRw11UnitStream.cpp b/tools/src/librwxxtpp/RtclRw11UnitStream.cpp index 92c746de..502565aa 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitStream.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitStream.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11UnitStream.cpp 1053 2018-10-06 20:34:52Z mueller $ +// $Id: RtclRw11UnitStream.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.1.2 use lambda instead of bind // 2018-10-06 1053 1.1.1 move using after includes (clang warning) // 2017-04-08 870 1.1 use Rw11UnitStream& ObjUV(); inh from RtclRw11Unit // 2013-05-01 513 1.0 Initial version @@ -60,11 +61,9 @@ void RtclRw11UnitStream::SetupGetSet() Rw11UnitStream* pobj = &ObjUV(); - fGets.Add ("pos", - boost::bind(&Rw11UnitStream::Pos, pobj)); + fGets.Add ("pos", [pobj](){ return pobj->Pos(); }); - fSets.Add ("pos", - boost::bind(&Rw11UnitStream::SetPos,pobj, _1)); + fSets.Add ("pos", [pobj](int v){ pobj->SetPos(v); }); return; } } // end namespace Retro diff --git a/tools/src/librwxxtpp/RtclRw11UnitTape.cpp b/tools/src/librwxxtpp/RtclRw11UnitTape.cpp index e47face8..981d3bb6 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitTape.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitTape.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11UnitTape.cpp 1053 2018-10-06 20:34:52Z mueller $ +// $Id: RtclRw11UnitTape.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2015-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.1.2 use lambda instead of bind // 2018-10-06 1053 1.1.1 move using after includes (clang warning) // 2017-04-08 870 1.1 use Rw11UnitTape& ObjUV(); inherit from RtclRw11Unit // 2015-06-04 686 1.0 Initial version @@ -60,33 +61,25 @@ void RtclRw11UnitTape::SetupGetSet() 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)); + fGets.Add ("type", [pobj](){ return pobj->Type(); }); + fGets.Add ("wprot", [pobj](){ return pobj->WProt(); }); + fGets.Add ("capacity", [pobj](){ return pobj->Capacity(); }); + fGets.Add ("bot", [pobj](){ return pobj->Bot(); }); + fGets.Add ("eot", [pobj](){ return pobj->Eot(); }); + fGets.Add ("eom", [pobj](){ return pobj->Eom(); }); + fGets.Add ("posfile", [pobj](){ return pobj->PosFile(); }); + fGets.Add ("posrecord", [pobj](){ return pobj->PosRecord(); }); fSets.Add ("type", - boost::bind(&Rw11UnitTape::SetType,pobj, _1)); + [pobj](const string& v){ pobj->SetType(v); }); fSets.Add ("wprot", - boost::bind(&Rw11UnitTape::SetWProt,pobj, _1)); + [pobj](bool v){ pobj->SetWProt(v); }); fSets.Add ("capacity", - boost::bind(&Rw11UnitTape::SetCapacity,pobj, _1)); + [pobj](size_t v){ pobj->SetCapacity(v); }); fSets.Add ("posfile", - boost::bind(&Rw11UnitTape::SetPosFile,pobj, _1)); + [pobj](int v){ pobj->SetPosFile(v); }); fSets.Add ("posrecord", - boost::bind(&Rw11UnitTape::SetPosRecord,pobj, _1)); + [pobj](int v){ pobj->SetPosRecord(v); }); return; } diff --git a/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp b/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp index 58248e1b..11eb3f53 100644 --- a/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp +++ b/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11UnitTerm.cpp 1053 2018-10-06 20:34:52Z mueller $ +// $Id: RtclRw11UnitTerm.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.1.2 use lambda instead of bind // 2018-10-06 1053 1.1.1 move using after includes (clang warning) // 2017-04-08 870 1.1 use Rw11UnitTerm& ObjUV(); inherit from RtclRw11Unit // 2013-04-26 511 1.0.1 add M_type @@ -43,7 +44,7 @@ namespace Retro { RtclRw11UnitTerm::RtclRw11UnitTerm(const std::string& type) : RtclRw11Unit(type) { - AddMeth("type", boost::bind(&RtclRw11UnitTerm::M_type, this, _1)); + AddMeth("type", [this](RtclArgs& args){ return M_type(args); }); } //------------------------------------------+----------------------------------- @@ -77,25 +78,17 @@ void RtclRw11UnitTerm::SetupGetSet() 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)); + fGets.Add ("channelid", [pobj](){ return pobj->ChannelId(); }); + fGets.Add ("to7bit", [pobj](){ return pobj->To7bit(); }); + fGets.Add ("toenpc", [pobj](){ return pobj->ToEnpc(); }); + fGets.Add ("ti7bit", [pobj](){ return pobj->Ti7bit(); }); + fGets.Add ("log", [pobj](){ return pobj->Log(); }); - 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)); + fSets.Add ("to7bit", [pobj](bool v){ pobj->SetTo7bit(v); }); + fSets.Add ("toenpc", [pobj](bool v){ pobj->SetToEnpc(v); }); + fSets.Add ("ti7bit", [pobj](bool v){ pobj->SetTi7bit(v); }); + fSets.Add ("log", + [pobj](const string& v){ pobj->SetLog(v); }); return; } diff --git a/tools/src/librwxxtpp/RtclRw11Virt.cpp b/tools/src/librwxxtpp/RtclRw11Virt.cpp index 97a98f67..d787777a 100644 --- a/tools/src/librwxxtpp/RtclRw11Virt.cpp +++ b/tools/src/librwxxtpp/RtclRw11Virt.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11Virt.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclRw11Virt.cpp 1082 2018-12-15 13:56:20Z mueller $ // -// Copyright 2017- by Walter F.J. Mueller +// Copyright 2017-2018 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 +// 2018-12-15 1082 1.0.2 use lambda instead of bind // 2017-04-07 868 1.0.1 M_dump: use GetArgsDump and Dump detail // 2017-03-11 859 1.0 Initial version // --------------------------------------------------------------------------- @@ -46,10 +47,10 @@ RtclRw11Virt::RtclRw11Virt(Rw11Virt* pvirt) fGets(), fSets() { - AddMeth("get", boost::bind(&RtclRw11Virt::M_get, this, _1)); - AddMeth("set", boost::bind(&RtclRw11Virt::M_set, this, _1)); - AddMeth("stats", boost::bind(&RtclRw11Virt::M_stats, this, _1)); - AddMeth("dump", boost::bind(&RtclRw11Virt::M_dump, this, _1)); + AddMeth("get", [this](RtclArgs& args){ return M_get(args); }); + AddMeth("set", [this](RtclArgs& args){ return M_set(args); }); + AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); }); + AddMeth("dump", [this](RtclArgs& args){ return M_dump(args); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11VirtDiskOver.cpp b/tools/src/librwxxtpp/RtclRw11VirtDiskOver.cpp index b5f7e4ff..6b4e98cb 100644 --- a/tools/src/librwxxtpp/RtclRw11VirtDiskOver.cpp +++ b/tools/src/librwxxtpp/RtclRw11VirtDiskOver.cpp @@ -1,6 +1,6 @@ -// $Id: RtclRw11VirtDiskOver.cpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RtclRw11VirtDiskOver.cpp 1082 2018-12-15 13:56:20Z mueller $ // -// Copyright 2013- by Walter F.J. Mueller +// Copyright 2013-2018 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 +// 2018-12-15 1082 1.0.1 use lambda instead of bind // 2017-03-11 859 1.0 Initial version // --------------------------------------------------------------------------- @@ -39,8 +40,8 @@ namespace Retro { RtclRw11VirtDiskOver::RtclRw11VirtDiskOver(Rw11VirtDiskOver* pobj) : RtclRw11VirtBase(pobj) { - AddMeth("flush", boost::bind(&RtclRw11VirtDiskOver::M_flush, this, _1)); - AddMeth("list", boost::bind(&RtclRw11VirtDiskOver::M_list, this, _1)); + AddMeth("flush", [this](RtclArgs& args){ return M_flush(args); }); + AddMeth("list", [this](RtclArgs& args){ return M_list(args); }); } //------------------------------------------+----------------------------------- diff --git a/tools/src/librwxxtpp/RtclRw11VirtDiskRam.cpp b/tools/src/librwxxtpp/RtclRw11VirtDiskRam.cpp index 6a6d399a..6d5be8be 100644 --- a/tools/src/librwxxtpp/RtclRw11VirtDiskRam.cpp +++ b/tools/src/librwxxtpp/RtclRw11VirtDiskRam.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11VirtDiskRam.cpp 1063 2018-10-29 18:37:42Z mueller $ +// $Id: RtclRw11VirtDiskRam.cpp 1082 2018-12-15 13:56:20Z mueller $ // // Copyright 2018- by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-15 1082 1.0.1 use lambda instead of bind // 2018-10-28 1063 1.0 Initial version // --------------------------------------------------------------------------- @@ -39,7 +40,7 @@ namespace Retro { RtclRw11VirtDiskRam::RtclRw11VirtDiskRam(Rw11VirtDiskRam* pobj) : RtclRw11VirtBase(pobj) { - AddMeth("list", boost::bind(&RtclRw11VirtDiskRam::M_list, this, _1)); + AddMeth("list", [this](RtclArgs& args){ return M_list(args); }); } //------------------------------------------+-----------------------------------