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

#include <TestOsal.hh>

Inheritance diagram for CmdAdvanceClock:
Inheritance graph
Collaboration diagram for CmdAdvanceClock:
Collaboration graph

Public Member Functions

 CmdAdvanceClock ()
 
 CmdAdvanceClock (const CmdAdvanceClock &cmd)
 
virtual ~CmdAdvanceClock ()
 
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

Advances clock by one cycle.

Definition at line 195 of file TestOsal.hh.

Constructor & Destructor Documentation

◆ CmdAdvanceClock() [1/2]

CmdAdvanceClock::CmdAdvanceClock ( )

Constructor.

Definition at line 840 of file TestOsal.cc.

840  : CustomCommand("advanceclock") {
841 }

◆ CmdAdvanceClock() [2/2]

CmdAdvanceClock::CmdAdvanceClock ( const CmdAdvanceClock cmd)
explicit

Copy constructor.

Parameters
cmdCommand to be copied.

Definition at line 848 of file TestOsal.cc.

848  :
849  CustomCommand(cmd) {
850 }

◆ ~CmdAdvanceClock()

CmdAdvanceClock::~CmdAdvanceClock ( )
virtual

Destructor.

Definition at line 855 of file TestOsal.cc.

855  {
856 }

Member Function Documentation

◆ execute()

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

Executes the command.

Parameters
argumentsArguments for the command.
Returns
True if execution is successful.
Exceptions
NumberFormatExceptionIf DataObject conversion fails.

Implements CustomCommand.

Definition at line 866 of file TestOsal.cc.

866  {
867  ScriptInterpreter* scriptInterp = interpreter();
868  OsalInterpreter* interp = dynamic_cast<OsalInterpreter*>(scriptInterp);
869  assert(interp != NULL);
870 
871  DataObject* result = new DataObject();
872 
873  if (arguments.size() != 1) {
874  result->setString("wrong number of arguments");
875  interp->setResult(result);
876  return false;
877  }
878 
880  *(dynamic_cast<TesterContext*>(&interp->context()));
881 
882  Memory& memory = context.operationContext().memory();
883  memory.advanceClock();
884  context.operationContext().advanceClock();
885  result->setString("");
886  interp->setResult(result);
887  return true;
888 }

References Memory::advanceClock(), assert, CustomCommand::context(), SimpleScriptInterpreter::context(), CustomCommand::interpreter(), ScriptInterpreter::setResult(), and DataObject::setString().

Here is the call graph for this function:

◆ helpText()

string CmdAdvanceClock::helpText ( ) const
virtual

Returns the help text of the command.

Returns
The help text.

Implements CustomCommand.

Definition at line 896 of file TestOsal.cc.

896  {
897  return "Advances clock per one cycle";
898 }

The documentation for this class was generated from the following files:
DataObject
Definition: DataObject.hh:50
SimpleScriptInterpreter::context
virtual InterpreterContext & context() const
Definition: SimpleScriptInterpreter.cc:185
CustomCommand::context
InterpreterContext * context() const
assert
#define assert(condition)
Definition: Application.hh:86
CustomCommand::CustomCommand
CustomCommand(std::string name)
Definition: CustomCommand.cc:48
TesterContext
Definition: TestOsal.hh:212
CustomCommand::interpreter
ScriptInterpreter * interpreter() const
ScriptInterpreter::setResult
virtual void setResult(DataObject *result)
Definition: ScriptInterpreter.cc:128
OsalInterpreter
Definition: TestOsal.hh:249
Memory::advanceClock
virtual void advanceClock()
Definition: Memory.cc:819
DataObject::setString
virtual void setString(std::string value)
Definition: DataObject.cc:130
ScriptInterpreter
Definition: ScriptInterpreter.hh:55
Memory
Definition: Memory.hh:74