An unordered set of cubes. More...
#include <sifteo/cube.h>
Inherits Sifteo::BitArray< _SYS_NUM_CUBE_SLOTS >.
Public Member Functions | |
CubeSet (const BitArray< _SYS_NUM_CUBE_SLOTS > &bits) | |
Implicit conversion from a BitArray of the correct size. | |
CubeSet () | |
Create an empty CubeSet. | |
CubeSet (CubeID cube) | |
Create a CubeSet with a single CubeID in it. | |
CubeSet (CubeID begin, CubeID end) | |
Create a new CubeSet with a range of cubes. More... | |
uint32_t | mask () const |
Getter for the underlying bitmask. More... | |
operator _SYSCubeIDVector () const | |
Implicit conversion to _SYSCubeIDVector, for use in low-level system calls. | |
void | setMask (uint32_t mask) |
Setter for the underlying bitmask. More... | |
Public Member Functions inherited from Sifteo::BitArray< _SYS_NUM_CUBE_SLOTS > | |
iterator | begin () const |
Return an STL-style iterator for this array. | |
BitArray () | |
Create a new empty BitArray. | |
BitArray (unsigned index) | |
Create a new BitArray with a single bit marked. | |
BitArray (unsigned begin, unsigned end) | |
Create a new BitArray with a range of bits marked. More... | |
void | clear (unsigned index) |
Clear (set to 0) a single bit. | |
void | clear () |
Clear (set to 0) all bits in the array. | |
bool | clearFirst (unsigned &index) |
Find and clear the lowest marked bit. More... | |
bool | clearN (unsigned &index, unsigned n) |
Find and clear the Nth lowest marked bit. More... | |
unsigned | count () const |
How many bits are marked in this vector? | |
bool | empty () const |
Is every bit in this array set to zero? | |
iterator | end () const |
Return an STL-style iterator for this array. | |
bool | findFirst (unsigned &index) const |
Find the lowest index where there's a marked (1) bit. More... | |
void | mark (unsigned index) |
Mark (set to 1) a single bit. | |
void | mark () |
Mark (set to 1) all bits in the array. | |
BitArray< tSize > | operator& (const BitArray< tSize > &other) const |
Bitwise AND of two BitArrays of the same size. | |
BitArray< tSize > | operator^ (const BitArray< tSize > &other) const |
Bitwise XOR of two BitArrays of the same size. | |
BitArray< tSize > | operator| (const BitArray< tSize > &other) const |
Bitwise OR of two BitArrays of the same size. | |
BitArray< tSize > | operator~ () const |
Negate a BitArray, returning a new array in which each bit is inverted. | |
bool | test (unsigned index) const |
Is a particular bit marked? | |
Static Public Member Functions | |
static CubeSet | connected () |
Return a CubeSet containing all connected cubes which are visible to the current application. More... | |
Static Public Member Functions inherited from Sifteo::BitArray< _SYS_NUM_CUBE_SLOTS > | |
static unsigned | size () |
Retrieve the size of this array in bits, always constant at compile-time. | |
An unordered set of cubes.
A CubeSet can be used with API functions anywhere a _SYSCubeIDVector is expected, and you can iterate over a CubeSet using C++11 style iteration.
Create a new CubeSet with a range of cubes.
This is a half-open interval. All IDs >= 'begin' and < 'end' are in the set.
|
inlinestatic |
Return a CubeSet containing all connected cubes which are visible to the current application.
The number of available cubes will always be within the limits set by your Metadata::cubeRange(). Furthermore, returned cube IDs are all guaranteed to be less than the maximum number of cubes defined in your range. If your code supports at most 6 cubes, for instance, it's perfectly fine to declare 6-element arrays and index them with any CubeID in this set.
The returned CubeSet is guaranteed not to change until the relevant connection and/or disconnection events have been dispatched to your application.
|
inline |
Getter for the underlying bitmask.
Use CubeID::bit() to match a cube to this.
|
inline |
Setter for the underlying bitmask.
Validates that the bit is in the CUBE_ALLOCATION range, but not necessarily connected.
Sifteo SDK v1.1.0 (see all versions)
Last updated Tue Dec 23 2014, by Doxygen