SkelCL
SkelCL is a high level multi GPU skeleton library developed at the university of Münster, Germany.
 All Classes Namespaces Files Functions Variables Typedefs Groups
Index.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2011-2012 The SkelCL Team as listed in CREDITS.txt *
3  * http://skelcl.uni-muenster.de *
4  * *
5  * This file is part of SkelCL. *
6  * SkelCL is available under multiple licenses. *
7  * The different licenses are subject to terms and condition as provided *
8  * in the files specifying the license. See "LICENSE.txt" for details *
9  * *
10  *****************************************************************************
11  * *
12  * SkelCL is free software: you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation, either version 3 of the License, or *
15  * (at your option) any later version. See "LICENSE-gpl.txt" for details. *
16  * *
17  * SkelCL is distributed in the hope that it will be useful, *
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20  * GNU General Public License for more details. *
21  * *
22  *****************************************************************************
23  * *
24  * For non-commercial academic use see the license specified in the file *
25  * "LICENSE-academic.txt". *
26  * *
27  *****************************************************************************
28  * *
29  * If you are interested in other licensing models, including a commercial- *
30  * license, please contact the author at michel.steuwer@uni-muenster.de *
31  * *
32  *****************************************************************************/
33 
39 
40 #include "SkelCL/Index.h"
41 
42 namespace skelcl {
43 
45  : _index(0)
46 {
47 }
48 
50  : _index(index)
51 {
52 }
53 
54 bool Index::operator==(const Index& rhs) const
55 {
56  return _index == rhs._index;
57 }
58 
59 bool Index::operator!=(const Index& rhs) const
60 {
61  return _index != rhs._index;
62 }
63 
64 Index::operator index_type() const
65 {
66  return _index;
67 }
68 
70 {
71  return _index;
72 }
73 
75  : _indexPoint()
76 {
77 }
78 
80  : _indexPoint(indexPoint)
81 {
82 }
83 
84 IndexPoint::IndexPoint(const Index& row, const Index& column)
85  : _indexPoint(std::make_pair(row,column))
86 {
87 }
88 
90  : _indexPoint(std::make_pair(std::move(rhs._indexPoint.first),
91  std::move(rhs._indexPoint.second)))
92 {
93 }
94 
96 {
97  if (this == &rhs) return *this; // handle self move assignment
98  _indexPoint.first = std::move(rhs._indexPoint.first);
99  _indexPoint.second = std::move(rhs._indexPoint.second);
100  return *this;
101 }
102 
103 bool IndexPoint::operator==(const IndexPoint& rhs) const
104 {
105  return _indexPoint == rhs._indexPoint;
106 }
107 
108 bool IndexPoint::operator!=(const IndexPoint& rhs) const
109 {
110  return !(this->operator==(rhs));
111 }
112 
113 IndexPoint::operator indexPoint_type() const
114 {
115  return _indexPoint;
116 }
117 
119 {
120  return _indexPoint;
121 }
122 
123 const Index& IndexPoint::rowID() const
124 {
125  return _indexPoint.first;
126 }
127 
128 const Index& IndexPoint::y() const
129 {
130  return _indexPoint.first;
131 }
132 
134 {
135  return _indexPoint.second;
136 }
137 
138 const Index& IndexPoint::x() const
139 {
140  return _indexPoint.second;
141 }
142 
143 } // namespace skelcl
144 
bool operator==(const Index &rhs) const
Equality operator. Two Index objects are equal if and only if the two underlying unsigned integer are...
Definition: Index.cpp:54
indexPoint_type get() const
Explicit function to access the underlying pair of unsigned integer representing this IndexPoint obje...
Definition: Index.cpp:118
bool operator==(const IndexPoint &rhs) const
Equality operator. Two IndexPoint objects are equal if and only if the two underlying pairs of unsign...
Definition: Index.cpp:103
IndexPoint & operator=(IndexPoint &&rhs)
Move assignment operator. Assign IndexPoint rhs to this.
Definition: Index.cpp:95
const Index & columnID() const
Function to access the second component of the underlying pair of unsigned integers representing this...
Definition: Index.cpp:133
const Index & y() const
Function to access the first component of the underlying pair of unsigned integers representing this ...
Definition: Index.cpp:128
const Index & x() const
Function to access the second component of the underlying pair of unsigned integers representing this...
Definition: Index.cpp:138
const Index & rowID() const
Function to access the first component of the underlying pair of unsigned integers representing this ...
Definition: Index.cpp:123
bool operator!=(const Index &rhs) const
Inequality operator. Two Index objects are not equal if and only if the two underlying unsigned integ...
Definition: Index.cpp:59
IndexPoint()
Creates an IndexPoint with the values {0,0}.
Definition: Index.cpp:74
index_type get() const
Explicit function to access the underlying unsigned integer representing this Index object...
Definition: Index.cpp:69
Index()
Creates an Index with the value 0.
Definition: Index.cpp:44
This class defines an two-dimensional IndexPoint, i.e. a pair of unsigned integers representing a val...
Definition: Index.h:128
This class defines an Index, i.e. an unsigned integer representing a value in a one-dimensional index...
Definition: Index.h:54
bool operator!=(const IndexPoint &rhs) const
Inequality operator. Two IndexPoint objects are not equal if and only if the two underlying pairs of ...
Definition: Index.cpp:108
std::pair< Index, Index > indexPoint_type
Actual type used to store the pair of unsigned integers representing the IndexPoint.
Definition: Index.h:134
size_t index_type
Actual type used to store the unsigned integer representing the Index.
Definition: Index.h:60