Project
Loading...
Searching...
No Matches
Road.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
15
16#ifndef TRACKINGCA_INCLUDE_ROAD_H
17#define TRACKINGCA_INCLUDE_ROAD_H
18
20#include "GPUCommonDef.h"
21
22namespace o2::its
23{
24
25template <unsigned char maxRoadSize = 5>
26class Road final
27{
28 public:
29 GPUhdDefault() Road() = default;
30 GPUhd() Road(int cellLayer, int cellId) : Road() { addCell(cellLayer, cellId); }
31
32 GPUhdDefault() Road(const Road&) = default;
33 GPUhdDefault() Road(Road&&) noexcept = default;
34 GPUhdDefault() ~Road() = default;
35
36 GPUhdDefault() Road& operator=(const Road&) = default;
37 GPUhdDefault() Road& operator=(Road&&) noexcept = default;
38
39 GPUhdi() uint8_t getRoadSize() const { return mRoadSize; }
40 GPUhdi() bool isFakeRoad() const { return mIsFakeRoad; }
41 GPUhdi() void setFakeRoad(const bool fake) { mIsFakeRoad = fake; }
42 GPUhdi() int& operator[](const int& i) { return mCellIds[i]; }
43 GPUhdi() int operator[](const int& i) const { return mCellIds[i]; }
44
45 GPUhd() void resetRoad()
46 {
47 for (int i = 0; i < maxRoadSize; i++) {
49 }
50 mRoadSize = 0;
51 }
52
53 GPUhd() void addCell(int cellLayer, int cellId)
54 {
55 if (mCellIds[cellLayer] == constants::its::UnusedIndex) {
56 ++mRoadSize;
57 }
58
59 mCellIds[cellLayer] = cellId;
60 }
61
62 private:
63 int mCellIds[maxRoadSize]{constants::its::UnusedIndex};
64 // int mLabel;
65 unsigned char mRoadSize{0};
66 bool mIsFakeRoad{false};
67};
68
69} // namespace o2::its
70
71#endif
int32_t i
GPUhdDefault() Road(const Road &)=default
GPUhd() void resetRoad()
Definition Road.h:45
GPUhdi() int operator[](const int &i) const
Definition Road.h:43
GPUhdi() bool isFakeRoad() const
Definition Road.h:40
GPUhd() Road(int cellLayer
GPUhdi() int &operator[](const int &i)
Definition Road.h:42
GPUhd() void addCell(int cellLayer
GPUhdi() void setFakeRoad(const bool fake)
Definition Road.h:41
int cellId
Definition Road.h:30
GPUhdDefault() Road()=default
GPUhdi() uint8_t getRoadSize() const
Definition Road.h:39
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
constexpr int UnusedIndex
Definition Constants.h:54