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

Public Member Functions

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

Definition at line 595 of file InfoCommand.cc.

Constructor & Destructor Documentation

◆ InfoSegmentsCommand()

InfoSegmentsCommand::InfoSegmentsCommand ( SimControlLanguageCommand parentCommand)
inline

Constructor.

Definition at line 600 of file InfoCommand.cc.

◆ ~InfoSegmentsCommand()

virtual InfoSegmentsCommand::~InfoSegmentsCommand ( )
inlinevirtual

Destructor.

Definition at line 607 of file InfoCommand.cc.

607 {
608 }

Member Function Documentation

◆ execute()

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

Executes the "info segments" command.

Prints the values of segments in the given bus.

Parameters
argumentsNo arguments should be given.
Returns
Always true.

Implements SimControlLanguageSubCommand.

Definition at line 618 of file InfoCommand.cc.

618 {
619
620 const int argumentCount = arguments.size() - 2;
621
622 if (!parent().checkArgumentCount(argumentCount, 1, 2)) {
623 return false;
624 }
625 if (!parent().checkMachineLoaded()) {
626 return false;
627 }
628 const TTAMachine::Machine& mach =
630
631 const std::string busName = arguments.at(2).stringValue();
632
634 mach.busNavigator();
635
636 if (!nav.hasItem(busName)) {
640 return false;
641 }
642
643 TTAMachine::Bus* bus = nav.item(busName);
644 assert(bus != NULL);
646
647 if (argumentCount == 1) {
648 std::string result = "";
649 BusState& busState = state.busState(busName);
650 parent().interpreter()->setResult(busState.value().intValue());
651 return true;
652 } else if (argumentCount == 2) {
654 "Segmented busses not yet supported.");
655 return false;
656 }
657 return false;
658 }
#define assert(condition)
ScriptInterpreter * interpreter() const
BusState & busState(const std::string &name)
virtual const SimValue & value() const
virtual void setError(bool state)
virtual void setResult(DataObject *result)
virtual SimControlLanguageCommand & parent()
int intValue() const
Definition SimValue.cc:895
const TTAMachine::Machine & machine() const
MachineState & machineState(int core=-1)
static SimulatorTextGenerator & textGenerator()
ComponentType * item(int index) const
bool hasItem(const std::string &name) const
virtual BusNavigator busNavigator() const
Definition Machine.cc:356

References assert, TTAMachine::Machine::busNavigator(), MachineState::busState(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), CustomCommand::interpreter(), SimValue::intValue(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), SimulatorFrontend::machineState(), SimControlLanguageSubCommand::parent(), ScriptInterpreter::setError(), ScriptInterpreter::setResult(), SimControlLanguageCommand::simulatorFrontend(), SimulatorToolbox::textGenerator(), Texts::TXT_BUS_NOT_FOUND, and RegisterState::value().

Here is the call graph for this function:

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