Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
CoreBitFieldHelper Class Reference

Public Types

enum  TestMode {
  MODE_DISABLE = 0,
  MODE_EXACT_BITS,
  MODE_ALL_BITS,
  MODE_ONE_BIT,
  MODE_COUNT
}
 

Public Member Functions

 CoreBitFieldHelper ()
 
 CoreBitFieldHelper (const bool &inclusive, const int &bits, const TestMode &mode=MODE_ONE_BIT)
 
 CoreBitFieldHelper (const int &inclusive_bits, const TestMode &inclusive_mode=MODE_ALL_BITS)
 
 CoreBitFieldHelper (const int &inclusive_bits, const int &exclusive_bits, const TestMode &inclusive_mode=MODE_ALL_BITS, const TestMode &exclusive_mode=MODE_ALL_BITS)
 
 ~CoreBitFieldHelper ()
 Destructor.
 
bool is_disabled () const
 
bool tests_bits (const int &bits) const
 
bool tests_include (const int &bits) const
 
bool tests_exclude (const int &bits) const
 

Protected Attributes

int m_inclusive_bits
 Bits to test for existency.
 
int m_exclusive_bits
 Bits to test for absence.
 
TestMode m_inclusive_mode
 Test mode for the inclusive bits.
 
TestMode m_exclusive_mode
 Test mode for the exclusive bits.
 

Detailed Description

Helper class for performing inclusive and/or exclusive bit field tests.

It defines:

Member Enumeration Documentation

Test modes defining how to compare 2 bit fields.

Enumerator:
MODE_DISABLE 

Test always succeeds. Both bit fields are ignored.

MODE_EXACT_BITS 

Test succeeds if both bit fields are equal.

MODE_ALL_BITS 

Test succeeds if all input bits are present in the target bit field.

MODE_ONE_BIT 

Test succeeds if at least one input bit is present in the target bit field.

Constructor & Destructor Documentation

CoreBitFieldHelper::CoreBitFieldHelper ( )

Default constructor. Sets all bit fields to 0 and all test modes to MODE_DISABLE.

CoreBitFieldHelper::CoreBitFieldHelper ( const bool &  inclusive,
const int &  bits,
const TestMode mode = MODE_ONE_BIT 
)

Constructor to create an inclusive-only or excluvie-only CoreBitFieldHelper.

Parameters
inclusiveIf true, will create an inclusive bit field. Otherwise creates an exclusive bit field.
bitsThe inclusive or exclusive bits to test, depending on inclusive. The unused bit field is set to 0.
modeThe inclusive or exclusive test mode, depending on inclusive. The unused mode is set to MODE_DISABLE
CoreBitFieldHelper::CoreBitFieldHelper ( const int &  inclusive_bits,
const TestMode inclusive_mode = MODE_ALL_BITS 
)

Constructor to create an inclusive-only CoreBitFieldHelper.

Parameters
inclusive_bitsThe inclusive bits to test.
inclusive_modeThe inclusive bits test mode
CoreBitFieldHelper::CoreBitFieldHelper ( const int &  inclusive_bits,
const int &  exclusive_bits,
const TestMode inclusive_mode = MODE_ALL_BITS,
const TestMode exclusive_mode = MODE_ALL_BITS 
)

Constructor to specify all parameters.

Parameters
inclusive_bitsThe inclusive bits to test.
exclusive_bitsThe exclusive bits to test.
inclusive_modeThe inclusive bits test mode
exclusive_modeThe exclusive bits test mode

Member Function Documentation

bool CoreBitFieldHelper::is_disabled ( ) const

Checks if test conditions are always true, meaning that calling the test methods is unnecessary.

Returns
true if inclusive and exclusive test modes are set to MODE_DISABLE, false otherwise.
bool CoreBitFieldHelper::tests_bits ( const int &  bits) const
inline

Compares the given bits against the member inclusive and exclusive bits.

Parameters
bitsThe bits to test.
Returns
true if the given bits match the inclusive and exclusive conditions, false otherwise.
bool CoreBitFieldHelper::tests_exclude ( const int &  bits) const

Compares the given bits against the member exclusive bits.

Parameters
bitsThe bits to test.
Returns
true if the given bits match the exclusive conditions, false otherwise.
bool CoreBitFieldHelper::tests_include ( const int &  bits) const

Compares the given bits against the member inclusive bits.

Parameters
bitsThe bits to test.
Returns
true if the given bits match the inclusive conditions, false otherwise.