OpenASIP 2.2
Loading...
Searching...
No Matches
ReferenceKey.icc
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 ReferenceKey.icc
26 *
27 * Inline and template functions for ReferenceKey classes.
28 *
29 * @author Pekka Jääskeläinen 2003 (pjaaskel-no.spam-cs.tut.fi)
30 * @note reviewed 17 Oct 2003 by am, rm, kl
31 *
32 * @note rating: yellow
33 */
34
35namespace TPEF {
36namespace ReferenceManager {
37///////////////////////////////////////////////////////////////////////////////
38// SectionIndexKey
39///////////////////////////////////////////////////////////////////////////////
40
41/**
42 * Returns the section identification code for this key.
43 *
44 * @return Section identification code.
45 */
46inline SectionId
47SectionIndexKey::sectionId() const {
48 return sectionId_;
49}
50
51/**
52 * Returns the index this key is set to.
53 *
54 * @return Index.
55 */
56inline SectionIndex
57SectionIndexKey::index() const {
58 return index_;
59}
60
61/**
62 * Equality operator for SectionIndexKey.
63 *
64 * @param other Another key to compare to.
65 * @return True if the keys have same data.
66 */
67inline bool
68SectionIndexKey::operator==(const SectionIndexKey& other) const {
69 return sectionId_ == other.sectionId_ && index_ == other.index_;
70}
71
72/**
73 * Inequality operator for SectionIndexKey.
74 *
75 * @param other Another key to compare to.
76 * @return True if the keys don't have same data.
77 */
78inline bool
79SectionIndexKey::operator!=(const SectionIndexKey& other) const {
80 return !(*this == other);
81}
82
83/**
84 * Smaller than operator for SectionIndexKey.
85 *
86 * @param other Another key to compare to.
87 * @return True if the keys don't have same data.
88 */
89inline bool
90SectionIndexKey::operator<(const SectionIndexKey& other) const {
91 return (sectionId_ < other.sectionId_) ||
92 (sectionId_ == other.sectionId_ &&
93 index_ < other.index_);
94}
95
96///////////////////////////////////////////////////////////////////////////////
97// SectionOffsetKey
98///////////////////////////////////////////////////////////////////////////////
99
100/**
101 * Returns the section identification code for this key.
102 *
103 * @return Section identification code.
104 */
105inline SectionId
106SectionOffsetKey::sectionId() const {
107 return sectionId_;
108}
109
110/**
111 * Returns the offset this key is set to.
112 *
113 * @return Offset.
114 */
115inline SectionOffset
116SectionOffsetKey::offset() const {
117 return offset_;
118}
119
120/**
121 * Equality operator for SectionOffsetKey.
122 *
123 * @param other Another key to compare to.
124 * @return True if the keys have same data.
125 */
126inline bool
127SectionOffsetKey::operator==(const SectionOffsetKey& other) const {
128 return sectionId_ == other.sectionId_ && offset_ == other.offset_;
129}
130
131/**
132 * Inequality operator for SectionOffsetKey.
133 *
134 * @param other Another key to compare to.
135 * @return True if the keys don't have same data.
136 */
137inline bool
138SectionOffsetKey::operator!=(const SectionOffsetKey& other) const {
139 return !(*this == other);
140}
141
142/**
143 * Smaller than operator for SectionOffsetKey.
144 *
145 * @param other Another key to compare to.
146 * @return True if the keys don't have same data.
147 */
148inline bool
149SectionOffsetKey::operator<(const SectionOffsetKey& other) const {
150 return (sectionId_ < other.sectionId_) ||
151 (sectionId_ == other.sectionId_ &&
152 offset_ < other.offset_);
153}
154
155///////////////////////////////////////////////////////////////////////////////
156// FileOffsetKey
157///////////////////////////////////////////////////////////////////////////////
158
159/**
160 * Returns the file offset this key is set to.
161 *
162 * @return File offset.
163 */
164inline FileOffset
165FileOffsetKey::fileOffset() const {
166 return fileOffset_;
167}
168
169/**
170 * Equality operator for FileOffsetKey.
171 *
172 * @param other Another key to compare to.
173 * @return True if the keys have same data.
174 */
175inline bool
176FileOffsetKey::operator==(const FileOffsetKey& other) const {
177 return fileOffset_ == other.fileOffset_;
178}
179
180/**
181 * Inequality operator for FileOffsetKey.
182 *
183 * @param other Another key to compare to.
184 * @return True if the keys don't have same data.
185 */
186inline bool
187FileOffsetKey::operator!=(const FileOffsetKey& other) const {
188 return !(*this == other);
189}
190
191/**
192 * Smaller than operator for FileOffsetKey.
193 *
194 * @param other Another key to compare to.
195 * @return True if the keys don't have same data.
196 */
197inline bool
198FileOffsetKey::operator<(const FileOffsetKey& other) const {
199 return (fileOffset_ < other.fileOffset_);
200}
201
202///////////////////////////////////////////////////////////////////////////////
203// SectionKey
204///////////////////////////////////////////////////////////////////////////////
205
206/**
207 * Returns the section identification code for this key.
208 *
209 * @return Section identification code.
210 */
211inline SectionId
212SectionKey::sectionId() const {
213 return sectionId_;
214}
215
216/**
217 * Equality operator for SectionKey.
218 *
219 * @param other Another key to compare to.
220 * @return True if the keys have same data.
221 */
222inline bool
223SectionKey::operator==(const SectionKey& other) const {
224 return sectionId_ == other.sectionId_;
225}
226
227/**
228 * Inequality operator for SectionKey.
229 *
230 * @param other Another key to compare to.
231 * @return True if the keys don't have same data.
232 */
233inline bool
234SectionKey::operator!=(const SectionKey& other) const {
235 return !(*this == other);
236}
237
238/**
239 * Smaller than operator for SectionKey.
240 *
241 * @param other Another key to compare to.
242 * @return True if the keys don't have same data.
243 */
244inline bool
245SectionKey::operator<(const SectionKey& other) const {
246 return sectionId_ < other.sectionId_;
247}
248
249} // namespace ReferenceManager
250
251}