OpenASIP  2.0
Public Member Functions | List of all members
QuitCommand Class Reference

#include <QuitCommand.hh>

Inheritance diagram for QuitCommand:
Inheritance graph
Collaboration diagram for QuitCommand:
Collaboration graph

Public Member Functions

 QuitCommand (const std::string &commandString="quit")
 
virtual ~QuitCommand ()
 
virtual bool execute (const std::vector< DataObject > &arguments)
 
virtual std::string helpText () const
 
- Public Member Functions inherited from CustomCommand
 CustomCommand (std::string name)
 
 CustomCommand (const CustomCommand &cmd)
 
virtual ~CustomCommand ()
 
std::string name () const
 
void setContext (InterpreterContext *context)
 
InterpreterContextcontext () const
 
void setInterpreter (ScriptInterpreter *si)
 
ScriptInterpreterinterpreter () const
 
bool checkArgumentCount (int argumentCount, int minimum, int maximum)
 
bool checkIntegerArgument (const DataObject &argument)
 
bool checkPositiveIntegerArgument (const DataObject &argument)
 
bool checkUnsignedIntegerArgument (const DataObject &argument)
 
bool checkDoubleArgument (const DataObject &argument)
 

Detailed Description

Implementation of the "quit" command of the Simulator Control Language.

Definition at line 46 of file QuitCommand.hh.

Constructor & Destructor Documentation

◆ QuitCommand()

QuitCommand::QuitCommand ( const std::string &  commandString = "quit")

Constructor.

Sets the name of the command to the base class.

Definition at line 48 of file QuitCommand.cc.

48  :
49  CustomCommand(commandString) {
50 }

◆ ~QuitCommand()

QuitCommand::~QuitCommand ( )
virtual

Destructor.

Does nothing.

Definition at line 57 of file QuitCommand.cc.

57  {
58 }

Member Function Documentation

◆ execute()

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

Executes the "quit" command.

This method does the uninitialization of the simulator.

Parameters
argumentsNo arguments needed.
Returns
Always true.
Exceptions
NumberFormatExceptionIs never thrown by this command.

Implements CustomCommand.

Definition at line 71 of file QuitCommand.cc.

71  {
72  const int argumentCount = arguments.size() - 1;
73  if (!checkArgumentCount(argumentCount, 0, 0)) {
74  return false;
75  }
76  dynamic_cast<SimulatorInterpreter*>(interpreter())->setQuitCommandGiven();
77  return true;
78 }

References CustomCommand::checkArgumentCount(), and CustomCommand::interpreter().

Here is the call graph for this function:

◆ helpText()

std::string QuitCommand::helpText ( ) const
virtual

Returns the help text for this command.

Help text is searched from SimulatorTextGenerator.

Returns
The help text.
Todo:
Use SimulatorTextGenerator to get the help text.

Implements CustomCommand.

Definition at line 89 of file QuitCommand.cc.

89  {
92 }

References Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), and Texts::TXT_INTERP_HELP_QUIT.

Here is the call graph for this function:

The documentation for this class was generated from the following files:
CustomCommand::checkArgumentCount
bool checkArgumentCount(int argumentCount, int minimum, int maximum)
Definition: CustomCommand.cc:82
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
SimulatorInterpreter
Definition: SimulatorInterpreter.hh:49
CustomCommand::CustomCommand
CustomCommand(std::string name)
Definition: CustomCommand.cc:48
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
Texts::TXT_INTERP_HELP_QUIT
@ TXT_INTERP_HELP_QUIT
Help text for command "quit" of the CLI.
Definition: SimulatorTextGenerator.hh:65
CustomCommand::interpreter
ScriptInterpreter * interpreter() const