w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclCmdBase.hpp
Go to the documentation of this file.
1// $Id: RtclCmdBase.hpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2018-12-16 1084 1.1.4 use =delete for noncopyable instead of boost
8// 2018-12-15 1083 1.1.3 AddMeth(): use rval ref and move semantics
9// 2018-12-14 1081 1.1.2 use std::function instead of boost
10// 2017-04-02 865 1.1.1 add GetArgsDump()
11// 2017-04-02 863 1.1 add DelMeth(),TstMeth(); add M_info() and '?'
12// rename fMapMeth -> fMethMap
13// 2013-04-26 511 1.0.1 AddMeth() now public
14// 2013-02-02 480 1.0 Initial version (refactored out from ProxyBase)
15// ---------------------------------------------------------------------------
16
21#ifndef included_Retro_RtclCmdBase
22#define included_Retro_RtclCmdBase 1
23
24#include "tcl.h"
25
26#include <string>
27#include <map>
28#include <functional>
29
30#include "RtclArgs.hpp"
31
32namespace Retro {
33
35 public:
36 typedef std::function<int(RtclArgs&)> methfo_t;
37
38 typedef std::map<std::string, methfo_t> mmap_t;
39 typedef mmap_t::iterator mmap_it_t;
40 typedef mmap_t::const_iterator mmap_cit_t;
41
43 virtual ~RtclCmdBase();
44
45 RtclCmdBase(const RtclCmdBase&) = delete; // noncopyable
46 RtclCmdBase& operator=(const RtclCmdBase&) = delete; // noncopyable
47
48 int DispatchCmd(RtclArgs& args);
49 void AddMeth(const std::string& name, methfo_t&& methfo);
50 void DelMeth(const std::string& name);
51 bool TstMeth(const std::string& name);
52
53 // some constants (also defined in cpp)
54 static const int kOK = TCL_OK;
55 static const int kERR = TCL_ERROR;
56
57 protected:
58 bool GetArgsDump(RtclArgs& args, int& detail);
59 int M_info(RtclArgs& args);
60
61 protected:
63 };
64
65} // end namespace Retro
66
67//#include "RtclCmdBase.ipp"
68
69#endif
FIXME_docs.
Definition: RtclArgs.hpp:41
RtclCmdBase(const RtclCmdBase &)=delete
std::map< std::string, methfo_t > mmap_t
Definition: RtclCmdBase.hpp:38
mmap_t::const_iterator mmap_cit_t
Definition: RtclCmdBase.hpp:40
void AddMeth(const std::string &name, methfo_t &&methfo)
FIXME_docs.
int M_info(RtclArgs &args)
FIXME_docs.
virtual ~RtclCmdBase()
Destructor.
Definition: RtclCmdBase.cpp:58
mmap_t::iterator mmap_it_t
Definition: RtclCmdBase.hpp:39
mmap_t fMethMap
map for named methods
Definition: RtclCmdBase.hpp:62
std::function< int(RtclArgs &)> methfo_t
Definition: RtclCmdBase.hpp:36
static const int kOK
Definition: RtclCmdBase.hpp:54
RtclCmdBase & operator=(const RtclCmdBase &)=delete
bool GetArgsDump(RtclArgs &args, int &detail)
FIXME_docs.
void DelMeth(const std::string &name)
FIXME_docs.
RtclCmdBase()
FIXME_docs.
Definition: RtclCmdBase.cpp:51
static const int kERR
Definition: RtclCmdBase.hpp:55
int DispatchCmd(RtclArgs &args)
FIXME_docs.
Definition: RtclCmdBase.cpp:64
bool TstMeth(const std::string &name)
FIXME_docs.
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47