w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11UnitTerm.cpp
Go to the documentation of this file.
1// $Id: RtclRw11UnitTerm.cpp 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.1.4 use std::bind instead of lambda
8// 2018-12-18 1089 1.1.3 use c++ style casts
9// 2018-12-15 1082 1.1.2 use lambda instead of boost::bind
10// 2018-10-06 1053 1.1.1 move using after includes (clang warning)
11// 2017-04-08 870 1.1 use Rw11UnitTerm& ObjUV(); inherit from RtclRw11Unit
12// 2013-04-26 511 1.0.1 add M_type
13// 2013-03-03 494 1.0 Initial version
14// 2013-03-01 493 0.1 First draft
15// ---------------------------------------------------------------------------
16
21#include <functional>
22
23#include "RtclRw11UnitTerm.hpp"
24
25using namespace std;
26using namespace std::placeholders;
27
33// all method definitions in namespace Retro
34namespace Retro {
35
36//------------------------------------------+-----------------------------------
38
39RtclRw11UnitTerm::RtclRw11UnitTerm(const std::string& type)
40 : RtclRw11Unit(type)
41{
42 AddMeth("type", bind(&RtclRw11UnitTerm::M_type, this, _1));
43}
44
45//------------------------------------------+-----------------------------------
47
49{}
50
51//------------------------------------------+-----------------------------------
53
55{
56 string text;
57 if (!args.GetArg("text", text)) return TCL_ERROR;
58 if (!args.AllDone()) return TCL_ERROR;
59
60 ObjUV().RcvCallback(reinterpret_cast<const uint8_t*>(text.data()),
61 text.size());
62
63 return TCL_OK;
64}
65
66//------------------------------------------+-----------------------------------
68
70{
71 // this can't be in ctor because pure virtual is called which is available
72 // only when more derived class is being constructed. SetupGetSet() must be
73 // called in ctor of a more derived class.
74
75 Rw11UnitTerm* pobj = &ObjUV();
76
77 fGets.Add<const string&> ("channelid", bind(&Rw11UnitTerm::ChannelId, pobj));
78 fGets.Add<bool> ("to7bit", bind(&Rw11UnitTerm::To7bit, pobj));
79 fGets.Add<bool> ("toenpc", bind(&Rw11UnitTerm::ToEnpc, pobj));
80 fGets.Add<bool> ("ti7bit", bind(&Rw11UnitTerm::Ti7bit, pobj));
81 fGets.Add<const string&> ("log", bind(&Rw11UnitTerm::Log, pobj));
82
83 fSets.Add<bool> ("to7bit", bind(&Rw11UnitTerm::SetTo7bit,pobj, _1));
84 fSets.Add<bool> ("toenpc", bind(&Rw11UnitTerm::SetToEnpc,pobj, _1));
85 fSets.Add<bool> ("ti7bit", bind(&Rw11UnitTerm::SetTi7bit,pobj, _1));
86 fSets.Add<const string&> ("log", bind(&Rw11UnitTerm::SetLog,pobj, _1));
87
88 return;
89}
90
91
92} // end namespace Retro
FIXME_docs.
Definition: RtclArgs.hpp:41
bool GetArg(const char *name, Tcl_Obj *&pval)
FIXME_docs.
Definition: RtclArgs.cpp:114
bool AllDone()
FIXME_docs.
Definition: RtclArgs.cpp:447
void AddMeth(const std::string &name, methfo_t &&methfo)
FIXME_docs.
void Add(const std::string &name, get_uptr_t &&upget)
FIXME_docs.
Definition: RtclGetList.cpp:52
virtual Rw11UnitTerm & ObjUV()=0
void SetupGetSet()
FIXME_docs.
RtclRw11UnitTerm(const std::string &type)
Constructor.
int M_type(RtclArgs &args)
FIXME_docs.
void Add(const std::string &name, set_uptr_t &&upset)
FIXME_docs.
Definition: RtclSetList.cpp:52
bool ToEnpc() const
FIXME_docs.
void SetToEnpc(bool toenpc)
FIXME_docs.
void SetTo7bit(bool to7bit)
FIXME_docs.
virtual bool RcvCallback(const uint8_t *buf, size_t count)
FIXME_docs.
bool Ti7bit() const
FIXME_docs.
bool To7bit() const
FIXME_docs.
const std::string & Log() const
FIXME_docs.
void SetTi7bit(bool ti7bit)
FIXME_docs.
void SetLog(const std::string &fname)
FIXME_docs.
const std::string & ChannelId() const
FIXME_docs.
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47