MapBitArray Class Reference

MapBitArray Class Reference

#include <mesh.h>

Class Description

This class can be used to store a bit per map channel, including both negative and positive map channels, and it works with any size index.

+ Inheritance diagram for MapBitArray:

Public Member Functions

 MapBitArray ()
 Constructor. Sets all channels to false. More...
 
 MapBitArray (bool defaultValue)
 Constructor. Sets all channels to the given default value. More...
 
 MapBitArray (bool textureDefault, bool colorDefault)
 Constructor. More...
 
int Largest () const
 Returns the highest index that this MapBitArray could have a non-default value for. More...
 
int Smallest () const
 Returns the lowest index that this MapBitArray could have a non-default value for. More...
 
DllExport void Set (int mapChannel, bool val=true)
 Sets the value of the given channel. More...
 
void Clear (int mapChannel)
 Clears the value of the given channel. More...
 
DllExport bool Get (int mapChannel) const
 Gets the value of the given channel. More...
 
bool TextureDefault () const
 Returns the default value for texture channels, channels 1 and above. More...
 
bool ColorDefault () const
 Returns the default value for color channels, channels 0 and below. More...
 
void InvertTextureChannels ()
 Inverts the value of all texture channels (1 and above). More...
 
void InvertColorChannels ()
 Inverts the value of all color channels (0 and below). More...
 
void InvertAll ()
 Inverts all channel values. More...
 
DllExport IOResult Save (ISave *isave)
 Saves data to stream. More...
 
DllExport IOResult Load (ILoad *iload)
 Loads data from stream. More...
 
bool operator[] (int i) const
 Indexing operator. More...
 
DllExport BOOL operator== (const MapBitArray &b) const
 Comparison operator. More...
 
BOOL operator!= (const MapBitArray &b) const
 Inequality operator. More...
 
DllExport MapBitArrayoperator= (const MapBitArray &b)
 Assignment operator. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Constructor & Destructor Documentation

MapBitArray ( )
inline

Constructor. Sets all channels to false.

588 : mTexture(false), mColor(false) { }
MapBitArray ( bool  defaultValue)
inline

Constructor. Sets all channels to the given default value.

593  : mTexture(defaultValue), mColor(defaultValue) { }
MapBitArray ( bool  textureDefault,
bool  colorDefault 
)
inline

Constructor.

Sets all texture channels (1 and above) to the texture default, and all color channels (0 and below) to the color default.

598  : mTexture(textureDefault), mColor(colorDefault) { }

Member Function Documentation

int Largest ( ) const
inline

Returns the highest index that this MapBitArray could have a non-default value for.

All indices above this are guaranteed to have value "TextureDefault()".

602 { return (mTextureFlip.GetSize()>1) ? mTextureFlip.GetSize()-1 : 0; }
int GetSize() const
Definition: bitarray.h:259
int Smallest ( ) const
inline

Returns the lowest index that this MapBitArray could have a non-default value for.

All indices below this are guaranteed to have value "ColorDefault()".

606 { return (mColorFlip.GetSize()>1) ? 1-mColorFlip.GetSize() : 0; }
int GetSize() const
Definition: bitarray.h:259
DllExport void Set ( int  mapChannel,
bool  val = true 
)

Sets the value of the given channel.

void Clear ( int  mapChannel)
inline

Clears the value of the given channel.

612 { Set (mapChannel, false); }
DllExport void Set(int mapChannel, bool val=true)
Sets the value of the given channel.
DllExport bool Get ( int  mapChannel) const

Gets the value of the given channel.

(If this particular channel has not been set before, the default for the channel will be returned.)

bool TextureDefault ( ) const
inline

Returns the default value for texture channels, channels 1 and above.

619 { return mTexture; }
bool ColorDefault ( ) const
inline

Returns the default value for color channels, channels 0 and below.

622 { return mColor; }
void InvertTextureChannels ( )
inline

Inverts the value of all texture channels (1 and above).

625 { mTexture=!mTexture; }
void InvertColorChannels ( )
inline

Inverts the value of all color channels (0 and below).

628 { mColor=!mColor; }
void InvertAll ( )
inline

Inverts all channel values.

631 { mColor = !mColor; mTexture = !mTexture; }
DllExport IOResult Save ( ISave isave)

Saves data to stream.

DllExport IOResult Load ( ILoad iload)

Loads data from stream.

bool operator[] ( int  i) const
inline

Indexing operator.

640 { return Get(i); }
DllExport bool Get(int mapChannel) const
Gets the value of the given channel.
DllExport BOOL operator== ( const MapBitArray b) const

Comparison operator.

BOOL operator!= ( const MapBitArray b) const
inline

Inequality operator.

646 { return !(*this == b); }
DllExport MapBitArray& operator= ( const MapBitArray b)

Assignment operator.