2 Copyright (c) 2002-2009 Tampere University.
4 This file is part of TTA-Based Codesign Environment (TCE).
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:
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
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.
25 * @file ReferenceKey.icc
27 * Inline and template functions for ReferenceKey classes.
29 * @author Pekka Jääskeläinen 2003 (pjaaskel-no.spam-cs.tut.fi)
30 * @note reviewed 17 Oct 2003 by am, rm, kl
32 * @note rating: yellow
36namespace ReferenceManager {
37///////////////////////////////////////////////////////////////////////////////
39///////////////////////////////////////////////////////////////////////////////
42 * Returns the section identification code for this key.
44 * @return Section identification code.
47SectionIndexKey::sectionId() const {
52 * Returns the index this key is set to.
57SectionIndexKey::index() const {
62 * Equality operator for SectionIndexKey.
64 * @param other Another key to compare to.
65 * @return True if the keys have same data.
68SectionIndexKey::operator==(const SectionIndexKey& other) const {
69 return sectionId_ == other.sectionId_ && index_ == other.index_;
73 * Inequality operator for SectionIndexKey.
75 * @param other Another key to compare to.
76 * @return True if the keys don't have same data.
79SectionIndexKey::operator!=(const SectionIndexKey& other) const {
80 return !(*this == other);
84 * Smaller than operator for SectionIndexKey.
86 * @param other Another key to compare to.
87 * @return True if the keys don't have same data.
90SectionIndexKey::operator<(const SectionIndexKey& other) const {
91 return (sectionId_ < other.sectionId_) ||
92 (sectionId_ == other.sectionId_ &&
93 index_ < other.index_);
96///////////////////////////////////////////////////////////////////////////////
98///////////////////////////////////////////////////////////////////////////////
101 * Returns the section identification code for this key.
103 * @return Section identification code.
106SectionOffsetKey::sectionId() const {
111 * Returns the offset this key is set to.
116SectionOffsetKey::offset() const {
121 * Equality operator for SectionOffsetKey.
123 * @param other Another key to compare to.
124 * @return True if the keys have same data.
127SectionOffsetKey::operator==(const SectionOffsetKey& other) const {
128 return sectionId_ == other.sectionId_ && offset_ == other.offset_;
132 * Inequality operator for SectionOffsetKey.
134 * @param other Another key to compare to.
135 * @return True if the keys don't have same data.
138SectionOffsetKey::operator!=(const SectionOffsetKey& other) const {
139 return !(*this == other);
143 * Smaller than operator for SectionOffsetKey.
145 * @param other Another key to compare to.
146 * @return True if the keys don't have same data.
149SectionOffsetKey::operator<(const SectionOffsetKey& other) const {
150 return (sectionId_ < other.sectionId_) ||
151 (sectionId_ == other.sectionId_ &&
152 offset_ < other.offset_);
155///////////////////////////////////////////////////////////////////////////////
157///////////////////////////////////////////////////////////////////////////////
160 * Returns the file offset this key is set to.
162 * @return File offset.
165FileOffsetKey::fileOffset() const {
170 * Equality operator for FileOffsetKey.
172 * @param other Another key to compare to.
173 * @return True if the keys have same data.
176FileOffsetKey::operator==(const FileOffsetKey& other) const {
177 return fileOffset_ == other.fileOffset_;
181 * Inequality operator for FileOffsetKey.
183 * @param other Another key to compare to.
184 * @return True if the keys don't have same data.
187FileOffsetKey::operator!=(const FileOffsetKey& other) const {
188 return !(*this == other);
192 * Smaller than operator for FileOffsetKey.
194 * @param other Another key to compare to.
195 * @return True if the keys don't have same data.
198FileOffsetKey::operator<(const FileOffsetKey& other) const {
199 return (fileOffset_ < other.fileOffset_);
202///////////////////////////////////////////////////////////////////////////////
204///////////////////////////////////////////////////////////////////////////////
207 * Returns the section identification code for this key.
209 * @return Section identification code.
212SectionKey::sectionId() const {
217 * Equality operator for SectionKey.
219 * @param other Another key to compare to.
220 * @return True if the keys have same data.
223SectionKey::operator==(const SectionKey& other) const {
224 return sectionId_ == other.sectionId_;
228 * Inequality operator for SectionKey.
230 * @param other Another key to compare to.
231 * @return True if the keys don't have same data.
234SectionKey::operator!=(const SectionKey& other) const {
235 return !(*this == other);
239 * Smaller than operator for SectionKey.
241 * @param other Another key to compare to.
242 * @return True if the keys don't have same data.
245SectionKey::operator<(const SectionKey& other) const {
246 return sectionId_ < other.sectionId_;
249} // namespace ReferenceManager