1
0
mirror of https://github.com/wfjm/w11.git synced 2026-04-13 08:34:16 +00:00

phase-out boost::function,bind

- use std::function instead of boost
- use c++11 lambda instead of boost::bind in most cases
- use std::bind in few cases where this deems more readable
- use move semantics for passing of function objects
This commit is contained in:
wfjm
2018-12-16 12:24:07 +01:00
parent 11e6c81379
commit 1620ee3a84
67 changed files with 521 additions and 528 deletions

View File

@@ -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

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <poll.h>
#include <errno.h>
#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<boost::mutex> 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) {

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <cstdint>
#include <vector>
#include <memory>
#include <functional>
#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<int(const pollfd&)> pollhdl_t;
typedef std::function<int(const pollfd&)> 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);

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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;

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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<RlinkConnect>& 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<RlinkConnect> 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<RlinkConnect> 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;

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <vector>
#include <list>
#include <memory>
#include <functional>
#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<int(AttnArgs&)> attnhdl_t;
typedef boost::function<int()> actnhdl_t;
typedef ReventLoop::pollhdl_t pollhdl_t;
typedef std::function<int(AttnArgs&)> attnhdl_t;
typedef std::function<int()> 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<RlinkConnect> fspConn;

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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)
{}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <errno.h>
#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;

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <iostream>
#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<uint32_t> ("baseaddr",
boost::bind(&RlinkConnect::LogBaseAddr, pobj));
fGets.Add<uint32_t> ("basedata",
boost::bind(&RlinkConnect::LogBaseData, pobj));
fGets.Add<uint32_t> ("basestat",
boost::bind(&RlinkConnect::LogBaseStat, pobj));
fGets.Add<uint32_t> ("printlevel",
boost::bind(&RlinkConnect::PrintLevel, pobj));
fGets.Add<uint32_t> ("dumplevel",
boost::bind(&RlinkConnect::DumpLevel, pobj));
fGets.Add<uint32_t> ("tracelevel",
boost::bind(&RlinkConnect::TraceLevel, pobj));
fGets.Add<const Rtime&> ("timeout",
boost::bind(&RlinkConnect::Timeout, pobj));
fGets.Add<const string&> ("logfile",
boost::bind(&RlinkConnect::LogFileName, pobj));
fGets.Add<uint32_t> ("baseaddr", [pobj](){ return pobj->LogBaseAddr(); });
fGets.Add<uint32_t> ("basedata", [pobj](){ return pobj->LogBaseData(); });
fGets.Add<uint32_t> ("basestat", [pobj](){ return pobj->LogBaseStat(); });
fGets.Add<uint32_t> ("printlevel", [pobj](){ return pobj->PrintLevel(); });
fGets.Add<uint32_t> ("dumplevel", [pobj](){ return pobj->DumpLevel(); });
fGets.Add<uint32_t> ("tracelevel", [pobj](){ return pobj->TraceLevel(); });
fGets.Add<const Rtime&> ("timeout", [pobj](){ return pobj->Timeout(); });
fGets.Add<const string&>("logfile", [pobj](){ return pobj->LogFileName(); });
fGets.Add<uint32_t> ("initdone",
boost::bind(&RlinkConnect::LinkInitDone, pobj));
fGets.Add<uint32_t> ("sysid",
boost::bind(&RlinkConnect::SysId, pobj));
fGets.Add<uint32_t> ("usracc",
boost::bind(&RlinkConnect::UsrAcc, pobj));
fGets.Add<size_t> ("rbufsize",
boost::bind(&RlinkConnect::RbufSize, pobj));
fGets.Add<size_t> ("bsizemax",
boost::bind(&RlinkConnect::BlockSizeMax, pobj));
fGets.Add<size_t> ("bsizeprudent",
boost::bind(&RlinkConnect::BlockSizePrudent, pobj));
fGets.Add<bool> ("hasrbmon",
boost::bind(&RlinkConnect::HasRbmon, pobj));
fGets.Add<uint32_t> ("initdone", [pobj](){ return pobj->LinkInitDone(); });
fGets.Add<uint32_t> ("sysid", [pobj](){ return pobj->SysId(); });
fGets.Add<uint32_t> ("usracc", [pobj](){ return pobj->UsrAcc(); });
fGets.Add<size_t> ("rbufsize", [pobj](){ return pobj->RbufSize(); });
fGets.Add<size_t> ("bsizemax", [pobj](){ return pobj->BlockSizeMax(); });
fGets.Add<size_t> ("bsizeprudent",
[pobj](){ return pobj->BlockSizePrudent(); });
fGets.Add<bool> ("hasrbmon", [pobj](){ return pobj->HasRbmon(); });
fSets.Add<uint32_t> ("baseaddr",
boost::bind(&RlinkConnect::SetLogBaseAddr, pobj, _1));
fSets.Add<uint32_t> ("baseaddr",
[pobj](uint32_t v){ pobj->SetLogBaseAddr(v); });
fSets.Add<uint32_t> ("basedata",
boost::bind(&RlinkConnect::SetLogBaseData, pobj, _1));
[pobj](uint32_t v){ pobj->SetLogBaseData(v); });
fSets.Add<uint32_t> ("basestat",
boost::bind(&RlinkConnect::SetLogBaseStat, pobj, _1));
[pobj](uint32_t v){ pobj->SetLogBaseStat(v); });
fSets.Add<uint32_t> ("printlevel",
boost::bind(&RlinkConnect::SetPrintLevel, pobj, _1));
[pobj](uint32_t v){ pobj->SetPrintLevel(v); });
fSets.Add<uint32_t> ("dumplevel",
boost::bind(&RlinkConnect::SetDumpLevel, pobj, _1));
[pobj](uint32_t v){ pobj->SetDumpLevel(v); });
fSets.Add<uint32_t> ("tracelevel",
boost::bind(&RlinkConnect::SetTraceLevel, pobj, _1));
[pobj](uint32_t v){ pobj->SetTraceLevel(v); });
fSets.Add<const Rtime&> ("timeout",
boost::bind(&RlinkConnect::SetTimeout, pobj, _1));
[pobj](const Rtime& v){ pobj->SetTimeout(v); });
fSets.Add<const string&> ("logfile",
boost::bind(&RlinkConnect::SetLogFileName, pobj, _1));
[pobj](const string& v){ pobj->SetLogFileName(v); });
// attributes of buildin RlinkContext
RlinkContext* pcntx = &Obj().Context();
fGets.Add<bool> ("statchecked",
boost::bind(&RlinkContext::StatusIsChecked, pcntx));
[pcntx](){ return pcntx->StatusIsChecked(); });
fGets.Add<uint8_t> ("statvalue",
boost::bind(&RlinkContext::StatusValue, pcntx));
[pcntx](){ return pcntx->StatusValue(); });
fGets.Add<uint8_t> ("statmask",
boost::bind(&RlinkContext::StatusMask, pcntx));
[pcntx](){ return pcntx->StatusMask(); });
fSets.Add<uint8_t> ("statvalue",
boost::bind(&RlinkContext::SetStatusValue, pcntx, _1));
[pcntx](uint8_t v){ pcntx->SetStatusValue(v); });
fSets.Add<uint8_t> ("statmask",
boost::bind(&RlinkContext::SetStatusMask, pcntx, _1));
[pcntx](uint8_t v){ pcntx->SetStatusMask(v); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <iostream>
#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<const string&> ("logfile",
boost::bind(&RtclRlinkPort::LogFileName, this));
fGets.Add<const string&> ("logfile", [this](){ return LogFileName(); });
fSets.Add<const string&> ("logfile",
boost::bind(&RtclRlinkPort::SetLogFileName, this, _1));
[this](const string& v){ SetLogFileName(v); });
if (!fupObj) return;
RlinkPort* pobj = fupObj.get();
fGets.Add<uint32_t> ("tracelevel",
boost::bind(&RlinkPort::TraceLevel, fupObj.get()));
fGets.Add<uint32_t> ("tracelevel", [pobj](){ return pobj->TraceLevel(); });
fSets.Add<uint32_t> ("tracelevel",
boost::bind(&RlinkPort::SetTraceLevel, fupObj.get(),
_1));
[pobj](uint32_t v){pobj->SetTraceLevel(v); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <string>
#include <memory>
#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<uint32_t> ("tracelevel",
boost::bind(&RlinkServer::TraceLevel, pobj));
fGets.Add<uint32_t> ("tracelevel", [pobj](){ return pobj->TraceLevel(); });
fSets.Add<uint32_t> ("tracelevel",
boost::bind(&RlinkServer::SetTraceLevel, pobj, _1));
[pobj](uint32_t v){ pobj->SetTraceLevel(v); });
// attributes of buildin RlinkContext
RlinkContext* pcntx = &Obj().Context();
fGets.Add<bool> ("statchecked",
boost::bind(&RlinkContext::StatusIsChecked, pcntx));
fGets.Add<uint8_t> ("statvalue",
boost::bind(&RlinkContext::StatusValue, pcntx));
fGets.Add<uint8_t> ("statmask",
boost::bind(&RlinkContext::StatusMask, pcntx));
fGets.Add<bool> ("statchecked",
[pcntx](){ return pcntx->StatusIsChecked(); });
fGets.Add<uint8_t> ("statvalue",
[pcntx](){ return pcntx->StatusValue(); });
fGets.Add<uint8_t> ("statmask",
[pcntx](){ return pcntx->StatusMask(); });
fSets.Add<uint8_t> ("statvalue",
boost::bind(&RlinkContext::SetStatusValue, pcntx, _1));
[pcntx](uint8_t v){ pcntx->SetStatusValue(v); });
fSets.Add<uint8_t> ("statmask",
boost::bind(&RlinkContext::SetStatusMask, pcntx, _1));
[pcntx](uint8_t v){ pcntx->SetStatusMask(v); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 + "'");

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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 <string>
#include <map>
#include <functional>
#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<int(RtclArgs&)> methfo_t;
typedef std::function<int(RtclArgs&)> methfo_t;
typedef std::map<std::string, methfo_t> 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);

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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 <cstdint>
#include <string>
#include "boost/function.hpp"
#include <functional>
#include "RtclGetBase.hpp"
@@ -38,13 +39,13 @@ namespace Retro {
template <class TP>
class RtclGet : public RtclGetBase {
public:
explicit RtclGet(const boost::function<TP()>& get);
explicit RtclGet(std::function<TP()>&& get);
~RtclGet();
virtual Tcl_Obj* operator()() const;
protected:
boost::function<TP()> fGet;
std::function<TP()> fGet;
};

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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 <class TP>
inline RtclGet<TP>::RtclGet(const boost::function<TP()>& get)
: fGet(get)
inline RtclGet<TP>::RtclGet(std::function<TP()>&& get)
: fGet(move(get))
{}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <cstdint>
#include <string>
#include <map>
#include <functional>
#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 <class TP>
void Add(const std::string& name,
const boost::function<TP()>& get);
void Add(const std::string& name, std::function<TP()>&& get);
void Clear();
int M_get(RtclArgs& args);

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <class TP>
inline void RtclGetList::Add(const std::string& name,
const boost::function<TP()>& get)
std::function<TP()>&& get)
{
Add(name, get_uptr_t(new RtclGet<TP>(get)));
Add(name, get_uptr_t(new RtclGet<TP>(move(get))));
return;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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 <cstdint>
#include <string>
#include "boost/function.hpp"
#include <functional>
#include "librtools/Rexception.hpp"
#include "RtclSetBase.hpp"
@@ -39,13 +40,13 @@ namespace Retro {
template <class TP>
class RtclSet : public RtclSetBase {
public:
explicit RtclSet(const boost::function<void(TP)>& set);
explicit RtclSet(std::function<void(TP)>&& set);
~RtclSet();
virtual void operator()(RtclArgs& args) const;
protected:
boost::function<void(TP)> fSet;
std::function<void(TP)> fSet;
};

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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 <class TP>
inline RtclSet<TP>::RtclSet(const boost::function<void(TP)>& set)
: fSet(set)
inline RtclSet<TP>::RtclSet(std::function<void(TP)>&& set)
: fSet(move(set))
{}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <cstdint>
#include <string>
#include <map>
#include <functional>
#include "boost/utility.hpp"
#include "boost/function.hpp"
#include "RtclSet.hpp"
#include "librtcltools/RtclArgs.hpp"
@@ -51,7 +53,7 @@ namespace Retro {
template <class TP>
void Add(const std::string& name,
const boost::function<void(TP)>& set);
std::function<void(TP)>&& set);
void Clear();
int M_set(RtclArgs& args);

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <class TP>
inline void RtclSetList::Add(const std::string& name,
const boost::function<void(TP)>& set)
inline void RtclSetList::Add(const std::string& name,
std::function<void(TP)>&& set)
{
Add(name, set_uptr_t(new RtclSet<TP>(set)));
Add(name, set_uptr_t(new RtclSet<TP>(move(set))));
return;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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<RlinkServer>& spserv)
{
fspServ = spserv;
fspServ->AddAttnHandler(boost::bind(&Rw11::AttnHandler, this, _1),
fspServ->AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
uint16_t(1)<<kLam, (void*)this);
return;
}
@@ -126,7 +128,7 @@ void Rw11::Dump(std::ostream& os, int ind, const char* text, int /*detail*/) con
os << bl << " fspServ: " << fspServ.get() << endl;
os << bl << " fNCpu: " << fNCpu << endl;
os << bl << " fspCpu[4]: ";
for (size_t i=0; i<4; i++) os << fspCpu[i].get() << " ";
for (auto& o: fspCpu) os << o.get() << " ";
os << endl;
os << bl << " fStarted: " << fStarted << endl;
return;

View File

@@ -1,4 +1,4 @@
// $Id: Rw11CntlDEUNA.cpp 1080 2018-12-09 20:30:33Z mueller $
// $Id: Rw11CntlDEUNA.cpp 1082 2018-12-15 13:56:20Z mueller $
//
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -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 <sstream>
#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)<<fLam, (void*)this);
fStarted = true;
@@ -1008,8 +1008,8 @@ void Rw11CntlDEUNA::SetRunning(bool run)
if (run) { // start
if (! fRxPollTimer.IsOpen()) { // start poll timer if needed
fRxPollTimer.Open();
Server().AddPollHandler(boost::bind(&Rw11CntlDEUNA::RxPollHandler,
this, _1),
Server().AddPollHandler([this](const pollfd& pfd)
{ return RxPollHandler(pfd); },
fRxPollTimer.Fd(), POLLIN);
}
@@ -1400,8 +1400,7 @@ void Rw11CntlDEUNA::StartTxRing(const uint16_t dsccur[4],
if (fTxDscCurPC[2] & kTXR2_M_OWN) { // pending tx frames ?
fTxRingState = kStateTxBusy;
Server().QueueAction(boost::bind(&Rw11CntlDEUNA::TxRingHandler,
this));
Server().QueueAction([this](){ return TxRingHandler(); });
}
return;
}
@@ -1444,8 +1443,7 @@ void Rw11CntlDEUNA::StartRxRing(const uint16_t dsccur[4],
if (!fRxBufQueue.empty() && // if pending rx frames
fRxDscCur[2] & kRXR2_M_OWN) { // and buffer available
fRxRingState = kStateRxBusy;
Server().QueueAction(boost::bind(&Rw11CntlDEUNA::RxRingHandler,
this));
Server().QueueAction([this](){ return RxRingHandler(); });
}
return;
}

View File

@@ -1,4 +1,4 @@
// $Id: Rw11CntlDL11.cpp 1049 2018-09-22 13:56:52Z mueller $
// $Id: Rw11CntlDL11.cpp 1082 2018-12-15 13:56:20Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -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)<<fLam, (void*)this);
fStarted = true;
return;

View File

@@ -1,4 +1,4 @@
// $Id: Rw11CntlLP11.cpp 1080 2018-12-09 20:30:33Z mueller $
// $Id: Rw11CntlLP11.cpp 1082 2018-12-15 13:56:20Z mueller $
//
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -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)<<fLam, (void*)this);
fStarted = true;

View File

@@ -1,4 +1,4 @@
// $Id: Rw11CntlPC11.cpp 1080 2018-12-09 20:30:33Z mueller $
// $Id: Rw11CntlPC11.cpp 1082 2018-12-15 13:56:20Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -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)<<fLam, (void*)this);
fStarted = true;

View File

@@ -1,4 +1,4 @@
// $Id: Rw11CntlRHRP.cpp 1080 2018-12-09 20:30:33Z mueller $
// $Id: Rw11CntlRHRP.cpp 1083 2018-12-15 19:19:16Z mueller $
//
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// 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<NUnit(); i++) {
@@ -271,7 +274,8 @@ void Rw11CntlRHRP::Start()
fPC_rpdc = Cpu().AddRibr(fPrimClist, fBase+kRPDC);
// add attn handler
Server().AddAttnHandler(boost::bind(&Rw11CntlRHRP::AttnHandler, this, _1),
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
uint16_t(1)<<fLam, (void*)this);
fStarted = true;

View File

@@ -1,4 +1,4 @@
// $Id: Rw11CntlRK11.cpp 1080 2018-12-09 20:30:33Z mueller $
// $Id: Rw11CntlRK11.cpp 1083 2018-12-15 19:19:16Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// 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<NUnit(); i++) {
@@ -216,7 +219,8 @@ void Rw11CntlRK11::Start()
fPC_rkcs = Cpu().AddRibr(fPrimClist, fBase+kRKCS);
// add attn handler
Server().AddAttnHandler(boost::bind(&Rw11CntlRK11::AttnHandler, this, _1),
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
uint16_t(1)<<fLam, (void*)this);
fStarted = true;

View File

@@ -1,4 +1,4 @@
// $Id: Rw11CntlRL11.cpp 1080 2018-12-09 20:30:33Z mueller $
// $Id: Rw11CntlRL11.cpp 1083 2018-12-15 19:19:16Z mueller $
//
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// 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<NUnit(); i++) {
@@ -256,7 +259,8 @@ void Rw11CntlRL11::Start()
fPC_pos = Cpu().AddRibr(fPrimClist, fBase+kRLMP);
// add attn handler
Server().AddAttnHandler(boost::bind(&Rw11CntlRL11::AttnHandler, this, _1),
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
uint16_t(1)<<fLam, (void*)this);
fStarted = true;

View File

@@ -1,4 +1,4 @@
// $Id: Rw11CntlTM11.cpp 1080 2018-12-09 20:30:33Z mueller $
// $Id: Rw11CntlTM11.cpp 1083 2018-12-15 19:19:16Z mueller $
//
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// 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<NUnit(); i++) {
@@ -200,7 +203,8 @@ void Rw11CntlTM11::Start()
fPC_tmba = Cpu().AddRibr(fPrimClist, fBase+kTMBA);
// add attn handler
Server().AddAttnHandler(boost::bind(&Rw11CntlTM11::AttnHandler, this, _1),
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
uint16_t(1)<<fLam, (void*)this);
fStarted = true;

View File

@@ -1,4 +1,4 @@
// $Id: Rw11Rdma.cpp 1049 2018-09-22 13:56:52Z mueller $
// $Id: Rw11Rdma.cpp 1083 2018-12-15 19:19:16Z mueller $
//
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -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 <algorithm>
#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<uint16_t*>(block), size, mode);
Server().QueueAction(boost::bind(&Rw11Rdma::RdmaHandler, this));
Server().QueueAction([this](){ return RdmaHandler(); });
return;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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 <functional>
#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<void(int,size_t,size_t,
RlinkCommandList&)> precb_t;
typedef boost::function<void(int,size_t,
RlinkCommandList&,size_t)> postcb_t;
typedef std::function<void(int,size_t,size_t,
RlinkCommandList&)> precb_t;
typedef std::function<void(int,size_t,
RlinkCommandList&,size_t)> 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;

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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),

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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,

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -23,8 +23,6 @@
\brief Implemenation of Rw11UnitDL11.
*/
#include "boost/bind.hpp"
#include "librtools/RosFill.hpp"
#include "Rw11CntlDL11.hpp"

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -22,8 +22,6 @@
\brief Implemenation of Rw11UnitLP11.
*/
#include "boost/bind.hpp"
#include "librtools/RosFill.hpp"
#include "Rw11CntlLP11.hpp"

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -22,8 +22,6 @@
\brief Implemenation of Rw11UnitPC11.
*/
#include "boost/bind.hpp"
#include "librtools/RosFill.hpp"
#include "Rw11CntlPC11.hpp"

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -24,8 +24,6 @@
\brief Implemenation of Rw11UnitRHRP.
*/
#include "boost/bind.hpp"
#include "librtools/Rexception.hpp"
#include "librtools/RosFill.hpp"
#include "Rw11CntlRHRP.hpp"

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -23,8 +23,6 @@
\brief Implemenation of Rw11UnitRK11.
*/
#include "boost/bind.hpp"
#include "librtools/RosFill.hpp"
#include "Rw11CntlRK11.hpp"

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -24,8 +24,6 @@
\brief Implemenation of Rw11UnitRL11.
*/
#include "boost/bind.hpp"
#include "librtools/Rexception.hpp"
#include "librtools/RosFill.hpp"
#include "Rw11CntlRL11.hpp"

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -22,8 +22,6 @@
\brief Implemenation of Rw11UnitTM11.
*/
#include "boost/bind.hpp"
#include "librtools/RosFill.hpp"
#include "Rw11CntlTM11.hpp"

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <memory>
#include <memory>
#include "boost/function.hpp"
#include <functional>
#include "RethBuf.hpp"
@@ -39,14 +40,14 @@ namespace Retro {
class Rw11VirtEth : public Rw11Virt {
public:
typedef boost::function<bool(std::shared_ptr<RethBuf>&)> rcvcbfo_t;
typedef std::function<bool(std::shared_ptr<RethBuf>&)> 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,

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <net/if.h>
#include <linux/if_tun.h>
#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;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <memory>
#include "boost/function.hpp"
#include <functional>
#include "Rw11Virt.hpp"
@@ -37,14 +38,14 @@ namespace Retro {
class Rw11VirtTerm : public Rw11Virt {
public:
typedef boost::function<bool(const uint8_t*, size_t)> rcvcbfo_t;
typedef std::function<bool(const uint8_t*, size_t)> 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,

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <errno.h>
#include <unistd.h>
#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;

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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;

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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 <iostream>
#include <string>
#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<bool> ("started",boost::bind(&Rw11::IsStarted, pobj));
fGets.Add<const string&> ("diskscheme",
boost::bind(&Rw11VirtDisk::DefaultScheme));
fGets.Add<bool> ("started", [pobj](){ return pobj->IsStarted(); });
fGets.Add<const string&> ("diskscheme",
[](){ return Rw11VirtDisk::DefaultScheme(); });
fGets.Add<Tcl_Obj*> ("cpus", [this](){ return CpuCommands(); });
fSets.Add<const string&> ("diskscheme",
boost::bind(&Rw11VirtDisk::SetDefaultScheme, _1));
fGets.Add<Tcl_Obj*> ("cpus",
boost::bind(&RtclRw11::CpuCommands, this));
fSets.Add<const string&> ("diskscheme",
[](const string& v)
{ Rw11VirtDisk::SetDefaultScheme(v);} );
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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<Tcl_Obj*> ("units",
boost::bind(&RtclRw11Cntl::UnitCommands, this));
fGets.Add<const string&> ("class",
boost::bind(&RtclRw11Cntl::Class, this));
fGets.Add<Tcl_Obj*> ("units", [this](){ return UnitCommands(); });
fGets.Add<const string&> ("class", [this](){ return Class(); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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<TC>::RtclRw11CntlBase(const std::string& type,
: RtclRw11Cntl(type,cclass),
fspObj(new TC())
{
AddMeth("bootcode", boost::bind(&RtclRw11CntlBase<TC>::M_bootcode,this, _1));
AddMeth("bootcode", [this](RtclArgs& args){ return M_bootcode(args); });
TC* pobj = fspObj.get();
fGets.Add<const std::string&>("type", boost::bind(&TC::Type, pobj));
fGets.Add<const std::string&>("name", boost::bind(&TC::Name, pobj));
fGets.Add<uint16_t> ("base", boost::bind(&TC::Base, pobj));
fGets.Add<int> ("lam", boost::bind(&TC::Lam, pobj));
fGets.Add<bool> ("found", boost::bind(&TC::ProbeFound, pobj));
fGets.Add<uint16_t> ("pdataint", boost::bind(&TC::ProbeDataInt, pobj));
fGets.Add<uint16_t> ("pdatarem", boost::bind(&TC::ProbeDataRem, pobj));
fGets.Add<bool> ("enable",boost::bind(&TC::Enable, pobj));
fGets.Add<bool> ("started",boost::bind(&TC::IsStarted, pobj));
fGets.Add<uint32_t> ("trace", boost::bind(&TC::TraceLevel,pobj));
fSets.Add<bool> ("enable", boost::bind(&TC::SetEnable,pobj,_1));
fSets.Add<uint32_t> ("trace", boost::bind(&TC::SetTraceLevel,pobj,_1));
fGets.Add<const std::string&>("type", [pobj](){ return pobj->Type(); });
fGets.Add<const std::string&>("name", [pobj](){ return pobj->Name(); });
fGets.Add<uint16_t> ("base", [pobj](){ return pobj->Base(); });
fGets.Add<int> ("lam", [pobj](){ return pobj->Lam(); });
fGets.Add<bool> ("found", [pobj](){ return pobj->ProbeFound(); });
fGets.Add<uint16_t> ("pdataint", [pobj](){ return pobj->ProbeDataInt(); });
fGets.Add<uint16_t> ("pdatarem", [pobj](){ return pobj->ProbeDataRem(); });
fGets.Add<bool> ("enable", [pobj](){ return pobj->Enable(); });
fGets.Add<bool> ("started", [pobj](){ return pobj->IsStarted(); });
fGets.Add<uint32_t> ("trace", [pobj](){ return pobj->TraceLevel(); });
fSets.Add<bool> ("enable", [pobj](bool v){ pobj->SetEnable(v); });
fSets.Add<uint32_t> ("trace", [pobj](uint32_t v){ pobj->SetTraceLevel(v); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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>("Rw11CntlDEUNA","ether")
{
Rw11CntlDEUNA* pobj = &Obj();
fGets.Add<string> ("dpa",
boost::bind(&Rw11CntlDEUNA::MacDefault, pobj));
fGets.Add<const Rtime&> ("rxpoll",
boost::bind(&Rw11CntlDEUNA::RxPollTime, pobj));
fGets.Add<size_t> ("rxqlim",
boost::bind(&Rw11CntlDEUNA::RxQueLimit, pobj));
fGets.Add<bool> ("run",
boost::bind(&Rw11CntlDEUNA::Running, pobj));
fGets.Add<string> ("dpa", [pobj](){ return pobj->MacDefault(); });
fGets.Add<const Rtime&> ("rxpoll", [pobj](){ return pobj->RxPollTime(); });
fGets.Add<size_t> ("rxqlim", [pobj](){ return pobj->RxQueLimit(); });
fGets.Add<bool> ("run", [pobj](){ return pobj->Running(); });
fSets.Add<const string&> ("type",
boost::bind(&Rw11CntlDEUNA::SetType,pobj, _1));
[pobj](const string& v){ pobj->SetType(v); });
fSets.Add<const string&> ("dpa",
boost::bind(&Rw11CntlDEUNA::SetMacDefault,pobj, _1));
[pobj](const string& v){ pobj->SetMacDefault(v); });
fSets.Add<const Rtime&> ("rxpoll",
boost::bind(&Rw11CntlDEUNA::SetRxPollTime,pobj, _1));
[pobj](const Rtime& v){ pobj->SetRxPollTime(v); });
fSets.Add<size_t> ("rxqlim",
boost::bind(&Rw11CntlDEUNA::SetRxQueLimit,pobj, _1));
[pobj](size_t v){ pobj->SetRxQueLimit(v); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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>("Rw11CntlDL11","term")
{
Rw11CntlDL11* pobj = &Obj();
fGets.Add<uint16_t> ("rxrlim",
boost::bind(&Rw11CntlDL11::RxRlim, pobj));
fSets.Add<uint16_t> ("rxrlim",
boost::bind(&Rw11CntlDL11::SetRxRlim,pobj, _1));
fGets.Add<uint16_t> ("rxrlim", [pobj](){ return pobj->RxRlim(); });
fSets.Add<uint16_t> ("rxrlim", [pobj](uint16_t v){ pobj->SetRxRlim(v); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2017-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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<TC>::RtclRw11CntlRdmaBase(const std::string& type,
TC* pobj = &this->Obj();
RtclGetList& gets = this->fGets;
RtclSetList& sets = this->fSets;
gets.Add<size_t> ("chunksize",
boost::bind(&TC::ChunkSize, pobj));
sets.Add<size_t> ("chunksize",
boost::bind(&TC::SetChunkSize, pobj, _1));
gets.Add<size_t> ("chunksize", [pobj](){ return pobj->ChunkSize(); });
sets.Add<size_t> ("chunksize", [pobj](size_t v){ pobj->SetChunkSize(v); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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 <memory>
#include <sstream>
#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<Tcl_Obj*> ("cntls",
boost::bind(&RtclRw11Cpu::ControllerCommands, this));
fGets.Add<Tcl_Obj*> ("cntls", [this](){ return ControllerCommands(); });
}
//------------------------------------------+-----------------------------------
@@ -1480,18 +1479,18 @@ int RtclRw11Cpu::M_default(RtclArgs& args)
void RtclRw11Cpu::SetupGetSet()
{
Rw11Cpu* pobj = &Obj();
fGets.Add<const string&>("type", boost::bind(&Rw11Cpu::Type, pobj));
fGets.Add<size_t> ("index", boost::bind(&Rw11Cpu::Index, pobj));
fGets.Add<uint16_t> ("base", boost::bind(&Rw11Cpu::Base, pobj));
fGets.Add<uint16_t> ("ibase", boost::bind(&Rw11Cpu::IBase, pobj));
fGets.Add<bool> ("hasscnt", boost::bind(&Rw11Cpu::HasScnt, pobj));
fGets.Add<bool> ("haspcnt", boost::bind(&Rw11Cpu::HasPcnt, pobj));
fGets.Add<bool> ("hascmon", boost::bind(&Rw11Cpu::HasCmon, pobj));
fGets.Add<uint16_t> ("hashbpt", boost::bind(&Rw11Cpu::HasHbpt, pobj));
fGets.Add<bool> ("hasibmon", boost::bind(&Rw11Cpu::HasIbmon, pobj));
fGets.Add<bool> ("haskw11l", boost::bind(&Rw11Cpu::HasKw11l, pobj));
fGets.Add<bool> ("haskw11p", boost::bind(&Rw11Cpu::HasKw11p, pobj));
fGets.Add<bool> ("hasiist", boost::bind(&Rw11Cpu::HasIist, pobj));
fGets.Add<const string&>("type", [pobj](){ return pobj->Type(); });
fGets.Add<size_t> ("index", [pobj](){ return pobj->Index(); });
fGets.Add<uint16_t> ("base", [pobj](){ return pobj->Base(); });
fGets.Add<uint16_t> ("ibase", [pobj](){ return pobj->IBase(); });
fGets.Add<bool> ("hasscnt", [pobj](){ return pobj->HasScnt(); });
fGets.Add<bool> ("haspcnt", [pobj](){ return pobj->HasPcnt(); });
fGets.Add<bool> ("hascmon", [pobj](){ return pobj->HasCmon(); });
fGets.Add<uint16_t> ("hashbpt", [pobj](){ return pobj->HasHbpt(); });
fGets.Add<bool> ("hasibmon", [pobj](){ return pobj->HasIbmon(); });
fGets.Add<bool> ("haskw11l", [pobj](){ return pobj->HasKw11l(); });
fGets.Add<bool> ("haskw11p", [pobj](){ return pobj->HasKw11p(); });
fGets.Add<bool> ("hasiist", [pobj](){ return pobj->HasIist(); });
return;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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<TU,TUV,TB>::RtclRw11UnitBase(const std::string& type,
: TB(type),
fspObj(spunit)
{
this->AddMeth("stats", boost::bind(&RtclRw11UnitBase<TU,TUV,TB>::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<TU,TUV,TB>::RtclRw11UnitBase(const std::string& type,
// error messages. Simply too much nested templating...
RtclGetList& gets = this->fGets;
gets.Add<size_t> ("index", boost::bind(&TU::Index, pobj));
gets.Add<std::string> ("name", boost::bind(&TU::Name, pobj));
gets.Add<bool> ("enabled", boost::bind(&TU::Enabled, pobj));
gets.Add<bool> ("attached", boost::bind(&TU::IsAttached, pobj));
gets.Add<const std::string&> ("attachurl",boost::bind(&TU::AttachUrl,pobj));
gets.Add<size_t> ("index", [pobj](){ return pobj->Index(); });
gets.Add<std::string> ("name", [pobj](){ return pobj->Name(); });
gets.Add<bool> ("enabled", [pobj](){ return pobj->Enabled(); });
gets.Add<bool> ("attached",
[pobj](){ return pobj->IsAttached(); });
gets.Add<const std::string&> ("attachurl",
[pobj](){ return pobj->AttachUrl(); });
}
//------------------------------------------+-----------------------------------
@@ -132,7 +135,7 @@ void RtclRw11UnitBase<TU,TUV,TB>::AttachDone()
std::unique_ptr<RtclRw11Virt> 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;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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<const string&> ("type",
boost::bind(&Rw11UnitDisk::Type, pobj));
fGets.Add<size_t> ("ncylinder",
boost::bind(&Rw11UnitDisk::NCylinder, pobj));
fGets.Add<size_t> ("nhead",
boost::bind(&Rw11UnitDisk::NHead, pobj));
fGets.Add<size_t> ("nsector",
boost::bind(&Rw11UnitDisk::NSector, pobj));
fGets.Add<size_t> ("blocksize",
boost::bind(&Rw11UnitDisk::BlockSize, pobj));
fGets.Add<size_t> ("nblock",
boost::bind(&Rw11UnitDisk::NBlock, pobj));
fGets.Add<bool> ("wprot",
boost::bind(&Rw11UnitDisk::WProt, pobj));
fGets.Add<const string&> ("type", [pobj](){ return pobj->Type(); });
fGets.Add<size_t> ("ncylinder", [pobj](){ return pobj->NCylinder(); });
fGets.Add<size_t> ("nhead", [pobj](){ return pobj->NHead(); });
fGets.Add<size_t> ("nsector", [pobj](){ return pobj->NSector(); });
fGets.Add<size_t> ("blocksize", [pobj](){ return pobj->BlockSize(); });
fGets.Add<size_t> ("nblock", [pobj](){ return pobj->NBlock(); });
fGets.Add<bool> ("wprot", [pobj](){ return pobj->WProt(); });
fSets.Add<const string&> ("type",
boost::bind(&Rw11UnitDisk::SetType,pobj, _1));
[pobj](const string& v){ pobj->SetType(v); });
return;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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<int> ("pos",
boost::bind(&Rw11UnitStream::Pos, pobj));
fGets.Add<int> ("pos", [pobj](){ return pobj->Pos(); });
fSets.Add<int> ("pos",
boost::bind(&Rw11UnitStream::SetPos,pobj, _1));
fSets.Add<int> ("pos", [pobj](int v){ pobj->SetPos(v); });
return;
}
} // end namespace Retro

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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<const string&> ("type",
boost::bind(&Rw11UnitTape::Type, pobj));
fGets.Add<bool> ("wprot",
boost::bind(&Rw11UnitTape::WProt, pobj));
fGets.Add<size_t> ("capacity",
boost::bind(&Rw11UnitTape::Capacity, pobj));
fGets.Add<bool> ("bot",
boost::bind(&Rw11UnitTape::Bot, pobj));
fGets.Add<bool> ("eot",
boost::bind(&Rw11UnitTape::Eot, pobj));
fGets.Add<bool> ("eom",
boost::bind(&Rw11UnitTape::Eom, pobj));
fGets.Add<int> ("posfile",
boost::bind(&Rw11UnitTape::PosFile, pobj));
fGets.Add<int> ("posrecord",
boost::bind(&Rw11UnitTape::PosRecord, pobj));
fGets.Add<const string&> ("type", [pobj](){ return pobj->Type(); });
fGets.Add<bool> ("wprot", [pobj](){ return pobj->WProt(); });
fGets.Add<size_t> ("capacity", [pobj](){ return pobj->Capacity(); });
fGets.Add<bool> ("bot", [pobj](){ return pobj->Bot(); });
fGets.Add<bool> ("eot", [pobj](){ return pobj->Eot(); });
fGets.Add<bool> ("eom", [pobj](){ return pobj->Eom(); });
fGets.Add<int> ("posfile", [pobj](){ return pobj->PosFile(); });
fGets.Add<int> ("posrecord", [pobj](){ return pobj->PosRecord(); });
fSets.Add<const string&> ("type",
boost::bind(&Rw11UnitTape::SetType,pobj, _1));
[pobj](const string& v){ pobj->SetType(v); });
fSets.Add<bool> ("wprot",
boost::bind(&Rw11UnitTape::SetWProt,pobj, _1));
[pobj](bool v){ pobj->SetWProt(v); });
fSets.Add<size_t> ("capacity",
boost::bind(&Rw11UnitTape::SetCapacity,pobj, _1));
[pobj](size_t v){ pobj->SetCapacity(v); });
fSets.Add<int> ("posfile",
boost::bind(&Rw11UnitTape::SetPosFile,pobj, _1));
[pobj](int v){ pobj->SetPosFile(v); });
fSets.Add<int> ("posrecord",
boost::bind(&Rw11UnitTape::SetPosRecord,pobj, _1));
[pobj](int v){ pobj->SetPosRecord(v); });
return;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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<const string&> ("channelid",
boost::bind(&Rw11UnitTerm::ChannelId, pobj));
fGets.Add<bool> ("to7bit",
boost::bind(&Rw11UnitTerm::To7bit, pobj));
fGets.Add<bool> ("toenpc",
boost::bind(&Rw11UnitTerm::ToEnpc, pobj));
fGets.Add<bool> ("ti7bit",
boost::bind(&Rw11UnitTerm::Ti7bit, pobj));
fGets.Add<const string&> ("log",
boost::bind(&Rw11UnitTerm::Log, pobj));
fGets.Add<const string&> ("channelid", [pobj](){ return pobj->ChannelId(); });
fGets.Add<bool> ("to7bit", [pobj](){ return pobj->To7bit(); });
fGets.Add<bool> ("toenpc", [pobj](){ return pobj->ToEnpc(); });
fGets.Add<bool> ("ti7bit", [pobj](){ return pobj->Ti7bit(); });
fGets.Add<const string&> ("log", [pobj](){ return pobj->Log(); });
fSets.Add<bool> ("to7bit",
boost::bind(&Rw11UnitTerm::SetTo7bit,pobj, _1));
fSets.Add<bool> ("toenpc",
boost::bind(&Rw11UnitTerm::SetToEnpc,pobj, _1));
fSets.Add<bool> ("ti7bit",
boost::bind(&Rw11UnitTerm::SetTi7bit,pobj, _1));
fSets.Add<const string&> ("log",
boost::bind(&Rw11UnitTerm::SetLog,pobj, _1));
fSets.Add<bool> ("to7bit", [pobj](bool v){ pobj->SetTo7bit(v); });
fSets.Add<bool> ("toenpc", [pobj](bool v){ pobj->SetToEnpc(v); });
fSets.Add<bool> ("ti7bit", [pobj](bool v){ pobj->SetTi7bit(v); });
fSets.Add<const string&> ("log",
[pobj](const string& v){ pobj->SetLog(v); });
return;
}

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2017-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -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<Rw11VirtDiskOver>(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); });
}
//------------------------------------------+-----------------------------------

View File

@@ -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 <W.F.J.Mueller@gsi.de>
//
@@ -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<Rw11VirtDiskRam>(pobj)
{
AddMeth("list", boost::bind(&RtclRw11VirtDiskRam::M_list, this, _1));
AddMeth("list", [this](RtclArgs& args){ return M_list(args); });
}
//------------------------------------------+-----------------------------------