w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11CntlBase.ipp
Go to the documentation of this file.
1// $Id: RtclRw11CntlBase.ipp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-02-23 1114 1.2.4 use std::bind instead of lambda
8// 2018-12-18 1089 1.2.3 use c++ style casts
9// 2018-12-15 1082 1.2.2 use lambda instead of boost::bind
10// 2018-12-07 1078 1.2.1 use std::shared_ptr instead of boost
11// 2017-04-16 877 1.2 add class in ctor
12// 2017-02-04 848 1.1 add in fGets: found,pdataint,pdatarem
13// 2013-03-06 495 1.0 Initial version
14// 2013-02-08 484 0.1 First draft
15// ---------------------------------------------------------------------------
16
26#include <functional>
27
28#include "librtcltools/Rtcl.hpp"
31// all method definitions in namespace Retro
32namespace Retro {
33
34//------------------------------------------+-----------------------------------
36
37template <class TC>
38inline RtclRw11CntlBase<TC>::RtclRw11CntlBase(const std::string& type,
39 const std::string& cclass)
40 : RtclRw11Cntl(type,cclass),
41 fspObj(new TC())
42{
43 AddMeth("bootcode", [this](RtclArgs& args){ return M_bootcode(args); });
44
45 TC* pobj = fspObj.get();
46 fGets.Add<const std::string&>("type", std::bind(&TC::Type, pobj));
47 fGets.Add<const std::string&>("name", std::bind(&TC::Name, pobj));
48 fGets.Add<uint16_t> ("base", std::bind(&TC::Base, pobj));
49 fGets.Add<int> ("lam", std::bind(&TC::Lam, pobj));
50 fGets.Add<bool> ("found", std::bind(&TC::ProbeFound, pobj));
51 fGets.Add<uint16_t> ("pdataint", std::bind(&TC::ProbeDataInt, pobj));
52 fGets.Add<uint16_t> ("pdatarem", std::bind(&TC::ProbeDataRem, pobj));
53 fGets.Add<bool> ("enable", std::bind(&TC::Enable, pobj));
54 fGets.Add<bool> ("started", std::bind(&TC::IsStarted, pobj));
55 fGets.Add<uint32_t> ("trace", std::bind(&TC::TraceLevel,pobj));
56
57 fSets.Add<bool> ("enable", std::bind(&TC::SetEnable,pobj,
58 std::placeholders::_1));
59 fSets.Add<uint32_t> ("trace", std::bind(&TC::SetTraceLevel,pobj,
60 std::placeholders::_1));
61}
62
63//------------------------------------------+-----------------------------------
65
66template <class TC>
68{}
69
70//------------------------------------------+-----------------------------------
72
73template <class TC>
75{
76 return *fspObj;
77}
78
79//------------------------------------------+-----------------------------------
81
82template <class TC>
83inline const std::shared_ptr<TC>& RtclRw11CntlBase<TC>::ObjSPtr()
84{
85 return fspObj;
86}
87
88//------------------------------------------+-----------------------------------
90
91template <class TC>
93{
94 int unit = 0;
95 if (!args.GetArg("?unit", unit, 0, Obj().NUnit()-1)) return kERR;
96 if (!args.AllDone()) return kERR;
97
98 std::vector<uint16_t> code;
99 uint16_t aload;
100 uint16_t astart;
101 if (Obj().BootCode(unit, code, aload, astart)) {
102 RtclOPtr pres(Tcl_NewListObj(0, NULL));
103 Tcl_ListObjAppendElement(NULL, pres, Tcl_NewIntObj(int(aload)));
104 Tcl_ListObjAppendElement(NULL, pres, Tcl_NewIntObj(int(astart)));
105 Tcl_ListObjAppendElement(NULL, pres, Rtcl::NewListIntObj(code));
106 args.SetResult(pres);
107 }
108
109 return kOK;
110}
111
112} // end namespace Retro
FIXME_docs.
Definition: RtclArgs.hpp:41
bool GetArg(const char *name, Tcl_Obj *&pval)
FIXME_docs.
Definition: RtclArgs.cpp:114
void SetResult(const std::string &str)
FIXME_docs.
Definition: RtclArgs.ipp:76
bool AllDone()
FIXME_docs.
Definition: RtclArgs.cpp:447
Implemenation (inline) of RtclOPtr.
Definition: RtclOPtr.hpp:23
Implemenation (all inline) of RtclRw11CntlBase.
RtclRw11CntlBase(const std::string &type, const std::string &cclass)
Constructor.
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47