|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #ifndef TrigSteeringEvent_TrigPassFlags_h
7 #define TrigSteeringEvent_TrigPassFlags_h
48 void setFlagBit(
const unsigned int position,
const unsigned int bitPosition,
const bool bitValue,
const void *cont=0 );
56 void setFlag(
const unsigned int position,
const std::vector<bool>&
flag,
const void *cont=0 );
62 bool getFlagBit(
const unsigned int position,
const unsigned int bitPosition)
const;
68 const std::vector<bool>&
getFlag(
const unsigned int position)
const;
95 template<
class CONTAINER>
97 return new TrigPassFlags(cont->size(), flagSize, (
const void*)cont );
104 template<
class T,
class CONTAINER>
106 typename CONTAINER::const_iterator
i =
std::find(container->begin(), container->end(),
obj);
107 if (
i != container->end() )
108 flags->setFlagBit(
i-container->begin(), bitPosition, bitValue, container);
110 throw std::runtime_error(
"The CONTAINER passed does not match the CONTAINER that created the TrigPassFlags");
120 template<
class T,
class CONTAINER>
122 typename CONTAINER::const_iterator
i =
std::find(container->begin(), container->end(),
obj);
123 if (
i != container->end() )
124 flags->setFlag(
i-container->begin(),
flag, container);
126 throw std::runtime_error(
"The CONTAINER passed does not match the CONTAINER that created the TrigPassFlags");
133 template<
class T,
class CONTAINER>
135 typename CONTAINER::const_iterator
i =
std::find(container->begin(), container->end(),
obj);
136 if (
i != container->end() )
137 return flags->getFlagBit(
i-container->begin(),position, bitPosition);
138 throw std::runtime_error(
"The CONTAINER passed does not match the CONTAINER that created the TrigPassFlags");
144 template<
class T,
class CONTAINER>
146 typename CONTAINER::const_iterator
i =
std::find(container->begin(), container->end(),
obj);
147 if (
i != container->end() )
148 return flags->getFlag(
i-container->begin(),position);
149 throw std::runtime_error(
"The CONTAINER passed does not match the CONTAINER that created the TrigPassFlags");
155 throw std::runtime_error(
"AsFlag(): type T has less bits than required by 'size'");
156 if(flag_t >= ( ((
unsigned long long)1)<<
size) )
157 throw std::runtime_error(
"AsFlag(): the flag is larger then bits available");
169 if(8*
sizeof(
T)<
flag.size())
170 throw std::runtime_error(
"FlagAs(): the flag size does not fit into the requested type");
182 #endif // TrigSteeringEvent_TrigPassFlags_h
void setFlagBit(const unsigned int position, const unsigned int bitPosition, const bool bitValue, const void *cont=0)
Set bit of the flag at index position.
std::string find(const std::string &s)
return a remapped string
TrigPassFlags * makeTrigPassFlags(const CONTAINER *cont, const unsigned int flagSize)
T FlagAs(const std::vector< bool > &flag)
unsigned int size() const
gets size of the container object vector
void setFlag(const unsigned int position, const std::vector< bool > &flag, const void *cont=0)
Set the flag at index position.
bool getFlagBit(const TrigPassFlags *flags, const T *obj, const CONTAINER *container, const unsigned int position, const unsigned int bitPosition)
Returns the bit 'bitPosition' of the flag at index position.
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
void setFlag(TrigPassFlags *flags, const T *obj, const CONTAINER *container, const std::vector< bool > &flag)
Set the flag at index position.
unsigned int flagSize() const
gets size of the flag vector for the object at index
void setFlagBit(TrigPassFlags *flags, const T *obj, const CONTAINER *container, const unsigned int bitPosition, const bool bitValue=true)
Set bit of the flag at index position for a given TrigPassFlags object.
std::vector< bool > AsFlag(T flag_t, const size_t size)
File providing the different SG_BASE macros.
const std::vector< bool > & getFlag(const TrigPassFlags *flags, const T *obj, const CONTAINER *container, const size_t position)
Returns the flag at index position.
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
A Flag is an ordered collection of bits (vector<bool>) that can hold additional (boolean) information...
const std::vector< bool > & getFlag(const unsigned int position) const
Returns the flag (vector<bool>) at index position.
const void * m_container_ptr
std::vector< std::vector< bool > > m_flagsPerObject
list of trainsient n-bit value (STL docu assures that a vector of booleans is efficient)
bool getFlagBit(const unsigned int position, const unsigned int bitPosition) const
Returns the bit 'bitPosition' of the flag at index position.