dune-common 2.9.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Dune::BitSetVectorReference< block_size, Alloc > Class Template Reference

A proxy class that acts as a mutable reference to a single bitset in a BitSetVector. More...

#include <dune/common/bitsetvector.hh>

Inheritance diagram for Dune::BitSetVectorReference< block_size, Alloc >:
Inheritance graph

Public Types

typedef std::bitset< block_size > bitset
 
typedef size_t size_type
 size_type typedef (an unsigned integral type)
 
typedef std::vector< bool, Alloc >::reference reference
 
typedef std::vector< bool, Alloc >::const_reference const_reference
 A proxy class that acts as a const reference to a single bit.
 

Public Member Functions

BitSetVectorReferenceoperator= (bool b)
 Assignment from bool, sets each bit in the bitset to b.
 
BitSetVectorReferenceoperator= (const bitset &b)
 Assignment from bitset.
 
BitSetVectorReferenceoperator= (const BitSetVectorConstReference &b)
 Assignment from BitSetVectorConstReference.
 
BitSetVectorReferenceoperator= (const BitSetVectorReference &b)
 Assignment from BitSetVectorReference.
 
BitSetVectorReferenceoperator&= (const bitset &x)
 Bitwise and (for bitset).
 
BitSetVectorReferenceoperator&= (const BitSetVectorConstReference &x)
 Bitwise and (for BitSetVectorConstReference and BitSetVectorReference)
 
BitSetVectorReferenceoperator|= (const bitset &x)
 Bitwise inclusive or (for bitset)
 
BitSetVectorReferenceoperator|= (const BitSetVectorConstReference &x)
 Bitwise inclusive or (for BitSetVectorConstReference and BitSetVectorReference)
 
BitSetVectorReferenceoperator^= (const bitset &x)
 Bitwise exclusive or (for bitset).
 
BitSetVectorReferenceoperator^= (const BitSetVectorConstReference &x)
 Bitwise exclusive or (for BitSetVectorConstReference and BitSetVectorReference)
 
BitSetVectorReferenceoperator<<= (size_type n)
 Left shift.
 
BitSetVectorReferenceoperator>>= (size_type n)
 Right shift.
 
BitSetVectorReferenceset ()
 Sets every bit.
 
BitSetVectorReferenceflip ()
 Flips the value of every bit.
 
BitSetVectorReferencereset ()
 Clears every bit.
 
BitSetVectorReferenceset (size_type n, int val=1)
 Sets bit n if val is nonzero, and clears bit n if val is zero.
 
BitSetVectorReferencereset (size_type n)
 Clears bit n.
 
BitSetVectorReferenceflip (size_type n)
 Flips bit n.
 
reference operator[] (size_type i)
 Return reference to the i-th bit.
 
bool test (size_type n) const
 Returns true if bit n is set.
 
bitset operator<< (size_type n) const
 Returns a copy of *this shifted left by n bits.
 
bitset operator>> (size_type n) const
 Returns a copy of *this shifted right by n bits.
 
bitset operator~ () const
 Returns a copy of *this with all of its bits flipped.
 
size_type size () const
 Returns block_size.
 
size_type count () const
 Returns the number of bits that are set.
 
bool any () const
 Returns true if any bits are set.
 
bool none () const
 Returns true if no bits are set.
 
bool all () const
 Returns true if all bits are set.
 
const_reference operator[] (size_type i) const
 Return reference to the i-th bit.
 
 operator bitset () const
 cast to bitset
 
bool operator== (const bitset &bs) const
 Equality of reference and std::bitset.
 
bool operator== (const BitSetVectorConstReference &bs) const
 Equality of reference and other reference.
 
bool operator!= (const bitset &bs) const
 Inequality of reference and std::bitset.
 
bool operator!= (const BitSetVectorConstReference &bs) const
 Inequality of reference and other reference.
 

Protected Types

typedef Dune::BitSetVector< block_size, Alloc > BitSetVector
 
typedef Dune::BitSetVectorConstReference< block_size, Alloc > BitSetVectorConstReference
 

Protected Member Functions

 BitSetVectorReference (BitSetVector &blockBitField_, int block_number_)
 
reference getBit (size_type i)
 
const_reference getBit (size_type i) const
 
template<class BS >
bool equals (const BS &bs) const
 

Protected Attributes

BitSetVectorblockBitField
 
int block_number
 

Detailed Description

template<int block_size, class Alloc>
class Dune::BitSetVectorReference< block_size, Alloc >

A proxy class that acts as a mutable reference to a single bitset in a BitSetVector.

It contains an assignment operator from std::bitset. It inherits the const std::bitset interface provided by BitSetVectorConstReference and adds most of the non-const methods of std::bitset.

Warning
As this is only a proxy class, you can not get the address of the bitset.

Member Typedef Documentation

◆ bitset

template<int block_size, class Alloc >
typedef std::bitset<block_size> Dune::BitSetVectorReference< block_size, Alloc >::bitset

◆ BitSetVector

template<int block_size, class Alloc >
typedef Dune::BitSetVector<block_size, Alloc> Dune::BitSetVectorReference< block_size, Alloc >::BitSetVector
protected

◆ BitSetVectorConstReference

template<int block_size, class Alloc >
typedef Dune::BitSetVectorConstReference<block_size,Alloc> Dune::BitSetVectorReference< block_size, Alloc >::BitSetVectorConstReference
protected

◆ const_reference

template<int block_size, class Alloc >
typedef std::vector<bool,Alloc>::const_reference Dune::BitSetVectorReference< block_size, Alloc >::const_reference

A proxy class that acts as a const reference to a single bit.

◆ reference

template<int block_size, class Alloc >
typedef std::vector<bool,Alloc>::reference Dune::BitSetVectorReference< block_size, Alloc >::reference

bitset interface typedefs

A proxy class that acts as a reference to a single bit.

◆ size_type

template<int block_size, class Alloc >
typedef size_t Dune::BitSetVectorReference< block_size, Alloc >::size_type

size_type typedef (an unsigned integral type)

Constructor & Destructor Documentation

◆ BitSetVectorReference()

template<int block_size, class Alloc >
Dune::BitSetVectorReference< block_size, Alloc >::BitSetVectorReference ( BitSetVector blockBitField_,
int  block_number_ 
)
inlineprotected

Member Function Documentation

◆ all()

template<int block_size, class Alloc >
bool Dune::BitSetVectorConstReference< block_size, Alloc >::all ( ) const
inlineinherited

Returns true if all bits are set.

◆ any()

template<int block_size, class Alloc >
bool Dune::BitSetVectorConstReference< block_size, Alloc >::any ( ) const
inlineinherited

Returns true if any bits are set.

◆ count()

template<int block_size, class Alloc >
size_type Dune::BitSetVectorConstReference< block_size, Alloc >::count ( ) const
inlineinherited

Returns the number of bits that are set.

◆ equals()

template<int block_size, class Alloc >
template<class BS >
bool Dune::BitSetVectorConstReference< block_size, Alloc >::equals ( const BS &  bs) const
inlineprotectedinherited

◆ flip() [1/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::flip ( )
inline

Flips the value of every bit.

◆ flip() [2/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::flip ( size_type  n)
inline

Flips bit n.

◆ getBit() [1/2]

template<int block_size, class Alloc >
reference Dune::BitSetVectorReference< block_size, Alloc >::getBit ( size_type  i)
inlineprotected

◆ getBit() [2/2]

template<int block_size, class Alloc >
const_reference Dune::BitSetVectorConstReference< block_size, Alloc >::getBit ( size_type  i) const
inlineprotected

◆ none()

template<int block_size, class Alloc >
bool Dune::BitSetVectorConstReference< block_size, Alloc >::none ( ) const
inlineinherited

Returns true if no bits are set.

◆ operator bitset()

template<int block_size, class Alloc >
Dune::BitSetVectorConstReference< block_size, Alloc >::operator bitset ( ) const
inlineinherited

cast to bitset

◆ operator!=() [1/2]

template<int block_size, class Alloc >
bool Dune::BitSetVectorConstReference< block_size, Alloc >::operator!= ( const bitset bs) const
inlineinherited

Inequality of reference and std::bitset.

◆ operator!=() [2/2]

template<int block_size, class Alloc >
bool Dune::BitSetVectorConstReference< block_size, Alloc >::operator!= ( const BitSetVectorConstReference< block_size, Alloc > &  bs) const
inlineinherited

Inequality of reference and other reference.

◆ operator&=() [1/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator&= ( const bitset x)
inline

Bitwise and (for bitset).

◆ operator&=() [2/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator&= ( const BitSetVectorConstReference x)
inline

◆ operator<<()

template<int block_size, class Alloc >
bitset Dune::BitSetVectorConstReference< block_size, Alloc >::operator<< ( size_type  n) const
inlineinherited

Returns a copy of *this shifted left by n bits.

◆ operator<<=()

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator<<= ( size_type  n)
inline

Left shift.

◆ operator=() [1/4]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator= ( bool  b)
inline

Assignment from bool, sets each bit in the bitset to b.

◆ operator=() [2/4]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator= ( const bitset b)
inline

Assignment from bitset.

◆ operator=() [3/4]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator= ( const BitSetVectorConstReference b)
inline

Assignment from BitSetVectorConstReference.

◆ operator=() [4/4]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator= ( const BitSetVectorReference< block_size, Alloc > &  b)
inline

Assignment from BitSetVectorReference.

◆ operator==() [1/2]

template<int block_size, class Alloc >
bool Dune::BitSetVectorConstReference< block_size, Alloc >::operator== ( const bitset bs) const
inlineinherited

Equality of reference and std::bitset.

◆ operator==() [2/2]

template<int block_size, class Alloc >
bool Dune::BitSetVectorConstReference< block_size, Alloc >::operator== ( const BitSetVectorConstReference< block_size, Alloc > &  bs) const
inlineinherited

Equality of reference and other reference.

◆ operator>>()

template<int block_size, class Alloc >
bitset Dune::BitSetVectorConstReference< block_size, Alloc >::operator>> ( size_type  n) const
inlineinherited

Returns a copy of *this shifted right by n bits.

◆ operator>>=()

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator>>= ( size_type  n)
inline

Right shift.

◆ operator[]() [1/2]

template<int block_size, class Alloc >
reference Dune::BitSetVectorReference< block_size, Alloc >::operator[] ( size_type  i)
inline

Return reference to the i-th bit.

◆ operator[]() [2/2]

template<int block_size, class Alloc >
const_reference Dune::BitSetVectorConstReference< block_size, Alloc >::operator[] ( size_type  i) const
inlineinherited

Return reference to the i-th bit.

◆ operator^=() [1/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator^= ( const bitset x)
inline

Bitwise exclusive or (for bitset).

◆ operator^=() [2/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator^= ( const BitSetVectorConstReference x)
inline

Bitwise exclusive or (for BitSetVectorConstReference and BitSetVectorReference)

◆ operator|=() [1/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator|= ( const bitset x)
inline

Bitwise inclusive or (for bitset)

◆ operator|=() [2/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::operator|= ( const BitSetVectorConstReference x)
inline

Bitwise inclusive or (for BitSetVectorConstReference and BitSetVectorReference)

◆ operator~()

template<int block_size, class Alloc >
bitset Dune::BitSetVectorConstReference< block_size, Alloc >::operator~ ( ) const
inlineinherited

Returns a copy of *this with all of its bits flipped.

◆ reset() [1/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::reset ( )
inline

Clears every bit.

◆ reset() [2/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::reset ( size_type  n)
inline

Clears bit n.

◆ set() [1/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::set ( )
inline

Sets every bit.

◆ set() [2/2]

template<int block_size, class Alloc >
BitSetVectorReference & Dune::BitSetVectorReference< block_size, Alloc >::set ( size_type  n,
int  val = 1 
)
inline

Sets bit n if val is nonzero, and clears bit n if val is zero.

◆ size()

template<int block_size, class Alloc >
size_type Dune::BitSetVectorConstReference< block_size, Alloc >::size ( ) const
inlineinherited

Returns block_size.

◆ test()

template<int block_size, class Alloc >
bool Dune::BitSetVectorConstReference< block_size, Alloc >::test ( size_type  n) const
inline

Returns true if bit n is set.

Member Data Documentation

◆ block_number

template<int block_size, class Alloc >
int Dune::BitSetVectorConstReference< block_size, Alloc >::block_number
protectedinherited

◆ blockBitField

template<int block_size, class Alloc >
BitSetVector& Dune::BitSetVectorReference< block_size, Alloc >::blockBitField
protected

The documentation for this class was generated from the following file: