ATLAS Offline Software
Loading...
Searching...
No Matches
Decision.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4// Decision.h
5// TopoCore
6// Created by Joerg Stelzer on 11/16/12.
7
8#ifndef __TopoCore__Decision__
9#define __TopoCore__Decision__
10
12
13#include <iostream>
14#include <vector>
15#include <stdint.h>
16
17namespace TCS {
18
19 class Decision {
20 public:
21
22 Decision(unsigned int firstBit = 0, unsigned int nBits = 1) :
25 m_overflow(false)
26 {};
27
28 // destructor
30
31 // setters
33 void setBit(unsigned int index, bool value);
34
35 void setFirstBit(unsigned int startBit) { m_firstBit = startBit; }
36 void setNBits(unsigned int nBits) { m_nBits = nBits; }
37 void setOverflow(bool value) { m_overflow = value; }
38 void setAmbiguity(bool value) { m_ambiguity = value; }
39 // getters
40 bool bit(unsigned int index) const { return (m_decision & (0x1<<index)) != 0; }
41 uint64_t decision() const { return m_decision; }
42 unsigned int firstBit() const { return m_firstBit; }
43 unsigned int lastBit() const { return m_firstBit + m_nBits - 1; }
44 unsigned int nBits() const { return m_nBits; }
45 bool overflow() const { return m_overflow; }
46 bool ambiguity() const { return m_ambiguity; }
47
48 private:
49 uint32_t m_decision {0};
50 unsigned int m_firstBit {0};
51 unsigned int m_nBits {1};
53 // note: in principle the ambiguity flag should be per output bit
54 // in practice the truncation of sorted lists before/in a decision algo
55 // is the same for every output bit produced by the same algo instance
56 bool m_ambiguity = false;
57
58 };
59
60}
61
62std::ostream & operator<<(std::ostream&, const TCS::Decision &);
63
64#endif
std::ostream & operator<<(std::ostream &, const TCS::Decision &)
Definition Decision.cxx:24
void setAmbiguity(bool value)
Definition Decision.h:38
bool ambiguity() const
Definition Decision.h:46
bool overflow() const
Definition Decision.h:45
unsigned int m_nBits
Definition Decision.h:51
void setNBits(unsigned int nBits)
Definition Decision.h:36
void setOverflow(bool value)
Definition Decision.h:37
unsigned int lastBit() const
Definition Decision.h:43
StatusCode reset()
Definition Decision.h:32
bool bit(unsigned int index) const
Definition Decision.h:40
Decision(unsigned int firstBit=0, unsigned int nBits=1)
Definition Decision.h:22
uint32_t m_decision
Definition Decision.h:49
unsigned int nBits() const
Definition Decision.h:44
unsigned int m_firstBit
Definition Decision.h:50
uint64_t decision() const
Definition Decision.h:41
void setFirstBit(unsigned int startBit)
Definition Decision.h:35
void setBit(unsigned int index, bool value)
Definition Decision.cxx:12
bool m_ambiguity
Definition Decision.h:56
bool m_overflow
Definition Decision.h:52
unsigned int firstBit() const
Definition Decision.h:42
Definition index.py:1