Skip to content

Commit 6f6d976

Browse files
authored
Fix compilation issues on MacOs (#364)
- Fix also the type of the Size() method - Add check on data type
1 parent f6713b0 commit 6f6d976

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Modules/TOF/include/Base/Counter.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ class Counter
4242
void Count(UInt_t v)
4343
{
4444
if (v > Tc::size) {
45-
ILOG(Error) << "Incrementing counter too far! " << v << "/" << Tc::size << ENDM;
45+
ILOG(Error) << "Incrementing counter too far! " << v << "/" << Size() << ENDM;
4646
}
4747
#ifdef ENABLE_COUNTER_DEBUG_MODE
48-
ILOG(Info) << "Incrementing " << v << "/" << Tc::size << " to " << counter[v] << ENDM;
48+
ILOG(Info) << "Incrementing " << v << "/" << Size() << " to " << counter[v] << ENDM;
4949
#endif
5050
counter[v]++;
5151
}
@@ -105,9 +105,11 @@ class Counter
105105
#endif
106106
}
107107
/// Getter for the Tc::size
108-
Tc Size() const { return Tc::size; }
108+
UInt_t Size() const { return Tc::size; }
109109

110110
private:
111+
static_assert(std::is_same<decltype(Tc::size), const UInt_t>::value, "size must be const UInt_t");
112+
static_assert(std::is_same<decltype(Tc::names), const TString[Tc::size]>::value, "names must be const TString arrays");
111113
/// Containers to fill
112114
uint32_t counter[Tc::size] = { 0 };
113115
};

0 commit comments

Comments
 (0)