29 template<
int NumberOfFlags,
class InitKeyEnum>
40 void SetFlag(InitKeyEnum bitKey,
bool newStatus =
true);
43 std::string
ToString(
int indentLevel = 0)
const;
52 template<
int NumberOfFlags,
class InitKeyEnum>
55 int bitIndex =
static_cast<int>(bitKey);
56 if (bitIndex >= NumberOfFlags || bitIndex < 0) {
57 LOG(fatal) <<
"L1OnjectInitController::GetFlagStatus: attempt of flag access with index = " << bitIndex
58 <<
" outside the range [0, " << NumberOfFlags <<
']';
61 return fInitFlags[
static_cast<int>(bitKey)];
66 template<
int NumberOfFlags,
class InitKeyEnum>
69 int bitIndex =
static_cast<int>(bitKey);
70 if (bitIndex >= NumberOfFlags || bitIndex < 0) {
71 LOG(fatal) <<
"L1OnjectInitController::GetFlagStatus: attempt of flag access with index = " << bitIndex
72 <<
" outside the range [0, " << NumberOfFlags <<
']';
75 fInitFlags[
static_cast<int>(bitKey)] = newStatus;
80 template<
int NumberOfFlags,
class InitKeyEnum>
83 std::stringstream aStream{};
84 constexpr char indentChar =
'\t';
85 std::string indent(indentLevel, indentChar);
86 aStream << indent <<
"CaObjectInitController: flag values";
87 aStream <<
'\n' << indent <<
"index: ";
88 for (
int idx = 0; idx < NumberOfFlags; ++idx) {
89 aStream << std::setw(3) << std::setfill(
' ') << idx <<
' ';
91 aStream <<
'\n' << indent <<
"value: ";
92 for (
int idx = 0; idx < NumberOfFlags; ++idx) {
93 aStream <<
" " <<
static_cast<int>(fInitFlags[idx]) <<
' ';
bool GetFlag(InitKeyEnum bitKey) const
void SetFlag(InitKeyEnum bitKey, bool newStatus=true)
bool IsFinalized() const
Checks, if the object is finalized, i.e. all its fields were set up.
std::bitset< NumberOfFlags > fInitFlags
object of flags sets
std::string ToString(int indentLevel=0) const
TODO: SZh 8.11.2022: add selection of parameterisation.