File tree Expand file tree Collapse file tree 2 files changed +85
-0
lines changed
Expand file tree Collapse file tree 2 files changed +85
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ set(sources
2020
2121fair_change_extensions_if_exists(.cxx .h FILES "${sources} " OUTVAR headers)
2222
23+ list (APPEND headers
24+ FairBaseTypes.h
25+ )
26+
2327add_library (${target} SHARED ${sources} ${headers} )
2428fairroot_library_settings(${target} )
2529# Keep old filesystem name
Original file line number Diff line number Diff line change 1+ /* *******************************************************************************
2+ * Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3+ * *
4+ * This software is distributed under the terms of the *
5+ * GNU Lesser General Public Licence (LGPL) version 3, *
6+ * copied verbatim in the file "LICENSE" *
7+ ********************************************************************************/
8+ /*
9+ * FairBaseTypes.h
10+ *
11+ * Created on: May 16, 2023
12+ * Author: R.Karabowicz
13+ */
14+
15+ #ifndef FAIR_BASETYPES_H_
16+ #define FAIR_BASETYPES_H_
17+
18+ #include < iostream>
19+ #include < limits>
20+
21+ namespace FairRoot {
22+ struct EntryID {
23+ using underlying_type = size_t ;
24+
25+ static constexpr underlying_type None = std::numeric_limits<underlying_type>::max();
26+
27+ EntryID (underlying_type value) : fId(value) {}
28+
29+ EntryID () : EntryID(None) {}
30+
31+ operator underlying_type () const { return fId ; }
32+
33+ friend auto operator <<(std::ostream& os, EntryID id) -> std::ostream& {
34+ if (id == None) {
35+ return os << " <No Entry>" ;
36+ }
37+ return os << static_cast <underlying_type>(id);
38+ }
39+
40+ auto operator ++() {
41+ if (fId != None) {
42+ ++fId ;
43+ }
44+ return *this ;
45+ }
46+ auto operator ++(int ) {
47+ auto temp = *this ;
48+ if (fId != None) {
49+ ++fId ;
50+ }
51+ return temp;
52+ }
53+
54+ auto operator --() {
55+ if (fId != None) {
56+ --fId ;
57+ }
58+ return *this ;
59+ }
60+ auto operator --(int ) {
61+ auto temp = *this ;
62+ if (fId != None) {
63+ --fId ;
64+ }
65+ return temp;
66+ }
67+ auto operator +=(const EntryID& rhs) {
68+ fId += rhs.fId ;
69+ return *this ;
70+ }
71+ auto operator -=(const EntryID& rhs) {
72+ fId -= rhs.fId ;
73+ return *this ;
74+ }
75+
76+ private:
77+ underlying_type fId ;
78+ };
79+ }
80+
81+ #endif // FAIR_BASETYPES_H_
You can’t perform that action at this time.
0 commit comments