31 virtual string help (
const vector<string>& tokens)
const;
33 virtual bool needRecord(
const vector<string>& tokens)
const;
46 virtual string help (
const vector<string>& tokens)
const;
57 virtual void execute(
const vector<TclObject>& tokens,
59 virtual string help (
const vector<string>& tokens)
const;
70 virtual void execute(
const vector<TclObject>& tokens,
72 virtual string help (
const vector<string>& tokens)
const;
83 virtual void execute(
const vector<TclObject>& tokens,
85 virtual string help (
const vector<string>& tokens)
const;
94 motherBoard.getCommandController(),
95 motherBoard.getStateChangeDistributor(),
96 motherBoard.getScheduler(), *this))
98 motherBoard.getCommandController(),
99 motherBoard.getStateChangeDistributor(),
100 motherBoard.getScheduler(), *this))
102 motherBoard.getMachineInfoCommand(), *this))
104 motherBoard.getMachineInfoCommand(), *this))
106 motherBoard.getMachineInfoCommand(), *this))
107 , cliComm(motherBoard.getMSXCliComm())
117 for (
auto& c : connectors) {
118 std::cerr <<
"ERROR: Connector still registered at shutdown: "
119 << c->getName() << std::endl;
126 connectors.push_back(&connector);
132 auto it = find(connectors.begin(), connectors.end(), &connector);
133 assert(it != connectors.end());
134 connectors.erase(it);
142 pluggables.push_back(std::move(pluggable));
155 , pluggingController(pluggingController_)
162 switch (tokens.size()) {
164 for (
auto& c : pluggingController.connectors) {
165 result << c->getName() <<
": "
166 << c->getPlugged().getName() <<
'\n';
171 auto& connector = pluggingController.getConnector(tokens[1]);
172 result << connector.getName() <<
": "
173 << connector.getPlugged().getName();
177 auto& connector = pluggingController.getConnector(tokens[1]);
178 auto& pluggable = pluggingController.getPluggable(tokens[2]);
179 if (&connector.getPlugged() == &pluggable) {
183 if (connector.getClass() != pluggable.getClass()) {
185 " doesn't fit in " + tokens[1]);
187 connector.unplug(time);
189 connector.plug(pluggable, time);
190 pluggingController.cliComm.
update(
205 return "Plugs a plug into a connector\n"
206 " plug [connector] [plug]";
211 if (tokens.size() == 2) {
213 vector<string_ref> connectors;
214 for (
auto& c : pluggingController.connectors) {
215 connectors.push_back(c->getName());
218 }
else if (tokens.size() == 3) {
220 vector<string_ref> pluggables;
221 auto* connector = pluggingController.
findConnector(tokens[1]);
222 string_ref className = connector ? connector->getClass() :
"";
223 for (
auto& p : pluggingController.pluggables) {
224 if (p->getClass() == className) {
225 pluggables.push_back(p->getName());
234 return tokens.size() == 3;
246 , pluggingController(pluggingController_)
252 if (tokens.size() != 2) {
255 auto& connector = pluggingController.getConnector(tokens[1]);
263 return "Unplugs a plug from a connector\n"
264 " unplug [connector]";
269 if (tokens.size() == 2) {
271 vector<string_ref> connectors;
272 for (
auto& c : pluggingController.connectors) {
273 connectors.push_back(c->getName());
281 for (
auto& c : connectors) {
282 if (c->getName() == name) {
294 throw CommandException(
"No such connector: " + name);
299 for (
auto& p : pluggables) {
300 if (p->getName() == name) {
312 throw CommandException(
"No such pluggable: " + name);
325 :
InfoTopic(machineInfoCommand,
"pluggable")
326 , pluggingController(pluggingController_)
333 switch (tokens.size()) {
335 for (
auto& p : pluggingController.pluggables) {
340 auto& pluggable = pluggingController.getPluggable(
341 tokens[2].getString());
342 result.
setString(pluggable.getDescription());
352 return "Shows a list of available pluggables. "
353 "Or show info on a specific pluggable.";
358 if (tokens.size() == 3) {
359 vector<string_ref> pluggables;
360 for (
auto& p : pluggingController.pluggables) {
361 pluggables.push_back(p->getName());
371 :
InfoTopic(machineInfoCommand,
"connector")
372 , pluggingController(pluggingController_)
379 switch (tokens.size()) {
381 for (
auto& c : pluggingController.connectors) {
386 auto& connector = pluggingController.getConnector(tokens[2].getString());
387 result.
setString(connector.getDescription());
397 return "Shows a list of available connectors.";
402 if (tokens.size() == 3) {
403 vector<string_ref> connectors;
404 for (
auto& c : pluggingController.connectors) {
405 connectors.push_back(c->getName());
416 :
InfoTopic(machineInfoCommand,
"connectionclass")
417 , pluggingController(pluggingController_)
424 switch (tokens.size()) {
426 std::set<string_ref> classes;
427 for (
auto& c : pluggingController.connectors) {
428 classes.insert(c->getClass());
430 for (
auto& p : pluggingController.pluggables) {
431 classes.insert(p->getClass());
437 const auto& arg = tokens[2].getString();
438 if (
auto* connector = pluggingController.
findConnector(arg)) {
442 if (
auto* pluggable = pluggingController.
findPluggable(arg)) {
456 return "Shows the class a connector or pluggable belongs to.";
461 if (tokens.size() == 3) {
462 vector<string_ref> names;
463 for (
auto& c : pluggingController.connectors) {
464 names.push_back(c->getName());
466 for (
auto& p : pluggingController.pluggables) {
467 names.push_back(p->getName());