73 operator bool()
const {
75 for (bit_vector::const_iterator bitsBegin =
bits_.begin(), bitsEnd =
bits_.end(), ibit = bitsBegin;
85 bool operator!()
const {
return !(
operator bool()); }
94 *(
bits_.rbegin()) =
false;
96 std::cout <<
"Duplicate entry " << s <<
", not added to registry" << std::endl;
102 for (str_index_map::const_iterator mbegin =
map_.begin(), mend =
map_.end(), mit = mbegin; mit != mend; ++mit) {
104 sprintf(buff,
"%10s = %6i", mit->first.c_str(), (int)(
bits_.at(mit->second)));
105 out << buff << std::endl;
127 for (bit_vector::iterator ibegin =
bits_.begin(), iend =
bits_.end(),
i = ibegin;
i != iend; ++
i) {
135 for (bit_vector::iterator ibegin =
bits_.begin(), iend =
bits_.end(),
i = ibegin;
i != iend; ++
i) {
154 (*this)[
s] = !((*this)[
s]);
159 (*this)[
i] = !((*this)[
i]);
166 for (bit_vector::iterator ibegin = ret.
bits_.begin(), iend = ret.
bits_.end(),
i = ibegin;
i != iend; ++
i) {
175 std::cout <<
"strbitset operator&= : bitsets not the same size" << std::endl;
177 str_index_map::iterator ibegin =
map_.begin(), iend =
map_.end(),
i = ibegin;
178 for (;
i != iend; ++
i) {
180 str_index_map::const_iterator
j = r.
map_.find(key);
181 if (j == r.
map_.end()) {
182 std::cout <<
"strbitset operator&= : cannot find key " << key << std::endl;
194 std::cout <<
"strbitset operator&= : bitsets not the same size" << std::endl;
196 str_index_map::iterator ibegin =
map_.begin(), iend =
map_.end(),
i = ibegin;
197 for (;
i != iend; ++
i) {
199 str_index_map::const_iterator
j = r.
map_.find(key);
200 if (j == r.
map_.end()) {
201 std::cout <<
"strbitset operator&= : cannot find key " << key << std::endl;
213 std::cout <<
"strbitset operator&= : bitsets not the same size" << std::endl;
215 str_index_map::iterator ibegin =
map_.begin(), iend =
map_.end(),
i = ibegin;
216 for (;
i != iend; ++
i) {
218 str_index_map::const_iterator
j = r.
map_.find(key);
219 if (j == r.
map_.end()) {
220 std::cout <<
"strbitset operator&= : cannot find key " << key << std::endl;
232 std::cout <<
"strbitset operator&= : bitsets not the same size" << std::endl;
234 str_index_map::const_iterator ibegin =
map_.begin(), iend =
map_.end(),
i = ibegin;
235 for (;
i != iend; ++
i) {
237 str_index_map::const_iterator
j = r.
map_.find(key);
238 if (j == r.
map_.end()) {
239 std::cout <<
"strbitset operator&= : cannot find key " << key << std::endl;
241 if ((*
this)[
key] != r[
key])
252 for (bit_vector::const_iterator iBegin =
bits_.begin(), iEnd =
bits_.end(), ibit = iBegin; ibit != iEnd; ++ibit) {
253 result &= (*ibit ==
b);
267 for (bit_vector::const_iterator ibegin =
bits_.begin(), iend =
bits_.end(),
i = ibegin;
i != iend; ++
i) {
276 for (bit_vector::const_iterator ibegin =
bits_.begin(), iend =
bits_.end(),
i = ibegin;
i != iend; ++
i) {
295 const std::vector<std::string>
strings()
const {
296 std::vector<std::string>
strings;
297 strings.resize(
bits_.size());
298 for (str_index_map::const_iterator it =
map_.begin(),
end =
map_.end(); it !=
end; ++it) {
299 strings[it->second] = it->first;
312 str_index_map::const_iterator
f =
map_.find(s);
313 if (f ==
map_.end()) {
314 std::cout <<
"Cannot find " << s <<
", returning size()" << std::endl;
322 for (str_index_map::const_iterator
f =
map_.begin(), fEnd =
map_.end();
f != fEnd; ++
f) {
326 std::cout <<
"Cannot find " << i <<
", returning dummy" << std::endl;
bit_vector::const_reference operator[](index_type const &i) const
strbitset & set(std::string s, bool val=true)
set method of one bit
bool operator!() const
! Logical negation of bool()
tuple ret
prodAgent to be discontinued
bool operator<(index_type const &r) const
std::map< std::string, size_t > str_index_map
size_t count() const
returns number of bits set
friend strbitset operator^(const strbitset &l, const strbitset &r)
strbitset & flip()
flip method of all bits
strbitset & operator&=(const strbitset &r)
bitwise and
bool test(index_type const &i) const
friend strbitset operator|(const strbitset &l, const strbitset &r)
strbitset operator|(const strbitset &l, const strbitset &r)
void print(std::ostream &out) const
print method
friend strbitset operator&(const strbitset &l, const strbitset &r)
bit_vector::reference operator[](index_type const &i)
std::string const & index(size_t i) const
bool operator==(const strbitset &r) const
equality operator
bool operator!=(const strbitset &r) const
inequality operator
strbitset operator~()
logical negation
strbitset & flip(std::string s)
flip method of one bit
strbitset()
constructor: just clears the bitset and map
index_type(strbitset const *b, std::string const &s)
bool operator>(index_type const &r) const
strbitset operator^(const strbitset &l, const strbitset &r)
bit_vector::reference operator[](const std::string s)
access method non-const
std::string const & str() const
const bit_vector & bits() const
give access to the ordered bits
tuple key
prepare the HTCondor submission files and eventually submit them
bool operator==(bool b) const
equality operator to bool
strbitset const * bitset_
strbitset operator&(const strbitset &l, const strbitset &r)
void clear()
clear the bitset and map
size_t none() const
returns true if none are set
strbitset & set(index_type const &i, bool val=true)
bool operator>=(index_type const &r) const
strbitset & set(bool val=true)
set method of all bits
size_t index(std::string s) const
strbitset & flip(index_type const &i)
bool test(std::string s) const
test
static const std::string dummy_
bit_vector bits_
the actual bits, indexed by the index in "map_"
const std::vector< std::string > strings() const
give access to the ordered strings
bit_vector::const_reference operator[](const std::string s) const
access method const
bool operator!=(bool b) const
inequality operator to bool
str_index_map map_
map that holds the string–>index map
size_t any() const
returns true if any are set
friend std::ostream & operator<<(std::ostream &out, const index_type &r)
strbitset & operator^=(const strbitset &r)
bitwise xor
bool operator==(index_type const &r) const
std::vector< bool > bit_vector
bool operator<=(index_type const &r) const
strbitset & operator|=(const strbitset &r)
bitwise or
void push_back(std::string s)