w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RtclRw11CntlFactory.cpp
Go to the documentation of this file.
1// $Id: RtclRw11CntlFactory.cpp 1276 2022-08-12 10:25:13Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2013-2022 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2022-08-12 1276 1.1.6 add coverity accept comments
8// 2017-01-29 1146 1.1.5 add DZ11
9// 2017-01-29 847 1.1.4 add DEUNA
10// 2015-03-21 659 1.1.3 add RPRM (later renamed to RHRP)
11// 2015-01-04 630 1.1.2 RL11 back in
12// 2014-06-27 565 1.1.1 temporarily hide RL11
13// 2014-06-08 561 1.1.0 add RL11
14// 2013-05-01 513 1.0.1 add LP11
15// 2013-03-06 495 1.0 Initial version
16// 2013-02-09 489 0.1 First draft
17// ---------------------------------------------------------------------------
18
23#include "tcl.h"
24
26
27#include "RtclRw11CntlDL11.hpp"
28#include "RtclRw11CntlDZ11.hpp"
29#include "RtclRw11CntlRK11.hpp"
30#include "RtclRw11CntlRL11.hpp"
31#include "RtclRw11CntlRHRP.hpp"
32#include "RtclRw11CntlTM11.hpp"
33#include "RtclRw11CntlDEUNA.hpp"
34#include "RtclRw11CntlLP11.hpp"
35#include "RtclRw11CntlPC11.hpp"
36
37using namespace std;
38
39// all method definitions in namespace Retro (avoid using in includes...)
40namespace Retro {
41
42//------------------------------------------+-----------------------------------
44
46{
47 string type;
48 if (!args.GetArg("type", type)) return TCL_ERROR;
49
50 // 'factory section', create concrete Rw11Cntl objects
51 if (type == "dl11") { // dl11 --------------------------
52 unique_ptr<RtclRw11CntlDL11> pobj(new RtclRw11CntlDL11());
53 if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
54 /* coverity[resource_leak] */ // object permanent, no owner
55 pobj.release();
56
57 } else if (type == "dz11") { // dz11 --------------------------
58 unique_ptr<RtclRw11CntlDZ11> pobj(new RtclRw11CntlDZ11());
59 if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
60 /* coverity[resource_leak] */ // object permanent, no owner
61 pobj.release();
62
63 } else if (type == "rk11") { // rk11 --------------------------
64 unique_ptr<RtclRw11CntlRK11> pobj(new RtclRw11CntlRK11());
65 if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
66 /* coverity[resource_leak] */ // object permanent, no owner
67 pobj.release();
68
69 } else if (type == "rl11") { // rl11 --------------------------
70 unique_ptr<RtclRw11CntlRL11> pobj(new RtclRw11CntlRL11());
71 if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
72 /* coverity[resource_leak] */ // object permanent, no owner
73 pobj.release();
74
75 } else if (type == "rhrp") { // rhrp --------------------------
76 unique_ptr<RtclRw11CntlRHRP> pobj(new RtclRw11CntlRHRP());
77 if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
78 /* coverity[resource_leak] */ // object permanent, no owner
79 pobj.release();
80
81 } else if (type == "tm11") { // tm11 --------------------------
82 unique_ptr<RtclRw11CntlTM11> pobj(new RtclRw11CntlTM11());
83 if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
84 /* coverity[resource_leak] */ // object permanent, no owner
85 pobj.release();
86
87 } else if (type == "deuna") { // deuna -------------------------
88 unique_ptr<RtclRw11CntlDEUNA> pobj(new RtclRw11CntlDEUNA());
89 if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
90 /* coverity[resource_leak] */ // object permanent, no owner
91 pobj.release();
92
93 } else if (type == "lp11") { // lp11 --------------------------
94 unique_ptr<RtclRw11CntlLP11> pobj(new RtclRw11CntlLP11());
95 if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
96 /* coverity[resource_leak] */ // object permanent, no owner
97 pobj.release();
98
99 } else if (type == "pc11") { // pc11 --------------------------
100 unique_ptr<RtclRw11CntlPC11> pobj(new RtclRw11CntlPC11());
101 if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
102 /* coverity[resource_leak] */ // object permanent, no owner
103 pobj.release();
104
105 } else { // unknown cntl type -------------
106 return args.Quit(string("-E: unknown controller type '") + type + "'");
107 }
108
109 return TCL_OK;
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
int Quit(const std::string &str)
FIXME_docs.
Definition: RtclArgs.ipp:157
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47
int RtclRw11CntlFactory(RtclArgs &args, RtclRw11Cpu &cpu)
FIXME_docs.