OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
InfoBussesCommand Class Reference
Inheritance diagram for InfoBussesCommand:
Inheritance graph
Collaboration diagram for InfoBussesCommand:
Collaboration graph

Public Member Functions

 InfoBussesCommand (SimControlLanguageCommand &parentCommand)
 
virtual ~InfoBussesCommand ()
 
virtual bool execute (const std::vector< DataObject > &arguments)
 
- Public Member Functions inherited from SimControlLanguageSubCommand
 SimControlLanguageSubCommand (SimControlLanguageCommand &parentCommand)
 
virtual ~SimControlLanguageSubCommand ()
 
virtual SimControlLanguageCommandparent ()
 

Detailed Description

Implementation of "info busses".

Definition at line 413 of file InfoCommand.cc.

Constructor & Destructor Documentation

◆ InfoBussesCommand()

InfoBussesCommand::InfoBussesCommand ( SimControlLanguageCommand parentCommand)
inline

Constructor.

Definition at line 418 of file InfoCommand.cc.

◆ ~InfoBussesCommand()

virtual InfoBussesCommand::~InfoBussesCommand ( )
inlinevirtual

Destructor.

Definition at line 425 of file InfoCommand.cc.

425 {
426 }

Member Function Documentation

◆ execute()

virtual bool InfoBussesCommand::execute ( const std::vector< DataObject > &  arguments)
inlinevirtual

Executes the "info busses" command.

"info busses" prints information of the busses of the machine.

Parameters
argumentsNo arguments should be given.
Returns
Always true.

Implements SimControlLanguageSubCommand.

Definition at line 436 of file InfoCommand.cc.

436 {
437
438 const int argumentCount = arguments.size() - 2;
439
440 if (!parent().checkArgumentCount(argumentCount, 0, 1)) {
441 return false;
442 }
443 const TTAMachine::Machine& mach =
445
446 if (argumentCount == 0) {
448 mach.busNavigator();
449 std::string result = "";
450 bool isFirst = true;
451 for (int i = 0; i < nav.count(); ++i) {
452 if (!isFirst)
453 result += "\n";
454 TTAMachine::Bus* bus = nav.item(i);
455 assert(bus != NULL);
456 result += bus->name() + ": ";
457 bool isFirstSegment = true;
458 for (int j = 0; j < bus->segmentCount(); ++j) {
459 if (!isFirstSegment)
460 result += " ";
461 result += bus->segment(j)->name();
462 isFirstSegment = false;
463 }
464 isFirst = false;
465 }
466 parent().interpreter()->setResult(result);
467 return true;
468 } else if (argumentCount == 1) {
470 mach.busNavigator();
471 const std::string busName = arguments.at(2).stringValue();
472
473 if (!nav.hasItem(busName)) {
477 return false;
478 }
479
480 TTAMachine::Bus* bus = nav.item(busName);
481 assert(bus != NULL);
482 std::string result = "";
483 result += bus->name() + ": ";
484 bool isFirstSegment = true;
485 for (int j = 0; j < bus->segmentCount(); ++j) {
486 if (!isFirstSegment)
487 result += " ";
488 result += bus->segment(j)->name();
489 isFirstSegment = false;
490 }
491 parent().interpreter()->setResult(result);
492 return true;
493 }
494 return false;
495 }
#define assert(condition)
ScriptInterpreter * interpreter() const
virtual void setError(bool state)
virtual void setResult(DataObject *result)
virtual SimControlLanguageCommand & parent()
const TTAMachine::Machine & machine() const
static SimulatorTextGenerator & textGenerator()
virtual Segment * segment(int index) const
Definition Bus.cc:329
virtual int segmentCount() const
Definition Bus.cc:385
virtual TCEString name() const
ComponentType * item(int index) const
bool hasItem(const std::string &name) const
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
std::string name() const

References assert, TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), CustomCommand::interpreter(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), TTAMachine::Component::name(), TTAMachine::Segment::name(), SimControlLanguageSubCommand::parent(), TTAMachine::Bus::segment(), TTAMachine::Bus::segmentCount(), ScriptInterpreter::setError(), ScriptInterpreter::setResult(), SimControlLanguageCommand::simulatorFrontend(), SimulatorToolbox::textGenerator(), and Texts::TXT_BUS_NOT_FOUND.

Here is the call graph for this function:

The documentation for this class was generated from the following file: