Public Member Functions

MapBitArray Class Reference

Search for all occurrences

Detailed 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.

#include <mesh.h>

Inheritance diagram for MapBitArray:
Inheritance graph
[legend]

List of all members.

Public Member Functions

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

Constructor & Destructor Documentation

MapBitArray ( ) [inline]

Constructor. Sets all channels to false.

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

Constructor. Sets all channels to the given default value.

        : 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.

        : 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()".

{ return (mTextureFlip.GetSize()>1) ? mTextureFlip.GetSize()-1 : 0; }
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()".

{ return (mColorFlip.GetSize()>1) ? 1-mColorFlip.GetSize() : 0; }
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.

{ Set (mapChannel, false); }
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.

{ return mTexture; }
bool ColorDefault ( ) const [inline]

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

{ return mColor; }
void InvertTextureChannels ( ) [inline]

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

{ mTexture=!mTexture; }
void InvertColorChannels ( ) [inline]

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

{ mColor=!mColor; }
void InvertAll ( ) [inline]

Inverts all channel values.

{ 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.

{ return Get(i); }
DllExport BOOL operator== ( const MapBitArray b ) const

Comparison operator.

BOOL operator!= ( const MapBitArray b ) const [inline]

Inequality operator.

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

Assignment operator.


MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray
MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray MapBitArray