OpenASIP  2.0
Public Member Functions | List of all members
InfoIunitsCommand Class Reference
Inheritance diagram for InfoIunitsCommand:
Inheritance graph
Collaboration diagram for InfoIunitsCommand:
Collaboration graph

Public Member Functions

 InfoIunitsCommand (SimControlLanguageCommand &parentCommand)
 
virtual ~InfoIunitsCommand ()
 
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 iunits".

Definition at line 359 of file InfoCommand.cc.

Constructor & Destructor Documentation

◆ InfoIunitsCommand()

InfoIunitsCommand::InfoIunitsCommand ( SimControlLanguageCommand parentCommand)
inline

Constructor.

Definition at line 364 of file InfoCommand.cc.

364  :
365  SimControlLanguageSubCommand(parentCommand) {
366  }

◆ ~InfoIunitsCommand()

virtual InfoIunitsCommand::~InfoIunitsCommand ( )
inlinevirtual

Destructor.

Definition at line 371 of file InfoCommand.cc.

371  {
372  }

Member Function Documentation

◆ execute()

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

Executes the "info iunits" command.

"info iunits" prints the names of all the immediate units in the machine.

Parameters
argumentsNo arguments should be given.
Returns
Always true.

Implements SimControlLanguageSubCommand.

Definition at line 383 of file InfoCommand.cc.

383  {
384 
385  const int argumentCount = arguments.size() - 2;
386 
387  if (!parent().checkArgumentCount(argumentCount, 0, 0)) {
388  return false;
389  }
390  if (!parent().checkMachineLoaded()) {
391  return false;
392  }
393  const TTAMachine::Machine& mach =
396  mach.immediateUnitNavigator();
397  std::string result = "";
398  bool isFirst = true;
399  for (int i = 0; i < nav.count(); ++i) {
400  if (!isFirst)
401  result += "\n";
402  result += nav.item(i)->name();
403  isFirst = false;
404  }
405  parent().interpreter()->setResult(result);
406  return true;
407  }

References TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::immediateUnitNavigator(), CustomCommand::interpreter(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), SimControlLanguageSubCommand::parent(), ScriptInterpreter::setResult(), and SimControlLanguageCommand::simulatorFrontend().

Here is the call graph for this function:

The documentation for this class was generated from the following file:
SimControlLanguageSubCommand::parent
virtual SimControlLanguageCommand & parent()
Definition: SimControlLanguageCommand.cc:842
SimControlLanguageSubCommand::SimControlLanguageSubCommand
SimControlLanguageSubCommand(SimControlLanguageCommand &parentCommand)
Definition: SimControlLanguageCommand.cc:824
SimulatorFrontend::machine
const TTAMachine::Machine & machine() const
Definition: SimulatorFrontend.cc:263
TTAMachine::Machine::Navigator::count
int count() const
TTAMachine::Machine::immediateUnitNavigator
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition: Machine.cc:416
CustomCommand::interpreter
ScriptInterpreter * interpreter() const
ScriptInterpreter::setResult
virtual void setResult(DataObject *result)
Definition: ScriptInterpreter.cc:128
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
SimControlLanguageCommand::simulatorFrontend
SimulatorFrontend & simulatorFrontend()
Definition: SimControlLanguageCommand.cc:214
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
TTAMachine::Machine
Definition: Machine.hh:73