w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11Virt.cpp
Go to the documentation of this file.
1// $Id: RtclRw11Virt.cpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2017-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-06-07 1160 1.0.5 use RtclStats::Exec()
8// 2019-02-23 1114 1.0.4 use std::bind instead of lambda
9// 2018-12-17 1087 1.0.3 use std::lock_guard instead of boost
10// 2018-12-15 1082 1.0.2 use lambda instead of boost::bind
11// 2017-04-07 868 1.0.1 M_dump: use GetArgsDump and Dump detail
12// 2017-03-11 859 1.0 Initial version
13// ---------------------------------------------------------------------------
14
19#include <functional>
20
22
23#include "RtclRw11Virt.hpp"
24
25using namespace std;
26using namespace std::placeholders;
27
34// all method definitions in namespace Retro
35namespace Retro {
36
37//------------------------------------------+-----------------------------------
39
41 : RtclCmdBase(),
42 fpVirt(pvirt),
43 fGets(),
44 fSets()
45{
46 AddMeth("get", bind(&RtclRw11Virt::M_get, this, _1));
47 AddMeth("set", bind(&RtclRw11Virt::M_set, this, _1));
48 AddMeth("stats", bind(&RtclRw11Virt::M_stats, this, _1));
49 AddMeth("dump", bind(&RtclRw11Virt::M_dump, this, _1));
50}
51
52//------------------------------------------+-----------------------------------
54
56{}
57
58//------------------------------------------+-----------------------------------
60
62{
63 // synchronize with server thread
64 lock_guard<RlinkConnect> lock(Virt()->Cpu().Connect());
65 return fGets.M_get(args);
66}
67
68//------------------------------------------+-----------------------------------
70
72{
73 // synchronize with server thread
74 lock_guard<RlinkConnect> lock(Virt()->Cpu().Connect());
75 return fSets.M_set(args);
76}
77
78//------------------------------------------+-----------------------------------
80
82{
84 if (!RtclStats::GetArgs(args, cntx)) return kERR;
85 if (!RtclStats::Exec(args, cntx, Virt()->Stats())) return kERR;
86 return kOK;
87}
88
89//------------------------------------------+-----------------------------------
91
93{
94 int detail=0;
95 if (!GetArgsDump(args, detail)) return kERR;
96 if (!args.AllDone()) return kERR;
97
98 std::ostringstream sos;
99 Virt()->Dump(sos, 0, "", detail);
100 args.SetResult(sos);
101 return kOK;
102}
103
104} // end namespace Retro
FIXME_docs.
Definition: RtclArgs.hpp:41
void SetResult(const std::string &str)
FIXME_docs.
Definition: RtclArgs.ipp:76
bool AllDone()
FIXME_docs.
Definition: RtclArgs.cpp:447
void AddMeth(const std::string &name, methfo_t &&methfo)
FIXME_docs.
static const int kOK
Definition: RtclCmdBase.hpp:54
bool GetArgsDump(RtclArgs &args, int &detail)
FIXME_docs.
static const int kERR
Definition: RtclCmdBase.hpp:55
int M_get(RtclArgs &args)
FIXME_docs.
Definition: RtclGetList.cpp:73
int M_dump(RtclArgs &args)
FIXME_docs.
Rw11Virt * Virt() const
FIXME_docs.
int M_get(RtclArgs &args)
FIXME_docs.
~RtclRw11Virt()
FIXME_docs.
RtclRw11Virt(Rw11Virt *pvirt)
Constructor.
int M_stats(RtclArgs &args)
FIXME_docs.
int M_set(RtclArgs &args)
FIXME_docs.
int M_set(RtclArgs &args)
FIXME_docs.
Definition: RtclSetList.cpp:73
static bool Exec(RtclArgs &args, const Context &cntx, Rstats &stats)
FIXME_docs.
Definition: RtclStats.cpp:75
static bool GetArgs(RtclArgs &args, Context &cntx)
FIXME_docs.
Definition: RtclStats.cpp:37
FIXME_docs.
Definition: Rw11Virt.hpp:34
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
Definition: Rw11Virt.cpp:60
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47