An internal helper class, representing an array. Use the Store class instead.
#include <array.h>

Public Member Functions |
|
| Array (const char *sName) | |
| Array (const char *sName, unsigned int iSize) | |
| Array (const char *sName, const type *pArray, int iSize) | |
| Array (const char *sName, bool bNoObjects) | |
| Array (const char *sName, const Array< type > &a) | |
| void | Clear (bool bDestruct=false) |
| Array< type > | Clone (void) const |
| bool | Copy (Array< type > &a) const |
| void | Set (unsigned int iStart, unsigned int iSize, unsigned char cPattern) |
| bool | Extend (unsigned int iElementIndex) |
| bool | Alloc (unsigned int iNewSize) |
| type & | operator[] (int iIndex) |
| type & | operator[] (unsigned int iIndex) |
| const type & | operator[] (unsigned int iIndex) const |
| type * | operator+ (unsigned int iIndex) |
| type * | operator+ (int iIndex) |
| void | operator= (const Array< type > &a) |
| ~Array (void) | |
| virtual long long | MemoryUsage (void) const |
Protected Attributes |
|
| type * | m_pArray |
| unsigned int | m_iSize |
| bool | m_bData |
| const Array< type > * | m_pThis |
Friends |
|
| class | Block |
| Array | ( | const char * | sName | ) | [inline] |
| Array | ( | const char * | sName, |
| unsigned int | iSize | ||
| ) | [inline] |
Definition at line 70 of file array.h.
: Block( sName, sizeof(type) )
{
m_bData = true;
m_iSize = iSize;
m_pArray = 0;
try
{
if ( RegisterMemoryBlock( sizeof(type)*iSize ) )
{
SetAllocatorID( sName );
m_pArray = new type[iSize];
SetAllocatorID( 0 );
}
else
throw &Error::s_cBadAlloc;
}
catch ( ... )
{
LogAll();
throw &Error::s_cBadAlloc;
};
m_pThis = this;
};
| Array | ( | const char * | sName, |
| const type * | pArray, | ||
| int | iSize | ||
| ) | [inline] |
Definition at line 93 of file array.h.
: Block( sName, sizeof(type) )
{
m_bData = true;
m_pArray = 0;
try
{
if ( RegisterMemoryBlock( sizeof(type)*iSize ) )
{
SetAllocatorID( sName );
m_pArray = new type[iSize];
SetAllocatorID( 0 );
}
else
Error::ThrowBadAlloc();
}
catch ( ... )
{
// probably std::bad_alloc
LogAll();
throw &Error::s_cBadAlloc;
};
if( !m_pArray )
return;
memcpy( m_pArray, pArray, sizeof(type)*iSize );
m_iSize = iSize;
m_pThis = this;
};
| Array | ( | const char * | sName, |
| bool | bNoObjects | ||
| ) | [inline] |
| ~Array | ( | void | ) | [inline] |
| void Clear | ( | bool | bDestruct = false |
) | [inline] |
| Array<type> Clone | ( | void | ) | const [inline] |
Reimplemented in Store< type >, Store< TC >, Store< Attribute * >, Store< Vector >, Store< ChordLength >, Store< float >, Store< QString >, Store< mudbox::Vector >, Store< unsigned int >, Store< VertexChange >, Store< Vertex >, Store< unsigned char >, and Store< BrushConfiguration * >.
Definition at line 152 of file array.h.
{ Array<type> a; Copy( a ); return a; };
| bool Copy | ( | Array< type > & | a | ) | const [inline] |
| void Set | ( | unsigned int | iStart, |
| unsigned int | iSize, | ||
| unsigned char | cPattern | ||
| ) | [inline] |
| bool Extend | ( | unsigned int | iElementIndex | ) | [inline] |
| bool Alloc | ( | unsigned int | iNewSize | ) | [inline] |
Definition at line 172 of file array.h.
{
if ( iNewSize == m_iSize )
return true;
MB_ASSERT( m_pThis == this );
type *pNew = 0;
try
{
if ( RegisterMemoryBlock( sizeof(type)*iNewSize ) )
{
SetAllocatorID( m_sName );
pNew = new type[iNewSize];
SetAllocatorID( 0 );
}
else
throw &Error::s_cBadAlloc;
}
catch ( Error * )
{
LogAll();
return false;
}
catch ( ... )
{
// probably std::bad_alloc
LogAll();
throw &Error::s_cBadAlloc;
};
if( pNew == 0 )
return false;
if( m_iSize )
{
UnregisterMemoryBlock( sizeof(type)*m_iSize );
if ( m_bData )
CopyMemoryBlock( pNew, m_pArray, Min( iNewSize, m_iSize )*sizeof(type) );
else
for ( unsigned int i = 0; i < Min( iNewSize, m_iSize ); i++ )
pNew[i] = m_pArray[i];
delete [] m_pArray;
};
m_pArray = pNew;
m_iSize = iNewSize;
return true;
};
| type& operator[] | ( | int | iIndex | ) | [inline] |
| type& operator[] | ( | unsigned int | iIndex | ) | [inline] |
| const type& operator[] | ( | unsigned int | iIndex | ) | const [inline] |
| type* operator+ | ( | unsigned int | iIndex | ) | [inline] |
Reimplemented in Store< type >, Store< TC >, Store< Attribute * >, Store< Vector >, Store< ChordLength >, Store< float >, Store< QString >, Store< mudbox::Vector >, Store< unsigned int >, Store< VertexChange >, Store< Vertex >, Store< unsigned char >, and Store< BrushConfiguration * >.
Definition at line 238 of file array.h.
{ MB_ASSERT( m_pThis == this ); return &operator[]( iIndex ); };
| type* operator+ | ( | int | iIndex | ) | [inline] |
Reimplemented in Store< type >, Store< TC >, Store< Attribute * >, Store< Vector >, Store< ChordLength >, Store< float >, Store< QString >, Store< mudbox::Vector >, Store< unsigned int >, Store< VertexChange >, Store< Vertex >, Store< unsigned char >, and Store< BrushConfiguration * >.
Definition at line 239 of file array.h.
{ MB_ASSERT( m_pThis == this ); return &operator[]( iIndex ); };
| void operator= | ( | const Array< type > & | a | ) | [inline] |
| virtual long long MemoryUsage | ( | void | ) | const [inline, virtual] |
friend class Block [friend] |
type* m_pArray
[mutable, protected] |
unsigned int m_iSize
[mutable, protected] |
bool m_bData
[mutable, protected] |