Loki::SafeBitConst< unique_index, word_t > Class Template Reference

List of all members.

Public Types

typedef word_t bit_word_t
 Type of the bit field is available if needed.
typedef SafeBitField
< unique_index, word_t > 
field_t
 Corresponding field type.

Public Member Functions

 SafeBitConst ()
 Default constructor allows client code to construct bit fields on the stack.
 SafeBitConst (const SafeBitConst &rhs)
 Copy constructor.
bool operator== (const SafeBitConst &rhs) const
 Comparison operators which take a constant bit value.
bool operator== (const field_t &rhs) const
 Comparision operators for mutable bit fields.
const SafeBitConst operator| (const SafeBitConst &rhs) const
field_t operator| (const field_t &rhs) const
 These bitwise operators return a bit-field instead of a bit-const.
const SafeBitConst operator<< (unsigned int s) const

Static Public Member Functions

static size_t size ()
 Word size is also the maximum number of different bit fields for a given word type.

Friends

class SafeBitField< unique_index, word_t >
 Typedef is not allowed in friendship declaration.


Detailed Description

template<unsigned int unique_index, typename word_t = unsigned long>
class Loki::SafeBitConst< unique_index, word_t >

This class defines a bit-field constant - a collection of unchanging bits used to compare to bit-fields. Instances of this class are intended to act as labels for bit-fields.

Safety
  • This class provides operations used for comparisons and conversions, but no operations which may modify the value.
  • As a templated class, it provides type-safety so bit values and constants used for different reasons may not be unknowingly compared to each other.
  • The unique_index template parameter insures the unique type of each bit bit-field. It shares the unique_index with a similar SafeBitField.
  • Its operations only allow comparisons to other bit-constants and bit-fields of the same type.
This class defines a bit-field constant - a collection of unchanging bits used to compare to bit-fields. Instances of this class are intended to store bit values.

Safety
  • This class provides operations used for comparisons and conversions, and also operations which may safely modify the value.
  • As a templated class, it provides type-safety so bit values and constants used for different reasons may not be unknowingly compared to each other.
  • The unique_index template parameter insures the unique type of each bit bit-field. It shares the unique_index with a similar SafeBitConst.
  • Its operations only allow comparisons to other bit-constants and bit-fields of the same type.

Member Function Documentation

template<unsigned int unique_index, typename word_t = unsigned long>
const SafeBitConst Loki::SafeBitConst< unique_index, word_t >::operator<< ( unsigned int  s  )  const [inline]

The shift operators move bits inside the bit field. These are useful in loops which act over bit fields and increment them.

References Loki::SafeBitConst< unique_index, word_t >::SafeBitConst().

Here is the call graph for this function:

template<unsigned int unique_index, typename word_t = unsigned long>
const SafeBitConst Loki::SafeBitConst< unique_index, word_t >::operator| ( const SafeBitConst< unique_index, word_t > &  rhs  )  const [inline]

Bitwise operations. Operation-assignment operators are not needed, since bit constants cannot be changed after they are initialized.

References Loki::SafeBitConst< unique_index, word_t >::SafeBitConst(), and Loki::SafeBitConst< unique_index, word_t >::word.

Here is the call graph for this function:


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

Generated on Thu Jan 29 18:51:43 2009 for Loki by  doxygen 1.5.8