Nebula
Loading...
Searching...
No Matches
MemDb::TableSignature Class Reference

#include <tablesignature.h>

Detailed Description

Basically a bitfield with packed ComponentIds.

Can be used to identify tables, or be used as a mask to query the database for tables that contain a certain set of components.

Note
This class runs on the assumption that we never create a bitfield that contains more bits than necessary. i.e, a field that is 256 bits large but is zero in left most 128 bits is forbidden.

Public Member Functions

 TableSignature ()
 default constructor.
 
 TableSignature (TableSignature const &rhs)
 copy constructor
 
 TableSignature (Util::FixedArray< AttributeId > const &descriptors)
 construct from fixed array of component ids
 
 TableSignature (std::initializer_list< AttributeId > descriptors)
 construct from component id initializer list, for convenience
 
 TableSignature (AttributeId const *descriptors, SizeT num)
 construct from component id pointer array
 
 ~TableSignature ()
 destructor
 
TableSignatureoperator= (TableSignature const &rhs)
 assignment operator
 
bool const operator== (TableSignature const &rhs) const
 equality operator
 
bool const IsValid () const
 check if signature is valid
 
bool const IsSet (AttributeId component) const
 check if a single bit is set
 
void FlipBit (AttributeId component)
 flip a bit.
 
void SetBit (AttributeId component)
 set a bit.
 
void ClearBit (AttributeId component)
 clear a bit.
 

Static Public Member Functions

static bool const CheckBits (TableSignature const &src, TableSignature const &mask)
 (src & mask) == mask
 
static bool const HasAny (TableSignature const &src, TableSignature const &mask)
 check if src has any of the bits in mask set ((src & mask) == 0)
 

Protected Member Functions

void Setup (AttributeId const *descriptors, SizeT num)
 create bitfield from fixed array.
 

Protected Attributes

__m128i * mask
 large bit field, using SSE registers
 
uint8_t size
 number of SSE regs allocated
 

Constructor & Destructor Documentation

◆ TableSignature() [1/5]

MemDb::TableSignature::TableSignature ( )
inline

default constructor.

◆ TableSignature() [2/5]

MemDb::TableSignature::TableSignature ( TableSignature const & rhs)
inline

copy constructor

◆ TableSignature() [3/5]

MemDb::TableSignature::TableSignature ( Util::FixedArray< AttributeId > const & descriptors)
inline

construct from fixed array of component ids

◆ TableSignature() [4/5]

MemDb::TableSignature::TableSignature ( std::initializer_list< AttributeId > descriptors)
inline

construct from component id initializer list, for convenience

◆ TableSignature() [5/5]

MemDb::TableSignature::TableSignature ( AttributeId const * descriptors,
SizeT num )
inline

construct from component id pointer array

◆ ~TableSignature()

MemDb::TableSignature::~TableSignature ( )
inline

destructor

Member Function Documentation

◆ CheckBits()

bool const MemDb::TableSignature::CheckBits ( TableSignature const & src,
TableSignature const & mask )
inlinestatic

(src & mask) == mask

This runs on the assumption that we never create a mask that contains more bits than necessary.

i.e, a mask that is 256 bits large but is zero in left most 128 bits is forbidden.

◆ ClearBit()

void MemDb::TableSignature::ClearBit ( AttributeId component)
inline

clear a bit.

◆ FlipBit()

void MemDb::TableSignature::FlipBit ( AttributeId component)
inline

flip a bit.

◆ HasAny()

bool const MemDb::TableSignature::HasAny ( TableSignature const & src,
TableSignature const & mask )
inlinestatic

check if src has any of the bits in mask set ((src & mask) == 0)

This runs on the assumption that we never create a mask that contains more bits than necessary.

i.e, a mask that is 256 bits large but is zero in left most 128 bits is forbidden.

◆ IsSet()

bool const MemDb::TableSignature::IsSet ( AttributeId component) const
inline

check if a single bit is set

◆ IsValid()

bool const MemDb::TableSignature::IsValid ( ) const
inline

check if signature is valid

◆ operator=()

TableSignature & MemDb::TableSignature::operator= ( TableSignature const & rhs)
inline

assignment operator

◆ operator==()

bool const MemDb::TableSignature::operator== ( TableSignature const & rhs) const
inline

equality operator

◆ SetBit()

void MemDb::TableSignature::SetBit ( AttributeId component)
inline

set a bit.

◆ Setup()

void MemDb::TableSignature::Setup ( AttributeId const * descriptors,
SizeT num )
inlineprotected

create bitfield from fixed array.

Member Data Documentation

◆ mask

__m128i* MemDb::TableSignature::mask
protected

large bit field, using SSE registers

◆ size

uint8_t MemDb::TableSignature::size
protected

number of SSE regs allocated


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