OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
InstructionExecution Class Reference

#include <InstructionExecution.hh>

Collaboration diagram for InstructionExecution:
Collaboration graph

Public Member Functions

 InstructionExecution (RelationalDBQueryResult *result)
 
virtual ~InstructionExecution ()
 
ClockCycleCount cycle () const
 
InstructionAddress address () const
 
void next ()
 
bool hasNext () const
 

Private Attributes

RelationalDBQueryResultresult_
 
int addressColumnIndex_
 
int cycleColumnIndex_
 

Detailed Description

Class used to navigate through the list of all execution cycles.

This class is also used to access the data of the pointed record.

Definition at line 45 of file InstructionExecution.hh.

Constructor & Destructor Documentation

◆ InstructionExecution()

InstructionExecution::InstructionExecution ( RelationalDBQueryResult result)

Constructor.

Object is initialized to point to the first record in the record set, if any.

Parameters
resultThe query result to traverse.

Definition at line 46 of file InstructionExecution.cc.

46  :
48  cycleColumnIndex_ = result_->column("cycle");
49  addressColumnIndex_ = result_->column("address");
50 
53  assert(result != NULL);
54 
55  if (hasNext()) {
56  next();
57  }
58 }

References addressColumnIndex_, assert, RelationalDBQueryResult::column(), cycleColumnIndex_, hasNext(), next(), and result_.

Here is the call graph for this function:

◆ ~InstructionExecution()

InstructionExecution::~InstructionExecution ( )
virtual

Destructor.

Definition at line 63 of file InstructionExecution.cc.

63  {
64  delete result_;
65  result_ = NULL;
66 }

References result_.

Member Function Documentation

◆ address()

InstructionAddress InstructionExecution::address ( ) const

Returns the instruction address value of the current record.

Returns
The instruction address value.
Exceptions
NotAvailableIf the current record is empty.

Definition at line 91 of file InstructionExecution.cc.

91  {
93  const std::string errorMsg =
94  "Tried to fetch data from an empty result set.";
95  throw NotAvailable(__FILE__, __LINE__, __func__, errorMsg);
96  }
98 }

References __func__, addressColumnIndex_, RelationalDBQueryResult::data(), NullDataObject::instance(), DataObject::integerValue(), and result_.

Here is the call graph for this function:

◆ cycle()

ClockCycleCount InstructionExecution::cycle ( ) const

Returns the cycle count value of the current record.

Returns
The cycle count.
Exceptions
NotAvailableIf the current record is empty.

Definition at line 75 of file InstructionExecution.cc.

75  {
77  const std::string errorMsg =
78  "Tried to fetch data from an empty result set.";
79  throw NotAvailable(__FILE__, __LINE__, __func__, errorMsg);
80  }
82 }

References __func__, cycleColumnIndex_, RelationalDBQueryResult::data(), NullDataObject::instance(), DataObject::integerValue(), and result_.

Here is the call graph for this function:

◆ hasNext()

bool InstructionExecution::hasNext ( ) const

Returns true if there are more results available.

Returns
True if more results available.

Definition at line 119 of file InstructionExecution.cc.

119  {
120  return result_->hasNext();
121 }

References RelationalDBQueryResult::hasNext(), and result_.

Referenced by InstructionExecution().

Here is the call graph for this function:

◆ next()

void InstructionExecution::next ( )

Advances the navigator to the next record in the query result set.

Exceptions
NotAvailableif there is no more results in the set.

Definition at line 106 of file InstructionExecution.cc.

106  {
107  if (!result_->hasNext()) {
108  throw NotAvailable(__FILE__, __LINE__, __func__, "No more results.");
109  }
110  result_->next();
111 }

References __func__, RelationalDBQueryResult::hasNext(), RelationalDBQueryResult::next(), and result_.

Referenced by InstructionExecution().

Here is the call graph for this function:

Member Data Documentation

◆ addressColumnIndex_

int InstructionExecution::addressColumnIndex_
private

Definition at line 58 of file InstructionExecution.hh.

Referenced by address(), and InstructionExecution().

◆ cycleColumnIndex_

int InstructionExecution::cycleColumnIndex_
private

Definition at line 59 of file InstructionExecution.hh.

Referenced by cycle(), and InstructionExecution().

◆ result_

RelationalDBQueryResult* InstructionExecution::result_
private

The documentation for this class was generated from the following files:
InstructionExecution::cycleColumnIndex_
int cycleColumnIndex_
Definition: InstructionExecution.hh:59
InstructionExecution::addressColumnIndex_
int addressColumnIndex_
Definition: InstructionExecution.hh:58
RelationalDBQueryResult::data
virtual const DataObject & data(std::size_t column) const =0
Definition: RelationalDBQueryResult.cc:96
InstructionExecution::result_
RelationalDBQueryResult * result_
Definition: InstructionExecution.hh:57
RelationalDBQueryResult::hasNext
virtual bool hasNext()=0
Definition: RelationalDBQueryResult.cc:126
NotAvailable
Definition: Exception.hh:728
assert
#define assert(condition)
Definition: Application.hh:86
InstructionExecution::hasNext
bool hasNext() const
Definition: InstructionExecution.cc:119
DataObject::integerValue
virtual int integerValue() const
Definition: DataObject.cc:204
RelationalDBQueryResult::next
virtual bool next()=0
Definition: RelationalDBQueryResult.cc:138
__func__
#define __func__
Definition: Application.hh:67
RelationalDBQueryResult::column
virtual int column(const std::string &name) const
Definition: RelationalDBQueryResult.cc:64
InstructionExecution::next
void next()
Definition: InstructionExecution.cc:106
NullDataObject::instance
static NullDataObject & instance()
Definition: DataObject.cc:542