OpenASIP 2.2
Loading...
Searching...
No Matches
InstructionExecution.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file InstructionExecution.cc
26 *
27 * Definition of InstructionExecution class.
28 *
29 * @author Pekka Jääskeläinen 2004 (pjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include "Application.hh"
35#include "ExecutionTrace.hh"
36#include "DataObject.hh"
37
38/**
39 * Constructor.
40 *
41 * Object is initialized to point to the first record in the record set,
42 * if any.
43 *
44 * @param result The query result to traverse.
45 */
47 result_(result), addressColumnIndex_(-1), cycleColumnIndex_(-1) {
50
53 assert(result != NULL);
54
55 if (hasNext()) {
56 next();
57 }
58}
59
60/**
61 * Destructor.
62 */
67
68/**
69 * Returns the cycle count value of the current record.
70 *
71 * @return The cycle count.
72 * @exception NotAvailable If the current record is empty.
73 */
77 const std::string errorMsg =
78 "Tried to fetch data from an empty result set.";
79 throw NotAvailable(__FILE__, __LINE__, __func__, errorMsg);
80 }
82}
83
84/**
85 * Returns the instruction address value of the current record.
86 *
87 * @return The instruction address value.
88 * @exception NotAvailable If the current record is empty.
89 */
93 const std::string errorMsg =
94 "Tried to fetch data from an empty result set.";
95 throw NotAvailable(__FILE__, __LINE__, __func__, errorMsg);
96 }
98}
99
100/**
101 * Advances the navigator to the next record in the query result set.
102 *
103 * @exception NotAvailable if there is no more results in the set.
104 */
105void
107 if (!result_->hasNext()) {
108 throw NotAvailable(__FILE__, __LINE__, __func__, "No more results.");
109 }
110 result_->next();
111}
112
113/**
114 * Returns true if there are more results available.
115 *
116 * @return True if more results available.
117 */
118bool
120 return result_->hasNext();
121}
#define __func__
#define assert(condition)
UInt32 InstructionAddress
Definition BaseType.hh:175
CycleCount ClockCycleCount
Alias for ClockCycleCount.
virtual int integerValue() const
RelationalDBQueryResult * result_
InstructionExecution(RelationalDBQueryResult *result)
ClockCycleCount cycle() const
InstructionAddress address() const
static NullDataObject & instance()
virtual int column(const std::string &name) const
virtual const DataObject & data(std::size_t column) const =0