1
0
mirror of https://github.com/wfjm/w11.git synced 2026-01-22 02:54:46 +00:00

use std::bind instead of lambda

- automatic return type detection for lambda's can be error prone
- it is safer and more compact to use std:bind as method forwarder
- closes issue #19
This commit is contained in:
wfjm 2019-03-03 09:40:56 +01:00
parent 481260827c
commit 6024dce209
36 changed files with 491 additions and 398 deletions

View File

@ -1,6 +1,6 @@
// $Id: RlinkServer.cpp 1088 2018-12-17 17:37:00Z mueller $
// $Id: RlinkServer.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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
// 2019-02-23 1114 2.2.9 use std::bind instead of lambda
// 2018-12-17 1088 2.2.8 use std::lock_guard, std::thread instead of boost
// 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
@ -38,6 +39,8 @@
#include <unistd.h>
#include <functional>
#include "librtools/Rexception.hpp"
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintf.hpp"
@ -49,6 +52,7 @@
#include "RlinkServer.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RlinkServer
@ -78,8 +82,7 @@ RlinkServer::RlinkServer()
RlinkCommand::kStat_M_RbNak |
RlinkCommand::kStat_M_RbErr);
fELoop.AddPollHandler([this](const pollfd& pfd)
{ return WakeupHandler(pfd); },
fELoop.AddPollHandler(bind(&RlinkServer::WakeupHandler, this, _1),
fWakeupEvent, POLLIN);
// Statistic setup
@ -418,8 +421,7 @@ void RlinkServer::StartOrResume(bool resume)
// setup poll handler for Rlink traffic
int rlinkfd = fspConn->Port().FdRead();
if (!fELoop.TestPollHandler(rlinkfd, POLLIN))
fELoop.AddPollHandler([this](const pollfd& pfd)
{ return RlinkHandler(pfd); },
fELoop.AddPollHandler(bind(&RlinkServer::RlinkHandler, this, _1),
rlinkfd, POLLIN);
// and start server thread

View File

@ -1,6 +1,6 @@
// $Id: RtclAttnShuttle.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclAttnShuttle.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,8 +13,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.1.4 use std::bind instead of lambda
// 2018-12-18 1089 1.1.3 use c++ style casts
// 2018-12-15 1082 1.1.2 use lambda instead of bind
// 2018-12-15 1082 1.1.2 use lambda instead of boost::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
@ -32,12 +33,15 @@
#include <unistd.h>
#include <errno.h>
#include <functional>
#include "librtools/Rexception.hpp"
#include "librtools/Rtools.hpp"
#include "RtclAttnShuttle.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclAttnShuttle
@ -83,8 +87,7 @@ RtclAttnShuttle::~RtclAttnShuttle()
void RtclAttnShuttle::Add(RlinkServer* pserv, Tcl_Interp* interp)
{
// connect to RlinkServer
pserv->AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
pserv->AddAttnHandler(bind(&RtclAttnShuttle::AttnHandler, this, _1),
fMask, this);
fpServ = pserv;

View File

@ -1,6 +1,6 @@
// $Id: RtclRlinkConnect.cpp 1091 2018-12-23 12:38:29Z mueller $
// $Id: RtclRlinkConnect.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2011-2019 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,10 +13,11 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.6.9 use std::bind instead of lambda
// 2018-12-23 1091 1.6.8 use AddWblk(move)
// 2018-12-18 1089 1.6.7 use c++ style casts
// 2018-12-17 1085 1.6.6 use std::lock_guard instead of boost
// 2018-12-15 1082 1.6.5 use lambda instead of bind
// 2018-12-15 1082 1.6.5 use lambda instead of boost::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
@ -58,6 +59,7 @@
#include <ctype.h>
#include <iostream>
#include <functional>
#include "librtcltools/Rtcl.hpp"
#include "librtcltools/RtclOPtr.hpp"
@ -71,6 +73,7 @@
#include "RtclRlinkConnect.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRlinkConnect
@ -89,25 +92,25 @@ RtclRlinkConnect::RtclRlinkConnect(Tcl_Interp* interp, const char* name)
fGets(),
fSets()
{
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); });
AddMeth("open", bind(&RtclRlinkConnect::M_open, this, _1));
AddMeth("close", bind(&RtclRlinkConnect::M_close, this, _1));
AddMeth("init", bind(&RtclRlinkConnect::M_init, this, _1));
AddMeth("exec", bind(&RtclRlinkConnect::M_exec, this, _1));
AddMeth("amap", bind(&RtclRlinkConnect::M_amap, this, _1));
AddMeth("errcnt", bind(&RtclRlinkConnect::M_errcnt, this, _1));
AddMeth("wtlam", bind(&RtclRlinkConnect::M_wtlam, this, _1));
AddMeth("oob", bind(&RtclRlinkConnect::M_oob, this, _1));
AddMeth("rawread", bind(&RtclRlinkConnect::M_rawread, this, _1));
AddMeth("rawrblk", bind(&RtclRlinkConnect::M_rawrblk, this, _1));
AddMeth("rawwblk", bind(&RtclRlinkConnect::M_rawwblk, this, _1));
AddMeth("stats", bind(&RtclRlinkConnect::M_stats, this, _1));
AddMeth("log", bind(&RtclRlinkConnect::M_log, this, _1));
AddMeth("print", bind(&RtclRlinkConnect::M_print, this, _1));
AddMeth("dump", bind(&RtclRlinkConnect::M_dump, this, _1));
AddMeth("get", bind(&RtclRlinkConnect::M_get, this, _1));
AddMeth("set", bind(&RtclRlinkConnect::M_set, this, _1));
AddMeth("$default", bind(&RtclRlinkConnect::M_default, this, _1));
for (size_t i=0; i<8; i++) {
fCmdnameObj[i] = Tcl_NewStringObj(RlinkCommand::CommandName(i), -1);
}
@ -115,54 +118,54 @@ RtclRlinkConnect::RtclRlinkConnect(Tcl_Interp* interp, const char* name)
// attributes of RlinkConnect
RlinkConnect* pobj = &Obj();
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> ("baseaddr", bind(&RlinkConnect::LogBaseAddr, pobj));
fGets.Add<uint32_t> ("basedata", bind(&RlinkConnect::LogBaseData, pobj));
fGets.Add<uint32_t> ("basestat", bind(&RlinkConnect::LogBaseStat, pobj));
fGets.Add<uint32_t> ("printlevel", bind(&RlinkConnect::PrintLevel, pobj));
fGets.Add<uint32_t> ("dumplevel", bind(&RlinkConnect::DumpLevel, pobj));
fGets.Add<uint32_t> ("tracelevel", bind(&RlinkConnect::TraceLevel, pobj));
fGets.Add<const Rtime&> ("timeout", bind(&RlinkConnect::Timeout, pobj));
fGets.Add<const string&> ("logfile",bind(&RlinkConnect::LogFileName, 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<uint32_t> ("initdone", bind(&RlinkConnect::LinkInitDone, pobj));
fGets.Add<uint32_t> ("sysid", bind(&RlinkConnect::SysId, pobj));
fGets.Add<uint32_t> ("usracc", bind(&RlinkConnect::UsrAcc, pobj));
fGets.Add<size_t> ("rbufsize", bind(&RlinkConnect::RbufSize, pobj));
fGets.Add<size_t> ("bsizemax", bind(&RlinkConnect::BlockSizeMax, pobj));
fGets.Add<size_t> ("bsizeprudent",
[pobj](){ return pobj->BlockSizePrudent(); });
fGets.Add<bool> ("hasrbmon", [pobj](){ return pobj->HasRbmon(); });
bind(&RlinkConnect::BlockSizePrudent, pobj));
fGets.Add<bool> ("hasrbmon", bind(&RlinkConnect::HasRbmon, pobj));
fSets.Add<uint32_t> ("baseaddr",
[pobj](uint32_t v){ pobj->SetLogBaseAddr(v); });
bind(&RlinkConnect::SetLogBaseAddr, pobj, _1));
fSets.Add<uint32_t> ("basedata",
[pobj](uint32_t v){ pobj->SetLogBaseData(v); });
bind(&RlinkConnect::SetLogBaseData, pobj, _1));
fSets.Add<uint32_t> ("basestat",
[pobj](uint32_t v){ pobj->SetLogBaseStat(v); });
bind(&RlinkConnect::SetLogBaseStat, pobj, _1));
fSets.Add<uint32_t> ("printlevel",
[pobj](uint32_t v){ pobj->SetPrintLevel(v); });
bind(&RlinkConnect::SetPrintLevel, pobj, _1));
fSets.Add<uint32_t> ("dumplevel",
[pobj](uint32_t v){ pobj->SetDumpLevel(v); });
bind(&RlinkConnect::SetDumpLevel, pobj, _1));
fSets.Add<uint32_t> ("tracelevel",
[pobj](uint32_t v){ pobj->SetTraceLevel(v); });
bind(&RlinkConnect::SetTraceLevel, pobj, _1));
fSets.Add<const Rtime&> ("timeout",
[pobj](const Rtime& v){ pobj->SetTimeout(v); });
bind(&RlinkConnect::SetTimeout, pobj, _1));
fSets.Add<const string&> ("logfile",
[pobj](const string& v){ pobj->SetLogFileName(v); });
bind(&RlinkConnect::SetLogFileName, pobj, _1));
// attributes of buildin RlinkContext
RlinkContext* pcntx = &Obj().Context();
fGets.Add<bool> ("statchecked",
[pcntx](){ return pcntx->StatusIsChecked(); });
fGets.Add<bool> ("statchecked",
bind(&RlinkContext::StatusIsChecked, pcntx));
fGets.Add<uint8_t> ("statvalue",
[pcntx](){ return pcntx->StatusValue(); });
bind(&RlinkContext::StatusValue, pcntx));
fGets.Add<uint8_t> ("statmask",
[pcntx](){ return pcntx->StatusMask(); });
bind(&RlinkContext::StatusMask, pcntx));
fSets.Add<uint8_t> ("statvalue",
[pcntx](uint8_t v){ pcntx->SetStatusValue(v); });
bind(&RlinkContext::SetStatusValue, pcntx, _1));
fSets.Add<uint8_t> ("statmask",
[pcntx](uint8_t v){ pcntx->SetStatusMask(v); });
bind(&RlinkContext::SetStatusMask, pcntx, _1));
}
//------------------------------------------+-----------------------------------

View File

@ -1,6 +1,6 @@
// $Id: RtclRlinkPort.cpp 1091 2018-12-23 12:38:29Z mueller $
// $Id: RtclRlinkPort.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,9 +13,10 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.4.4 use std::bind instead of lambda
// 2018-12-22 1091 1.4.3 M_Open(): drop move() (-Wpessimizing-move fix)
// 2018-12-18 1089 1.4.2 use c++ style casts
// 2018-12-15 1082 1.4.1 use lambda instead of bind
// 2018-12-15 1082 1.4.1 use lambda instead of boost::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&
@ -37,6 +38,7 @@
#include <ctype.h>
#include <iostream>
#include <functional>
#include "librtcltools/Rtcl.hpp"
#include "librtcltools/RtclOPtr.hpp"
@ -49,6 +51,7 @@
#include "RtclRlinkPort.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRlinkPort
@ -71,18 +74,18 @@ RtclRlinkPort::RtclRlinkPort(Tcl_Interp* interp, const char* name)
fSets()
{
CreateObjectCmd(interp, name);
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); });
AddMeth("open", bind(&RtclRlinkPort::M_open, this, _1));
AddMeth("close", bind(&RtclRlinkPort::M_close, this, _1));
AddMeth("errcnt", bind(&RtclRlinkPort::M_errcnt, this, _1));
AddMeth("rawread", bind(&RtclRlinkPort::M_rawread, this, _1));
AddMeth("rawrblk", bind(&RtclRlinkPort::M_rawrblk, this, _1));
AddMeth("rawwblk", bind(&RtclRlinkPort::M_rawwblk, this, _1));
AddMeth("stats", bind(&RtclRlinkPort::M_stats, this, _1));
AddMeth("log", bind(&RtclRlinkPort::M_log, this, _1));
AddMeth("dump", bind(&RtclRlinkPort::M_dump, this, _1));
AddMeth("get", bind(&RtclRlinkPort::M_get, this, _1));
AddMeth("set", bind(&RtclRlinkPort::M_set, this, _1));
AddMeth("$default", bind(&RtclRlinkPort::M_default, this, _1));
SetupGetSet();
}
@ -255,17 +258,17 @@ void RtclRlinkPort::SetupGetSet()
{
fGets.Clear();
fSets.Clear();
fGets.Add<const string&> ("logfile", [this](){ return LogFileName(); });
fGets.Add<const string&> ("logfile",
bind(&RtclRlinkPort::LogFileName, this));
fSets.Add<const string&> ("logfile",
[this](const string& v){ SetLogFileName(v); });
bind(&RtclRlinkPort::SetLogFileName, this, _1));
if (!fupObj) return;
RlinkPort* pobj = fupObj.get();
fGets.Add<uint32_t> ("tracelevel", [pobj](){ return pobj->TraceLevel(); });
fGets.Add<uint32_t> ("tracelevel",
bind(&RlinkPort::TraceLevel, fupObj.get()));
fSets.Add<uint32_t> ("tracelevel",
[pobj](uint32_t v){pobj->SetTraceLevel(v); });
bind(&RlinkPort::SetTraceLevel, fupObj.get(), _1));
}
//------------------------------------------+-----------------------------------

View File

@ -1,6 +1,6 @@
// $Id: RtclRlinkServer.cpp 1088 2018-12-17 17:37:00Z mueller $
// $Id: RtclRlinkServer.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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
// 2019-02-23 1114 1.2.3 use std::bind instead of lambda
// 2018-12-17 1087 1.2.2 use std::lock_guard instead of boost
// 2018-12-14 1081 1.2.1 use std::bind instead of boost
// 2018-12-01 1076 1.2 use unique_ptr
@ -40,6 +41,7 @@
#include <vector>
#include <string>
#include <memory>
#include <functional>
#include "librtools/RosPrintBvi.hpp"
#include "librtcltools/Rtcl.hpp"
@ -51,6 +53,7 @@
#include "RtclRlinkServer.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRlinkServer
@ -70,35 +73,36 @@ RtclRlinkServer::RtclRlinkServer(Tcl_Interp* interp, const char* name)
fGets(),
fSets()
{
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); });
AddMeth("server", bind(&RtclRlinkServer::M_server, this, _1));
AddMeth("attn", bind(&RtclRlinkServer::M_attn, this, _1));
AddMeth("stats", bind(&RtclRlinkServer::M_stats, this, _1));
AddMeth("print", bind(&RtclRlinkServer::M_print, this, _1));
AddMeth("dump", bind(&RtclRlinkServer::M_dump, this, _1));
AddMeth("get", bind(&RtclRlinkServer::M_get, this, _1));
AddMeth("set", bind(&RtclRlinkServer::M_set, this, _1));
AddMeth("$default", bind(&RtclRlinkServer::M_default, this, _1));
// attributes of RlinkConnect
RlinkServer* pobj = &Obj();
fGets.Add<uint32_t> ("tracelevel", [pobj](){ return pobj->TraceLevel(); });
fGets.Add<uint32_t> ("tracelevel",
bind(&RlinkServer::TraceLevel, pobj));
fSets.Add<uint32_t> ("tracelevel",
[pobj](uint32_t v){ pobj->SetTraceLevel(v); });
fSets.Add<uint32_t> ("tracelevel",
bind(&RlinkServer::SetTraceLevel, pobj, _1));
// attributes of buildin RlinkContext
RlinkContext* pcntx = &Obj().Context();
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(); });
fGets.Add<bool> ("statchecked",
bind(&RlinkContext::StatusIsChecked, pcntx));
fGets.Add<uint8_t> ("statvalue",
bind(&RlinkContext::StatusValue, pcntx));
fGets.Add<uint8_t> ("statmask",
bind(&RlinkContext::StatusMask, pcntx));
fSets.Add<uint8_t> ("statvalue",
[pcntx](uint8_t v){ pcntx->SetStatusValue(v); });
bind(&RlinkContext::SetStatusValue, pcntx, _1));
fSets.Add<uint8_t> ("statmask",
[pcntx](uint8_t v){ pcntx->SetStatusMask(v); });
bind(&RlinkContext::SetStatusMask, pcntx, _1));
}
//------------------------------------------+-----------------------------------

View File

@ -1,4 +1,4 @@
// $Id: Rw11.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: Rw11.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -14,7 +14,7 @@
// Revision History:
// Date Rev Version Comment
// 2018-12-19 1090 1.1.4 use RosPrintf(bool)
// 2018-12-15 1082 1.1.3 use lambda instead of bind
// 2018-12-15 1082 1.1.3 use lambda instead of boost::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
@ -27,6 +27,8 @@
\brief Implemenation of Rw11.
*/
#include <functional>
#include "librtools/Rexception.hpp"
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintf.hpp"
@ -35,6 +37,7 @@
#include "Rw11.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11
@ -70,8 +73,7 @@ Rw11::~Rw11()
void Rw11::SetServer(const std::shared_ptr<RlinkServer>& spserv)
{
fspServ = spserv;
fspServ->AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
fspServ->AddAttnHandler(bind(&Rw11::AttnHandler, this, _1),
uint16_t(1)<<kLam, this);
return;
}

View File

@ -1,6 +1,6 @@
// $Id: Rw11CntlDEUNA.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: Rw11CntlDEUNA.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2014-2019 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,9 +13,10 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 0.5.8 use std::bind instead of lambda
// 2018-12-19 1090 0.5.7 use RosPrintf(bool)
// 2018-12-17 1087 0.5.6 use std::lock_guard instead of boost
// 2018-12-15 1082 0.5.5 use lambda instead of bind
// 2018-12-15 1082 0.5.5 use lambda instead of boost::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
@ -35,6 +36,7 @@
#include <unistd.h>
#include <sstream>
#include <functional>
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintBvi.hpp"
@ -48,6 +50,7 @@
#include "Rw11CntlDEUNA.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11CntlDEUNA
@ -354,8 +357,7 @@ void Rw11CntlDEUNA::Start()
UnitSetup(0);
// add attn handler
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
Server().AddAttnHandler(bind(&Rw11CntlDEUNA::AttnHandler, this, _1),
uint16_t(1)<<fLam, this);
fStarted = true;

View File

@ -1,6 +1,6 @@
// $Id: Rw11CntlDL11.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: Rw11CntlDL11.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.3.2 use lambda instead of bind
// 2019-02-23 1114 1.3.2 use std::bind instead of lambda
// 2018-12-15 1082 1.3.1 use lambda instead of boost::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
@ -31,6 +32,8 @@
\brief Implemenation of Rw11CntlDL11.
*/
#include <functional>
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintBvi.hpp"
#include "librtools/RosPrintf.hpp"
@ -40,6 +43,7 @@
#include "Rw11CntlDL11.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11CntlDL11
@ -122,8 +126,7 @@ void Rw11CntlDL11::Start()
fPC_xbuf = Cpu().AddRibr(fPrimClist, fBase+kXBUF);
// add attn handler
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
Server().AddAttnHandler(bind(&Rw11CntlDL11::AttnHandler, this, _1),
uint16_t(1)<<fLam, this);
fStarted = true;
return;

View File

@ -1,6 +1,6 @@
// $Id: Rw11CntlLP11.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: Rw11CntlLP11.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.2.5 use lambda instead of bind
// 2019-02-23 1114 1.2.6 use std::bind instead of lambda
// 2018-12-15 1082 1.2.5 use lambda instead of boost::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
@ -29,6 +30,8 @@
\brief Implemenation of Rw11CntlLP11.
*/
#include <functional>
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintBvi.hpp"
#include "librtools/RosPrintf.hpp"
@ -38,6 +41,7 @@
#include "Rw11CntlLP11.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11CntlLP11
@ -110,8 +114,7 @@ void Rw11CntlLP11::Start()
fPC_buf = Cpu().AddRibr(fPrimClist, fBase+kBUF);
// add attn handler
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
Server().AddAttnHandler(bind(&Rw11CntlLP11::AttnHandler, this, _1),
uint16_t(1)<<fLam, this);
fStarted = true;

View File

@ -1,6 +1,6 @@
// $Id: Rw11CntlPC11.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: Rw11CntlPC11.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.3.3 use lambda instead of bind
// 2019-02-23 1114 1.3.4 use std::bind instead of lambda
// 2018-12-15 1082 1.3.3 use lambda instead of boost::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
@ -29,6 +30,8 @@
\brief Implemenation of Rw11CntlPC11.
*/
#include <functional>
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintBvi.hpp"
#include "librtools/RosPrintf.hpp"
@ -38,6 +41,7 @@
#include "Rw11CntlPC11.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11CntlPC11
@ -121,8 +125,7 @@ void Rw11CntlPC11::Start()
fPC_pbuf = Cpu().AddRibr(fPrimClist, fBase+kPBUF);
// add attn handler
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
Server().AddAttnHandler(bind(&Rw11CntlPC11::AttnHandler, this, _1),
uint16_t(1)<<fLam, this);
fStarted = true;

View File

@ -1,6 +1,6 @@
// $Id: Rw11CntlRHRP.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: Rw11CntlRHRP.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2015-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Other credits:
// the boot code is from the simh project and Copyright Robert M Supnik
//
@ -15,8 +15,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.0.10 use std::bind instead of lambda
// 2018-12-19 1090 1.0.9 use RosPrintf(bool)
// 2018-12-15 1082 1.0.8 use std::bind or lambda instead of bind
// 2018-12-15 1082 1.0.8 use std::bind or lambda instead of boost::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
@ -33,6 +34,8 @@
\brief Implemenation of Rw11CntlRHRP.
*/
#include <functional>
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintBvi.hpp"
#include "librtools/RosPrintf.hpp"
@ -42,6 +45,7 @@
#include "Rw11CntlRHRP.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11CntlRHRP
@ -187,12 +191,8 @@ Rw11CntlRHRP::Rw11CntlRHRP()
fRd_fu(0),
fRd_ovr(false),
fRdma(this,
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))
std::bind(&Rw11CntlRHRP::RdmaPreExecCB, this, _1, _2, _3, _4),
std::bind(&Rw11CntlRHRP::RdmaPostExecCB, this, _1, _2, _3, _4))
{
// must be here because Units have a back-ptr (not available at Rw11CntlBase)
for (size_t i=0; i<NUnit(); i++) {
@ -275,8 +275,7 @@ void Rw11CntlRHRP::Start()
fPC_rpdc = Cpu().AddRibr(fPrimClist, fBase+kRPDC);
// add attn handler
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
Server().AddAttnHandler(bind(&Rw11CntlRHRP::AttnHandler, this, _1),
uint16_t(1)<<fLam, this);
fStarted = true;

View File

@ -1,6 +1,6 @@
// $Id: Rw11CntlRK11.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: Rw11CntlRK11.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Other credits:
// the boot code is from the simh project and Copyright Robert M Supnik
//
@ -15,8 +15,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 2.0.10 use std::bind instead of lambda
// 2018-12-19 1090 2.0.9 use RosPrintf(bool)
// 2018-12-15 1082 2.0.8 use std::bind or lambda instead of boost
// 2018-12-15 1082 2.0.8 use std::bind or lambda instead of boost::bind
// 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
@ -37,6 +38,8 @@
\brief Implemenation of Rw11CntlRK11.
*/
#include <functional>
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintBvi.hpp"
#include "librtools/RosPrintf.hpp"
@ -44,6 +47,7 @@
#include "librtools/RlogMsg.hpp"
#include "Rw11CntlRK11.hpp"
using namespace std::placeholders;
using namespace std;
@ -154,12 +158,8 @@ Rw11CntlRK11::Rw11CntlRK11()
fRd_fu(0),
fRd_ovr(false),
fRdma(this,
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))
std::bind(&Rw11CntlRK11::RdmaPreExecCB, this, _1, _2, _3, _4),
std::bind(&Rw11CntlRK11::RdmaPostExecCB, this, _1, _2, _3, _4))
{
// must be here because Units have a back-ptr (not available at Rw11CntlBase)
for (size_t i=0; i<NUnit(); i++) {
@ -220,8 +220,7 @@ void Rw11CntlRK11::Start()
fPC_rkcs = Cpu().AddRibr(fPrimClist, fBase+kRKCS);
// add attn handler
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
Server().AddAttnHandler(bind(&Rw11CntlRK11::AttnHandler, this, _1),
uint16_t(1)<<fLam, this);
fStarted = true;

View File

@ -1,6 +1,6 @@
// $Id: Rw11CntlRL11.cpp 1091 2018-12-23 12:38:29Z mueller $
// $Id: Rw11CntlRL11.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2014-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Other credits:
// the boot code is from the simh project and Copyright Robert M Supnik
// CalcCrc() is adopted from the simh project and Copyright Robert M Supnik
@ -16,9 +16,10 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.0.11 use std::bind instead of lambda
// 2018-12-22 1091 1.0.10 AttnHandler(): sa->san (-Wshadow fix)
// 2018-12-19 1090 1.0.9 use RosPrintf(bool)
// 2018-12-15 1082 1.0.8 use std::bind or lambda instead of bind
// 2018-12-15 1082 1.0.8 use std::bind or lambda instead of boost::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
@ -35,6 +36,8 @@
\brief Implemenation of Rw11CntlRL11.
*/
#include <functional>
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintBvi.hpp"
#include "librtools/RosPrintf.hpp"
@ -44,6 +47,7 @@
#include "Rw11CntlRL11.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11CntlRL11
@ -196,12 +200,8 @@ Rw11CntlRL11::Rw11CntlRL11()
fRd_fu(0),
fRd_ovr(false),
fRdma(this,
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))
std::bind(&Rw11CntlRL11::RdmaPreExecCB, this, _1, _2, _3, _4),
std::bind(&Rw11CntlRL11::RdmaPostExecCB, this, _1, _2, _3, _4))
{
// must be here because Units have a back-ptr (not available at Rw11CntlBase)
for (size_t i=0; i<NUnit(); i++) {
@ -261,8 +261,7 @@ void Rw11CntlRL11::Start()
fPC_pos = Cpu().AddRibr(fPrimClist, fBase+kRLMP);
// add attn handler
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
Server().AddAttnHandler(bind(&Rw11CntlRL11::AttnHandler, this, _1),
uint16_t(1)<<fLam, this);
fStarted = true;

View File

@ -1,6 +1,6 @@
// $Id: Rw11CntlTM11.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: Rw11CntlTM11.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2015-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Other credits:
// the boot code is from the simh project and Copyright Robert M Supnik
//
@ -15,7 +15,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.0.7 use std::bind or lambda instead of boost
// 2019-02-23 1114 1.0.8 use std::bind instead of lambda
// 2018-12-15 1082 1.0.7 use std::bind or lambda instead of boost::bind
// 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
@ -31,6 +32,8 @@
\brief Implemenation of Rw11CntlTM11.
*/
#include <functional>
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintBvi.hpp"
#include "librtools/RosPrintf.hpp"
@ -40,6 +43,7 @@
#include "Rw11CntlTM11.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11CntlTM11
@ -139,12 +143,8 @@ Rw11CntlTM11::Rw11CntlTM11()
fRd_opcode(0),
fBuf(),
fRdma(this,
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))
std::bind(&Rw11CntlTM11::RdmaPreExecCB, this, _1, _2, _3, _4),
std::bind(&Rw11CntlTM11::RdmaPostExecCB, this, _1, _2, _3, _4))
{
// must be here because Units have a back-ptr (not available at Rw11CntlBase)
for (size_t i=0; i<NUnit(); i++) {
@ -203,8 +203,7 @@ void Rw11CntlTM11::Start()
fPC_tmba = Cpu().AddRibr(fPrimClist, fBase+kTMBA);
// add attn handler
Server().AddAttnHandler([this](RlinkServer::AttnArgs& args)
{ return AttnHandler(args); },
Server().AddAttnHandler(bind(&Rw11CntlTM11::AttnHandler, this, _1),
uint16_t(1)<<fLam, this);
fStarted = true;

View File

@ -1,6 +1,6 @@
// $Id: Rw11Rdma.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: Rw11Rdma.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2015-2019 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,9 +13,10 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.1.5 use std::bind instead of lambda
// 2018-12-19 1090 1.1.4 use RosPrintf(bool)
// 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
// 2018-12-15 1082 1.1.2 use lambda instead of boost::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
@ -27,6 +28,7 @@
*/
#include <algorithm>
#include <functional>
#include "librtools/Rexception.hpp"
#include "librtools/RosFill.hpp"
@ -96,7 +98,7 @@ void Rw11Rdma::QueueRMem(uint32_t addr, uint16_t* block, size_t size,
{
fStats.Inc(kStatNQueRMem);
SetupRdma(false, addr, block, size, mode);
Server().QueueAction([this](){ return RdmaHandler(); });
Server().QueueAction(bind(&Rw11Rdma::RdmaHandler, this));
return;
}
@ -108,7 +110,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([this](){ return RdmaHandler(); });
Server().QueueAction(bind(&Rw11Rdma::RdmaHandler, this));
return;
}

View File

@ -1,6 +1,6 @@
// $Id: Rw11UnitDEUNA.cpp 1083 2018-12-15 19:19:16Z mueller $
// $Id: Rw11UnitDEUNA.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2014-2019 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,7 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-14 1081 1.0.3 use std::bind instead of boost
// 2018-12-14 1081 1.0.3 use std::bind instead of boost::bind
// 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
@ -25,12 +25,15 @@
\brief Implemenation of Rw11UnitDEUNA.
*/
#include <functional>
#include "librtools/RosFill.hpp"
#include "Rw11CntlDEUNA.hpp"
#include "Rw11UnitDEUNA.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11UnitDEUNA
@ -72,8 +75,7 @@ void Rw11UnitDEUNA::Dump(std::ostream& os, int ind, const char* text,
void Rw11UnitDEUNA::AttachDone()
{
Virt().SetupRcvCallback(std::bind(&Rw11CntlDEUNA::RcvCallback,
&Cntl(), placeholders::_1));
Virt().SetupRcvCallback(bind(&Rw11CntlDEUNA::RcvCallback, &Cntl(), _1));
Cntl().UnitSetup(0);
return;
}

View File

@ -1,4 +1,4 @@
// $Id: Rw11UnitTerm.cpp 1090 2018-12-21 12:17:35Z mueller $
// $Id: Rw11UnitTerm.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -30,6 +30,8 @@
\brief Implemenation of Rw11UnitTerm.
*/
#include <functional>
#include "librtools/RparseUrl.hpp"
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintf.hpp"
@ -38,6 +40,7 @@
#include "Rw11UnitTerm.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11UnitTerm
@ -295,8 +298,7 @@ void Rw11UnitTerm::Dump(std::ostream& os, int ind, const char* text,
void Rw11UnitTerm::AttachDone()
{
Virt().SetupRcvCallback(std::bind(&Rw11UnitTerm::RcvCallback,
this, placeholders::_1, placeholders::_2));
Virt().SetupRcvCallback(std::bind(&Rw11UnitTerm::RcvCallback, this, _1, _2));
return;
}

View File

@ -1,6 +1,6 @@
// $Id: Rw11VirtEthTap.cpp 1088 2018-12-17 17:37:00Z mueller $
// $Id: Rw11VirtEthTap.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2014-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.0.3 use lambda instead of bind
// 2019-02-23 1114 1.0.4 use std::bind instead of lambda
// 2018-12-15 1082 1.0.3 use lambda instead of boost::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)
@ -37,12 +38,15 @@
#include <net/if.h>
#include <linux/if_tun.h>
#include <functional>
#include "librtools/RosFill.hpp"
#include "librtools/Rtools.hpp"
#include "Rw11VirtEthTap.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11VirtEthTap
@ -105,8 +109,7 @@ bool Rw11VirtEthTap::Open(const std::string& url, RerrMsg& emsg)
fFd = fd;
Server().AddPollHandler([this](const pollfd& pfd)
{ return RcvPollHandler(pfd); },
Server().AddPollHandler(bind(&Rw11VirtEthTap::RcvPollHandler, this, _1),
fFd, POLLIN);
return true;
}

View File

@ -1,6 +1,6 @@
// $Id: Rw11VirtTermPty.cpp 1082 2018-12-15 13:56:20Z mueller $
// $Id: Rw11VirtTermPty.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.0.4 use lambda instead of bind
// 2019-02-23 1114 1.0.5 use std::bind instead of lambda
// 2018-12-15 1082 1.0.4 use lambda instead of boost::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
@ -32,10 +33,13 @@
#include <errno.h>
#include <unistd.h>
#include <functional>
#include "librtools/RosFill.hpp"
#include "Rw11VirtTermPty.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11VirtTermPty
@ -102,8 +106,7 @@ bool Rw11VirtTermPty::Open(const std::string& url, RerrMsg& emsg)
fFd = fd;
fChannelId = pname;
Server().AddPollHandler([this](const pollfd& pfd)
{ return RcvPollHandler(pfd); },
Server().AddPollHandler(bind(&Rw11VirtTermPty::RcvPollHandler, this, _1),
fFd, POLLIN);
return true;

View File

@ -1,6 +1,6 @@
// $Id: Rw11VirtTermTcp.cpp 1091 2018-12-23 12:38:29Z mueller $
// $Id: Rw11VirtTermTcp.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,10 +13,11 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.0.14 use std::bind instead of lambda
// 2018-12-22 1091 1.0.13 pfd->pfd1 (-Wshadow fix)
// 2018-12-19 1090 1.0.12 use RosPrintf(bool)
// 2018-12-18 1089 1.0.11 use c++ style casts
// 2018-12-15 1082 1.0.10 use lambda instead of bind
// 2018-12-15 1082 1.0.10 use lambda instead of boost::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)
@ -41,6 +42,7 @@
#include <unistd.h>
#include <sstream>
#include <functional>
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintf.hpp"
@ -50,6 +52,7 @@
#include "Rw11VirtTermTcp.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::Rw11VirtTermTcp
@ -188,8 +191,7 @@ bool Rw11VirtTermTcp::Open(const std::string& url, RerrMsg& emsg)
lmsg << "TermTcp: listen on " << fChannelId << " for " << Unit().Name();
}
Server().AddPollHandler([this](const pollfd& pfd)
{ return ListenPollHandler(pfd); },
Server().AddPollHandler(bind(&Rw11VirtTermTcp::ListenPollHandler, this, _1),
fFdListen, POLLIN);
return true;
@ -345,8 +347,7 @@ int Rw11VirtTermTcp::ListenPollHandler(const pollfd& pfd)
fState = ts_Stream;
Server().RemovePollHandler(fFdListen);
Server().AddPollHandler([this](const pollfd& pfd1)
{ return RcvPollHandler(pfd1); },
Server().AddPollHandler(bind(&Rw11VirtTermTcp::RcvPollHandler, this, _1),
fFd, POLLIN);
return 0;
}
@ -432,8 +433,7 @@ int Rw11VirtTermTcp::RcvPollHandler(const pollfd& pfd)
}
::close(fFd);
fFd = -1;
Server().AddPollHandler([this](const pollfd& pfd1)
{ return ListenPollHandler(pfd1); },
Server().AddPollHandler(bind(&Rw11VirtTermTcp::ListenPollHandler, this, _1),
fFdListen, POLLIN);
fState = ts_Listen;
return -1;

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11.cpp 1087 2018-12-17 08:25:37Z mueller $
// $Id: RtclRw11.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,8 +13,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.0.7 use std::bind instead of lambda
// 2018-12-17 1087 1.0.6 use std::lock_guard instead of boost
// 2018-12-15 1082 1.0.5 use lambda instead of bind
// 2018-12-15 1082 1.0.5 use lambda instead of boost::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
@ -33,6 +34,7 @@
#include <iostream>
#include <string>
#include <functional>
#include "librtools/RosPrintf.hpp"
#include "librtcltools/RtclContext.hpp"
@ -45,6 +47,7 @@
#include "RtclRw11.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11
@ -63,22 +66,20 @@ RtclRw11::RtclRw11(Tcl_Interp* interp, const char* name)
fGets(),
fSets()
{
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); });
AddMeth("get", bind(&RtclRw11::M_get, this, _1));
AddMeth("set", bind(&RtclRw11::M_set, this, _1));
AddMeth("start", bind(&RtclRw11::M_start, this, _1));
AddMeth("dump", bind(&RtclRw11::M_dump, this, _1));
AddMeth("$default", bind(&RtclRw11::M_default, this, _1));
Rw11* pobj = &Obj();
fGets.Add<bool> ("started", [pobj](){ return pobj->IsStarted(); });
fGets.Add<const string&> ("diskscheme",
[](){ return Rw11VirtDisk::DefaultScheme(); });
fGets.Add<Tcl_Obj*> ("cpus", [this](){ return CpuCommands(); });
fGets.Add<bool> ("started", bind(&Rw11::IsStarted, pobj));
fGets.Add<const string&> ("diskscheme", bind(&Rw11VirtDisk::DefaultScheme));
fSets.Add<const string&> ("diskscheme",
[](const string& v)
{ Rw11VirtDisk::SetDefaultScheme(v);} );
fSets.Add<const string&> ("diskscheme",
bind(&Rw11VirtDisk::SetDefaultScheme, _1));
fGets.Add<Tcl_Obj*> ("cpus",
bind(&RtclRw11::CpuCommands, this));
}
//------------------------------------------+-----------------------------------

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11Cntl.cpp 1085 2018-12-16 14:11:16Z mueller $
// $Id: RtclRw11Cntl.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,8 +13,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.1.5 use std::bind instead of lambda
// 2018-12-17 1085 1.1.4 use std::lock_guard instead of boost
// 2018-12-15 1082 1.1.3 use lambda instead of bind
// 2018-12-15 1082 1.1.3 use lambda instead of boost::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
@ -27,12 +28,15 @@
\brief Implemenation of RtclRw11Cntl.
*/
#include <functional>
#include "librtcltools/RtclStats.hpp"
#include "librtcltools/RtclOPtr.hpp"
#include "RtclRw11Cntl.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11Cntl
@ -52,16 +56,18 @@ RtclRw11Cntl::RtclRw11Cntl(const std::string& type,
fGets(),
fSets()
{
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); });
AddMeth("get", bind(&RtclRw11Cntl::M_get, this, _1));
AddMeth("set", bind(&RtclRw11Cntl::M_set, this, _1));
AddMeth("probe", bind(&RtclRw11Cntl::M_probe, this, _1));
AddMeth("start", bind(&RtclRw11Cntl::M_start, this, _1));
AddMeth("stats", bind(&RtclRw11Cntl::M_stats, this, _1));
AddMeth("dump", bind(&RtclRw11Cntl::M_dump, this, _1));
AddMeth("$default", bind(&RtclRw11Cntl::M_default, this, _1));
fGets.Add<Tcl_Obj*> ("units", [this](){ return UnitCommands(); });
fGets.Add<const string&> ("class", [this](){ return Class(); });
fGets.Add<Tcl_Obj*> ("units",
bind(&RtclRw11Cntl::UnitCommands, this));
fGets.Add<const string&> ("class",
bind(&RtclRw11Cntl::Class, this));
}
//------------------------------------------+-----------------------------------

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11CntlBase.ipp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclRw11CntlBase.ipp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,8 +13,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.2.4 use std::bind instead of lambda
// 2018-12-18 1089 1.2.3 use c++ style casts
// 2018-12-15 1082 1.2.2 use lambda instead of bind
// 2018-12-15 1082 1.2.2 use lambda instead of boost::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
@ -32,6 +33,8 @@
\brief FIXME_docs
*/
#include <functional>
#include "librtcltools/Rtcl.hpp"
#include "librtcltools/RtclOPtr.hpp"
@ -50,19 +53,21 @@ inline RtclRw11CntlBase<TC>::RtclRw11CntlBase(const std::string& type,
AddMeth("bootcode", [this](RtclArgs& args){ return M_bootcode(args); });
TC* pobj = fspObj.get();
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); });
fGets.Add<const std::string&>("type", std::bind(&TC::Type, pobj));
fGets.Add<const std::string&>("name", std::bind(&TC::Name, pobj));
fGets.Add<uint16_t> ("base", std::bind(&TC::Base, pobj));
fGets.Add<int> ("lam", std::bind(&TC::Lam, pobj));
fGets.Add<bool> ("found", std::bind(&TC::ProbeFound, pobj));
fGets.Add<uint16_t> ("pdataint", std::bind(&TC::ProbeDataInt, pobj));
fGets.Add<uint16_t> ("pdatarem", std::bind(&TC::ProbeDataRem, pobj));
fGets.Add<bool> ("enable", std::bind(&TC::Enable, pobj));
fGets.Add<bool> ("started", std::bind(&TC::IsStarted, pobj));
fGets.Add<uint32_t> ("trace", std::bind(&TC::TraceLevel,pobj));
fSets.Add<bool> ("enable", std::bind(&TC::SetEnable,pobj,
std::placeholders::_1));
fSets.Add<uint32_t> ("trace", std::bind(&TC::SetTraceLevel,pobj,
std::placeholders::_1));
}
//------------------------------------------+-----------------------------------

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11CntlDEUNA.cpp 1082 2018-12-15 13:56:20Z mueller $
// $Id: RtclRw11CntlDEUNA.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2014-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.0.1 use lambda instead of bind
// 2019-02-23 1114 1.0.2 use std::bind instead of lambda
// 2018-12-15 1082 1.0.1 use lambda instead of boost::bind
// 2017-04-16 878 1.0 Initial version
// 2014-06-09 561 0.1 First draft
// ---------------------------------------------------------------------------
@ -24,6 +25,7 @@
*/
#include <sstream>
#include <functional>
#include "librtcltools/RtclNameSet.hpp"
@ -31,6 +33,7 @@
#include "RtclRw11UnitDEUNA.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11CntlDEUNA
@ -47,19 +50,20 @@ RtclRw11CntlDEUNA::RtclRw11CntlDEUNA()
: RtclRw11CntlBase<Rw11CntlDEUNA>("Rw11CntlDEUNA","ether")
{
Rw11CntlDEUNA* pobj = &Obj();
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",
[pobj](const string& v){ pobj->SetType(v); });
fSets.Add<const string&> ("dpa",
[pobj](const string& v){ pobj->SetMacDefault(v); });
fSets.Add<const Rtime&> ("rxpoll",
[pobj](const Rtime& v){ pobj->SetRxPollTime(v); });
fSets.Add<size_t> ("rxqlim",
[pobj](size_t v){ pobj->SetRxQueLimit(v); });
fGets.Add<string> ("dpa", bind(&Rw11CntlDEUNA::MacDefault, pobj));
fGets.Add<const Rtime&> ("rxpoll", bind(&Rw11CntlDEUNA::RxPollTime, pobj));
fGets.Add<size_t> ("rxqlim", bind(&Rw11CntlDEUNA::RxQueLimit, pobj));
fGets.Add<bool> ("run", bind(&Rw11CntlDEUNA::Running, pobj));
fSets.Add<const string&> ("type",
bind(&Rw11CntlDEUNA::SetType,pobj, _1));
fSets.Add<const string&> ("dpa",
bind(&Rw11CntlDEUNA::SetMacDefault,pobj, _1));
fSets.Add<const Rtime&> ("rxpoll",
bind(&Rw11CntlDEUNA::SetRxPollTime,pobj, _1));
fSets.Add<size_t> ("rxqlim",
bind(&Rw11CntlDEUNA::SetRxQueLimit,pobj, _1));
}
//------------------------------------------+-----------------------------------

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11CntlDL11.cpp 1082 2018-12-15 13:56:20Z mueller $
// $Id: RtclRw11CntlDL11.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.1.1 use lambda instead of bind
// 2019-02-23 1114 1.1.2 use std::bind instead of lambda
// 2018-12-15 1082 1.1.1 use lambda instead of boost::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
@ -25,12 +26,15 @@
\brief Implemenation of RtclRw11CntlDL11.
*/
#include <functional>
#include "librtcltools/RtclNameSet.hpp"
#include "RtclRw11CntlDL11.hpp"
#include "RtclRw11UnitDL11.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11CntlDL11
@ -47,8 +51,8 @@ RtclRw11CntlDL11::RtclRw11CntlDL11()
: RtclRw11CntlTermBase<Rw11CntlDL11>("Rw11CntlDL11","term")
{
Rw11CntlDL11* pobj = &Obj();
fGets.Add<uint16_t> ("rxrlim", [pobj](){ return pobj->RxRlim(); });
fSets.Add<uint16_t> ("rxrlim", [pobj](uint16_t v){ pobj->SetRxRlim(v); });
fGets.Add<uint16_t> ("rxrlim", bind(&Rw11CntlDL11::RxRlim, pobj));
fSets.Add<uint16_t> ("rxrlim", bind(&Rw11CntlDL11::SetRxRlim,pobj, _1));
}
//------------------------------------------+-----------------------------------

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11CntlRdmaBase.ipp 1082 2018-12-15 13:56:20Z mueller $
// $Id: RtclRw11CntlRdmaBase.ipp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2017-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2017-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.2.1 use lambda instead of bind
// 2019-02-23 1114 1.2.2 use std::bind instead of lambda
// 2018-12-15 1082 1.2.1 use lambda instead of boost::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
@ -30,6 +31,8 @@
\brief FIXME_docs
*/
#include <functional>
#include "librtcltools/Rtcl.hpp"
#include "librtcltools/RtclOPtr.hpp"
@ -47,8 +50,9 @@ 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", [pobj](){ return pobj->ChunkSize(); });
sets.Add<size_t> ("chunksize", [pobj](size_t v){ pobj->SetChunkSize(v); });
gets.Add<size_t> ("chunksize", std::bind(&TC::ChunkSize, pobj));
sets.Add<size_t> ("chunksize", std::bind(&TC::SetChunkSize, pobj,
std::placeholders::_1));
}
//------------------------------------------+-----------------------------------

View File

@ -1,4 +1,4 @@
// $Id: RtclRw11Cpu.cpp 1112 2019-02-17 11:10:04Z mueller $
// $Id: RtclRw11Cpu.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@ -13,12 +13,12 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.2.26 use std::bind instead of lambda
// 2019-02-15 1112 1.2.25 add HasIbtst() getter
// add return type for lambdas with const type&
// 2018-12-23 1091 1.2.24 use AddWbibr(move),AddWblk(move)
// 2018-12-18 1089 1.2.23 use c++ style casts
// 2018-12-17 1085 1.2.22 use std::lock_guard instead of boost
// 2018-12-15 1082 1.2.21 use lambda instead of bind
// 2018-12-15 1082 1.2.21 use lambda instead of boost::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()
@ -68,6 +68,7 @@
#include <vector>
#include <memory>
#include <sstream>
#include <functional>
#include "librtools/RerrMsg.hpp"
#include "librtools/RlogMsg.hpp"
@ -89,6 +90,7 @@
#include "RtclRw11Cpu.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11Cpu
@ -106,25 +108,25 @@ RtclRw11Cpu::RtclRw11Cpu(const std::string& type)
fGets(),
fSets()
{
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); });
AddMeth("add", bind(&RtclRw11Cpu::M_add, this, _1));
AddMeth("imap", bind(&RtclRw11Cpu::M_imap, this, _1));
AddMeth("rmap", bind(&RtclRw11Cpu::M_rmap, this, _1));
AddMeth("cp", bind(&RtclRw11Cpu::M_cp, this, _1));
AddMeth("wtcpu", bind(&RtclRw11Cpu::M_wtcpu, this, _1));
AddMeth("deposit", bind(&RtclRw11Cpu::M_deposit, this, _1));
AddMeth("examine", bind(&RtclRw11Cpu::M_examine, this, _1));
AddMeth("lsmem", bind(&RtclRw11Cpu::M_lsmem, this, _1));
AddMeth("ldabs", bind(&RtclRw11Cpu::M_ldabs, this, _1));
AddMeth("ldasm", bind(&RtclRw11Cpu::M_ldasm, this, _1));
AddMeth("boot", bind(&RtclRw11Cpu::M_boot, this, _1));
AddMeth("get", bind(&RtclRw11Cpu::M_get, this, _1));
AddMeth("set", bind(&RtclRw11Cpu::M_set, this, _1));
AddMeth("stats", bind(&RtclRw11Cpu::M_stats, this, _1));
AddMeth("show", bind(&RtclRw11Cpu::M_show, this, _1));
AddMeth("dump", bind(&RtclRw11Cpu::M_dump, this, _1));
AddMeth("$default", bind(&RtclRw11Cpu::M_default, this, _1));
fGets.Add<Tcl_Obj*> ("cntls", [this](){ return ControllerCommands(); });
fGets.Add<Tcl_Obj*> ("cntls", bind(&RtclRw11Cpu::ControllerCommands, this));
}
//------------------------------------------+-----------------------------------
@ -1482,20 +1484,19 @@ int RtclRw11Cpu::M_default(RtclArgs& args)
void RtclRw11Cpu::SetupGetSet()
{
Rw11Cpu* pobj = &Obj();
fGets.Add<const string&>("type", [pobj]() -> const string&
{ 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> ("hasibtst", [pobj](){ return pobj->HasIbtst(); });
fGets.Add<bool> ("haskw11l", [pobj](){ return pobj->HasKw11l(); });
fGets.Add<bool> ("haskw11p", [pobj](){ return pobj->HasKw11p(); });
fGets.Add<bool> ("hasiist", [pobj](){ return pobj->HasIist(); });
fGets.Add<const string&>("type", bind(&Rw11Cpu::Type, pobj));
fGets.Add<size_t> ("index", bind(&Rw11Cpu::Index, pobj));
fGets.Add<uint16_t> ("base", bind(&Rw11Cpu::Base, pobj));
fGets.Add<uint16_t> ("ibase", bind(&Rw11Cpu::IBase, pobj));
fGets.Add<bool> ("hasscnt", bind(&Rw11Cpu::HasScnt, pobj));
fGets.Add<bool> ("haspcnt", bind(&Rw11Cpu::HasPcnt, pobj));
fGets.Add<bool> ("hascmon", bind(&Rw11Cpu::HasCmon, pobj));
fGets.Add<uint16_t> ("hashbpt", bind(&Rw11Cpu::HasHbpt, pobj));
fGets.Add<bool> ("hasibmon", bind(&Rw11Cpu::HasIbmon, pobj));
fGets.Add<bool> ("hasibtst", bind(&Rw11Cpu::HasIbtst, pobj));
fGets.Add<bool> ("haskw11l", bind(&Rw11Cpu::HasKw11l, pobj));
fGets.Add<bool> ("haskw11p", bind(&Rw11Cpu::HasKw11p, pobj));
fGets.Add<bool> ("hasiist", bind(&Rw11Cpu::HasIist, pobj));
return;
}

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11Unit.cpp 1085 2018-12-16 14:11:16Z mueller $
// $Id: RtclRw11Unit.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,8 +13,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.3.3 use std::bind instead of lambda
// 2018-12-17 1085 1.3.2 use std::lock_guard instead of boost
// 2018-12-15 1082 1.3.1 use lambda instead of bind
// 2018-12-15 1082 1.3.1 use lambda instead of boost::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
@ -28,12 +29,15 @@
\brief Implemenation of RtclRw11Unit.
*/
#include <functional>
#include "librtools/Rexception.hpp"
#include "librtcltools/RtclStats.hpp"
#include "RtclRw11Unit.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11Unit
@ -52,12 +56,12 @@ RtclRw11Unit::RtclRw11Unit(const std::string& type)
fSets(),
fupVirt()
{
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); });
AddMeth("get", bind(&RtclRw11Unit::M_get, this, _1));
AddMeth("set", bind(&RtclRw11Unit::M_set, this, _1));
AddMeth("attach", bind(&RtclRw11Unit::M_attach, this, _1));
AddMeth("detach", bind(&RtclRw11Unit::M_detach, this, _1));
AddMeth("dump", bind(&RtclRw11Unit::M_dump, this, _1));
AddMeth("$default", bind(&RtclRw11Unit::M_default, this, _1));
}
//------------------------------------------+-----------------------------------

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11UnitBase.ipp 1082 2018-12-15 13:56:20Z mueller $
// $Id: RtclRw11UnitBase.ipp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.3.5 use lambda instead of bind
// 2019-02-23 1114 1.3.6 use std::bind instead of lambda
// 2018-12-15 1082 1.3.5 use lambda instead of boost::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
@ -30,6 +31,8 @@
\brief Implemenation (all inline) of RtclRw11UnitBase.
*/
#include <functional>
#include "librtcltools/RtclStats.hpp"
#include "RtclRw11VirtFactory.hpp"
@ -62,7 +65,8 @@ inline RtclRw11UnitBase<TU,TUV,TB>::RtclRw11UnitBase(const std::string& type,
: TB(type),
fspObj(spunit)
{
this->AddMeth("stats", [this](RtclArgs& args){ return M_stats(args); });
this->AddMeth("stats", std::bind(&RtclRw11UnitBase<TU,TUV,TB>::M_stats,
this, std::placeholders::_1));
TU* pobj = fspObj.get();
@ -73,13 +77,11 @@ 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", [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(); });
gets.Add<size_t> ("index", std::bind(&TU::Index, pobj));
gets.Add<std::string> ("name", std::bind(&TU::Name, pobj));
gets.Add<bool> ("enabled", std::bind(&TU::Enabled, pobj));
gets.Add<bool> ("attached", std::bind(&TU::IsAttached, pobj));
gets.Add<const std::string&> ("attachurl",std::bind(&TU::AttachUrl,pobj));
}
//------------------------------------------+-----------------------------------
@ -135,7 +137,8 @@ void RtclRw11UnitBase<TU,TUV,TB>::AttachDone()
std::unique_ptr<RtclRw11Virt> pvirt(RtclRw11VirtFactory(&Obj().Virt()));
if (!pvirt) return;
this->fupVirt = move(pvirt);
this->AddMeth("virt", [this](RtclArgs& args){ return this->M_virt(args); });
this->AddMeth("virt", std::bind(&RtclRw11Unit::M_virt, this,
std::placeholders::_1));
return;
}

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11UnitDisk.cpp 1082 2018-12-15 13:56:20Z mueller $
// $Id: RtclRw11UnitDisk.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.2.2 use lambda instead of bind
// 2019-02-23 1114 1.2.3 use std::bind instead of lambda
// 2018-12-15 1082 1.2.2 use lambda instead of boost::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
@ -27,9 +28,12 @@
\brief Implemenation of RtclRw11UnitDisk.
*/
#include <functional>
#include "RtclRw11UnitDisk.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11UnitDisk
@ -63,16 +67,16 @@ void RtclRw11UnitDisk::SetupGetSet()
Rw11UnitDisk* pobj = &ObjUV();
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(); });
fGets.Add<const string&> ("type", bind(&Rw11UnitDisk::Type, pobj));
fGets.Add<size_t> ("ncylinder", bind(&Rw11UnitDisk::NCylinder, pobj));
fGets.Add<size_t> ("nhead", bind(&Rw11UnitDisk::NHead, pobj));
fGets.Add<size_t> ("nsector", bind(&Rw11UnitDisk::NSector, pobj));
fGets.Add<size_t> ("blocksize", bind(&Rw11UnitDisk::BlockSize, pobj));
fGets.Add<size_t> ("nblock", bind(&Rw11UnitDisk::NBlock, pobj));
fGets.Add<bool> ("wprot", bind(&Rw11UnitDisk::WProt, pobj));
fSets.Add<const string&> ("type",
[pobj](const string& v){ pobj->SetType(v); });
fSets.Add<const string&> ("type", bind(&Rw11UnitDisk::SetType,pobj, _1));
return;
}

View File

@ -1,4 +1,4 @@
// $Id: RtclRw11UnitStream.cpp 1082 2018-12-15 13:56:20Z mueller $
// $Id: RtclRw11UnitStream.cpp 1114 2019-02-23 18:01:55Z 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-15 1082 1.1.2 use lambda instead of bind
// 2019-02-23 1114 1.1.3 use std::bind instead of lambda
// 2018-12-15 1082 1.1.2 use lambda instead of boost::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
@ -24,9 +25,12 @@
\brief Implemenation of RtclRw11UnitStream.
*/
#include <functional>
#include "RtclRw11UnitStream.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11UnitStream
@ -61,9 +65,10 @@ void RtclRw11UnitStream::SetupGetSet()
Rw11UnitStream* pobj = &ObjUV();
fGets.Add<int> ("pos", [pobj](){ return pobj->Pos(); });
fGets.Add<int> ("pos", bind(&Rw11UnitStream::Pos, pobj));
fSets.Add<int> ("pos", bind(&Rw11UnitStream::SetPos,pobj, _1));
fSets.Add<int> ("pos", [pobj](int v){ pobj->SetPos(v); });
return;
}
} // end namespace Retro

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11UnitTape.cpp 1082 2018-12-15 13:56:20Z mueller $
// $Id: RtclRw11UnitTape.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2015-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2015-2019 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,7 +13,8 @@
//
// Revision History:
// Date Rev Version Comment
// 2018-12-15 1082 1.1.2 use lambda instead of bind
// 2019-02-23 1114 1.1.3 use std::bind instead of lambda
// 2018-12-15 1082 1.1.2 use lambda instead of boost::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
@ -25,9 +26,12 @@
\brief Implemenation of RtclRw11UnitTape.
*/
#include <functional>
#include "RtclRw11UnitTape.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11UnitTape
@ -60,26 +64,22 @@ void RtclRw11UnitTape::SetupGetSet()
// called in ctor of a more derived class.
Rw11UnitTape* pobj = &ObjUV();
fGets.Add<const string&> ("type", bind(&Rw11UnitTape::Type, pobj));
fGets.Add<bool> ("wprot", bind(&Rw11UnitTape::WProt, pobj));
fGets.Add<size_t> ("capacity", bind(&Rw11UnitTape::Capacity, pobj));
fGets.Add<bool> ("bot", bind(&Rw11UnitTape::Bot, pobj));
fGets.Add<bool> ("eot", bind(&Rw11UnitTape::Eot, pobj));
fGets.Add<bool> ("eom", bind(&Rw11UnitTape::Eom, pobj));
fGets.Add<int> ("posfile", bind(&Rw11UnitTape::PosFile, pobj));
fGets.Add<int> ("posrecord",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",
[pobj](const string& v){ pobj->SetType(v); });
fSets.Add<bool> ("wprot",
[pobj](bool v){ pobj->SetWProt(v); });
fSets.Add<size_t> ("capacity",
[pobj](size_t v){ pobj->SetCapacity(v); });
fSets.Add<int> ("posfile",
[pobj](int v){ pobj->SetPosFile(v); });
fSets.Add<int> ("posrecord",
[pobj](int v){ pobj->SetPosRecord(v); });
fSets.Add<const string&> ("type", bind(&Rw11UnitTape::SetType,pobj, _1));
fSets.Add<bool> ("wprot", bind(&Rw11UnitTape::SetWProt,pobj, _1));
fSets.Add<size_t> ("capacity", bind(&Rw11UnitTape::SetCapacity,pobj, _1));
fSets.Add<int> ("posfile", bind(&Rw11UnitTape::SetPosFile,pobj, _1));
fSets.Add<int> ("posrecord", bind(&Rw11UnitTape::SetPosRecord,pobj, _1));
return;
}

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11UnitTerm.cpp 1089 2018-12-19 10:45:41Z mueller $
// $Id: RtclRw11UnitTerm.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,8 +13,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.1.4 use std::bind instead of lambda
// 2018-12-18 1089 1.1.3 use c++ style casts
// 2018-12-15 1082 1.1.2 use lambda instead of bind
// 2018-12-15 1082 1.1.2 use lambda instead of boost::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
@ -27,9 +28,12 @@
\brief Implemenation of RtclRw11UnitTerm.
*/
#include <functional>
#include "RtclRw11UnitTerm.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11UnitTerm
@ -45,7 +49,7 @@ namespace Retro {
RtclRw11UnitTerm::RtclRw11UnitTerm(const std::string& type)
: RtclRw11Unit(type)
{
AddMeth("type", [this](RtclArgs& args){ return M_type(args); });
AddMeth("type", bind(&RtclRw11UnitTerm::M_type, this, _1));
}
//------------------------------------------+-----------------------------------
@ -80,17 +84,17 @@ void RtclRw11UnitTerm::SetupGetSet()
Rw11UnitTerm* pobj = &ObjUV();
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(); });
fGets.Add<const string&> ("channelid", bind(&Rw11UnitTerm::ChannelId, pobj));
fGets.Add<bool> ("to7bit", bind(&Rw11UnitTerm::To7bit, pobj));
fGets.Add<bool> ("toenpc", bind(&Rw11UnitTerm::ToEnpc, pobj));
fGets.Add<bool> ("ti7bit", bind(&Rw11UnitTerm::Ti7bit, pobj));
fGets.Add<const string&> ("log", bind(&Rw11UnitTerm::Log, pobj));
fSets.Add<bool> ("to7bit", bind(&Rw11UnitTerm::SetTo7bit,pobj, _1));
fSets.Add<bool> ("toenpc", bind(&Rw11UnitTerm::SetToEnpc,pobj, _1));
fSets.Add<bool> ("ti7bit", bind(&Rw11UnitTerm::SetTi7bit,pobj, _1));
fSets.Add<const string&> ("log", 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 1087 2018-12-17 08:25:37Z mueller $
// $Id: RtclRw11Virt.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2017-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2017-2019 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,8 +13,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.0.4 use std::bind instead of lambda
// 2018-12-17 1087 1.0.3 use std::lock_guard instead of boost
// 2018-12-15 1082 1.0.2 use lambda instead of bind
// 2018-12-15 1082 1.0.2 use lambda instead of boost::bind
// 2017-04-07 868 1.0.1 M_dump: use GetArgsDump and Dump detail
// 2017-03-11 859 1.0 Initial version
// ---------------------------------------------------------------------------
@ -24,11 +25,14 @@
\brief Implemenation of RtclRw11Virt.
*/
#include <functional>
#include "librtcltools/RtclStats.hpp"
#include "RtclRw11Virt.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11Virt
@ -48,10 +52,10 @@ RtclRw11Virt::RtclRw11Virt(Rw11Virt* pvirt)
fGets(),
fSets()
{
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); });
AddMeth("get", bind(&RtclRw11Virt::M_get, this, _1));
AddMeth("set", bind(&RtclRw11Virt::M_set, this, _1));
AddMeth("stats", bind(&RtclRw11Virt::M_stats, this, _1));
AddMeth("dump", bind(&RtclRw11Virt::M_dump, this, _1));
}
//------------------------------------------+-----------------------------------

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11VirtDiskOver.cpp 1087 2018-12-17 08:25:37Z mueller $
// $Id: RtclRw11VirtDiskOver.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 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,8 +13,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.0.3 use std::bind instead of lambda
// 2018-12-17 1087 1.0.2 use std::lock_guard instead of boost
// 2018-12-15 1082 1.0.1 use lambda instead of bind
// 2018-12-15 1082 1.0.1 use lambda instead of boost::bind
// 2017-03-11 859 1.0 Initial version
// ---------------------------------------------------------------------------
@ -23,9 +24,12 @@
\brief Implemenation of RtclRw11VirtDiskOver.
*/
#include <functional>
#include "RtclRw11VirtDiskOver.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11VirtDiskOver
@ -41,8 +45,8 @@ namespace Retro {
RtclRw11VirtDiskOver::RtclRw11VirtDiskOver(Rw11VirtDiskOver* pobj)
: RtclRw11VirtBase<Rw11VirtDiskOver>(pobj)
{
AddMeth("flush", [this](RtclArgs& args){ return M_flush(args); });
AddMeth("list", [this](RtclArgs& args){ return M_list(args); });
AddMeth("flush", bind(&RtclRw11VirtDiskOver::M_flush, this, _1));
AddMeth("list", bind(&RtclRw11VirtDiskOver::M_list, this, _1));
}
//------------------------------------------+-----------------------------------

View File

@ -1,6 +1,6 @@
// $Id: RtclRw11VirtDiskRam.cpp 1087 2018-12-17 08:25:37Z mueller $
// $Id: RtclRw11VirtDiskRam.cpp 1114 2019-02-23 18:01:55Z mueller $
//
// Copyright 2018- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2018-2019 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,8 +13,9 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-02-23 1114 1.0.3 use std::bind instead of lambda
// 2018-12-17 1087 1.0.2 use std::lock_guard instead of boost
// 2018-12-15 1082 1.0.1 use lambda instead of bind
// 2018-12-15 1082 1.0.1 use lambda instead of boost::bind
// 2018-10-28 1063 1.0 Initial version
// ---------------------------------------------------------------------------
@ -23,9 +24,12 @@
\brief Implemenation of RtclRw11VirtDiskRam.
*/
#include <functional>
#include "RtclRw11VirtDiskRam.hpp"
using namespace std;
using namespace std::placeholders;
/*!
\class Retro::RtclRw11VirtDiskRam
@ -41,7 +45,7 @@ namespace Retro {
RtclRw11VirtDiskRam::RtclRw11VirtDiskRam(Rw11VirtDiskRam* pobj)
: RtclRw11VirtBase<Rw11VirtDiskRam>(pobj)
{
AddMeth("list", [this](RtclArgs& args){ return M_list(args); });
AddMeth("list", bind(&RtclRw11VirtDiskRam::M_list, this, _1));
}
//------------------------------------------+-----------------------------------