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

Public Member Functions

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

Definition at line 665 of file InfoCommand.cc.

Constructor & Destructor Documentation

◆ InfoFunitsCommand()

InfoFunitsCommand::InfoFunitsCommand ( SimControlLanguageCommand parentCommand)
inline

Constructor.

Definition at line 670 of file InfoCommand.cc.

670  :
671  SimControlLanguageSubCommand(parentCommand) {
672  }

◆ ~InfoFunitsCommand()

virtual InfoFunitsCommand::~InfoFunitsCommand ( )
inlinevirtual

Destructor.

Definition at line 677 of file InfoCommand.cc.

677  {
678  }

Member Function Documentation

◆ execute()

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

Executes the "info funits" command.

"info funits" prints the names of all the function units in the machine.

Parameters
argumentsNo arguments should be given.
Returns
Always true.

Implements SimControlLanguageSubCommand.

Definition at line 689 of file InfoCommand.cc.

689  {
690 
691  const int argumentCount = arguments.size() - 2;
692 
693  if (!parent().checkArgumentCount(argumentCount, 0, 0)) {
694  return false;
695  }
696  if (!parent().checkMachineLoaded()) {
697  return false;
698  }
699  const TTAMachine::Machine& mach =
702  mach.functionUnitNavigator();
703  std::string result = "";
704  bool isFirst = true;
705  for (int i = 0; i < nav.count(); ++i) {
706  if (!isFirst)
707  result += "\n";
708  result += nav.item(i)->name();
709  isFirst = false;
710  }
711  result += "\n" + mach.controlUnit()->name();
712  parent().interpreter()->setResult(result);
713  return true;
714  }

References TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), CustomCommand::interpreter(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), TTAMachine::Component::name(), 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
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
SimulatorFrontend::machine
const TTAMachine::Machine & machine() const
Definition: SimulatorFrontend.cc:263
TTAMachine::Machine::Navigator::count
int count() const
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
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