MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Public Types | Public Member Functions | Static Public Member Functions
mds::lbp::CBitOps< T, N > Class Template Reference

Various routines for manipulating bits in integers. More...

#include <mdsBitOps.h>

List of all members.

Public Types

enum  { VALID_BITS = N }
 User defined number of used rightmost bits. More...
enum  { NUM_OF_BITS = sizeof(T) * 8 }
 Size of the T type in bits. More...
enum  { UNUSED_BITS = NUM_OF_BITS - N }
 The number of unused bits. More...
enum  { isValid = mds::CTypeTraits<T>::isIntegral }
 Test if a given type is valid. More...

Public Member Functions

template<>
unsigned char getMask ()
template<>
unsigned int getNumOfBits ()
template<>
unsigned int getNumOfOnes (unsigned char Value)
template<>
unsigned int getNumOfTransitions (unsigned char Value)
template<>
unsigned int getNumOfValidBits ()
template<>
unsigned char rotate2Min (unsigned char Value)
template<>
unsigned char rotateLeft (unsigned char Value, unsigned int n)
template<>
unsigned char rotateRight (unsigned char Value, unsigned int n)

Static Public Member Functions

static std::string conv2String (T Value)
 Returns a textual representation of a binary number.
static T getMask ()
 Returns mask of valid rightmost bits.
static unsigned int getNumOfBits ()
 Returns number of bits in template type (considering 8-bit per byte).
static unsigned int getNumOfOnes (T Value)
 Returns the number of ones in a binary number.
static unsigned int getNumOfTransitions (T Value)
 Returns the number of 0-to-1 or 1-to-0 transitions in a binary number.
static unsigned int getNumOfValidBits ()
 Returns the user defined number of valid rightmost bits.
static T rotate2Min (T Value)
 Rotates a binary number to the minimum possible value.
static T rotateLeft (T Value, unsigned int n)
 Rotates a binary number left by n positions.
static T rotateRight (T Value, unsigned int n)
 Rotates a binary number right by n positions.

Detailed Description

template<typename T, unsigned int N = 8>
class mds::lbp::CBitOps< T, N >

Various routines for manipulating bits in integers.


Member Enumeration Documentation

template<typename T , unsigned int N = 8>
anonymous enum

User defined number of used rightmost bits.

Enumerator:
VALID_BITS 
template<typename T , unsigned int N = 8>
anonymous enum

Size of the T type in bits.

Enumerator:
NUM_OF_BITS 
template<typename T , unsigned int N = 8>
anonymous enum

The number of unused bits.

Enumerator:
UNUSED_BITS 
template<typename T , unsigned int N = 8>
anonymous enum

Test if a given type is valid.

Enumerator:
isValid 

Member Function Documentation

template<typename T , unsigned int N = 8>
static std::string mds::lbp::CBitOps< T, N >::conv2String ( Value) [static]

Returns a textual representation of a binary number.

template<typename T , unsigned int N = 8>
static T mds::lbp::CBitOps< T, N >::getMask ( ) [static]

Returns mask of valid rightmost bits.

template<>
unsigned char mds::lbp::CBitOps< unsigned char, 8 >::getMask ( )
template<typename T , unsigned int N = 8>
static unsigned int mds::lbp::CBitOps< T, N >::getNumOfBits ( ) [static]

Returns number of bits in template type (considering 8-bit per byte).

template<>
unsigned int mds::lbp::CBitOps< unsigned char, 8 >::getNumOfBits ( )
template<typename T , unsigned int N = 8>
static unsigned int mds::lbp::CBitOps< T, N >::getNumOfOnes ( Value) [static]

Returns the number of ones in a binary number.

template<>
unsigned int mds::lbp::CBitOps< unsigned char, 8 >::getNumOfOnes ( unsigned char  Value)
template<typename T , unsigned int N = 8>
static unsigned int mds::lbp::CBitOps< T, N >::getNumOfTransitions ( Value) [static]

Returns the number of 0-to-1 or 1-to-0 transitions in a binary number.

template<>
unsigned int mds::lbp::CBitOps< unsigned char, 8 >::getNumOfTransitions ( unsigned char  Value)
template<typename T , unsigned int N = 8>
static unsigned int mds::lbp::CBitOps< T, N >::getNumOfValidBits ( ) [static]

Returns the user defined number of valid rightmost bits.

template<>
unsigned int mds::lbp::CBitOps< unsigned char, 8 >::getNumOfValidBits ( )
template<typename T , unsigned int N = 8>
static T mds::lbp::CBitOps< T, N >::rotate2Min ( Value) [static]

Rotates a binary number to the minimum possible value.

template<>
unsigned char mds::lbp::CBitOps< unsigned char, 8 >::rotate2Min ( unsigned char  Value)
template<typename T , unsigned int N = 8>
static T mds::lbp::CBitOps< T, N >::rotateLeft ( Value,
unsigned int  n 
) [static]

Rotates a binary number left by n positions.

template<>
unsigned char mds::lbp::CBitOps< unsigned char, 8 >::rotateLeft ( unsigned char  Value,
unsigned int  n 
)
template<typename T , unsigned int N = 8>
static T mds::lbp::CBitOps< T, N >::rotateRight ( Value,
unsigned int  n 
) [static]

Rotates a binary number right by n positions.

template<>
unsigned char mds::lbp::CBitOps< unsigned char, 8 >::rotateRight ( unsigned char  Value,
unsigned int  n 
)

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