3ds Max C++ API Reference
PtrVector Class Reference

class PtrVector More...

#include <ptrvec.h>

+ Inheritance diagram for PtrVector:

Public Member Functions

UtilExport void reshape (int i)
 
UtilExport void setLength (int i)
 
UtilExport void clear ()
 
void shrink ()
 
int length () const
 
int capacity () const
 

Protected Member Functions

 PtrVector ()
 
UtilExport ~PtrVector ()
 
UtilExport PtrVector (const PtrVector &v)
 
UtilExport PtrVectoroperator= (const PtrVector &v)
 
UtilExport void append (void *ptr, int extra)
 
UtilExport void insertAt (void *ptr, int at, int extra)
 
UtilExport voidremove (int i)
 
UtilExport voidremoveLast ()
 
voidoperator[] (int i) const
 
void *& operator[] (int i)
 

Protected Attributes

int size
 
int nused
 
void ** data
 

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

Detailed Description

class PtrVector

Description:
This class represents a variable length array of pointers which can be stored and manipulated.
Data Members:
protected:

int size;

The size of the array.

int nused;

The number of elements used.

void** data;

The variable length data.
protected:

Constructor & Destructor Documentation

◆ PtrVector() [1/2]

PtrVector ( )
inlineprotected
Remarks
Constructor.
Default Implementation:
{ size = nused = 0; data = NULL; }
37 { size = nused = 0; data = NULL; }
#define NULL
Definition: autoptr.h:18
int nused
Definition: ptrvec.h:32
int size
Definition: ptrvec.h:31
void ** data
Definition: ptrvec.h:33

◆ ~PtrVector()

UtilExport ~PtrVector ( )
protected
Remarks
Destructor.

◆ PtrVector() [2/2]

UtilExport PtrVector ( const PtrVector v)
protected
Remarks
Constructor.
Parameters:
const PtrVector& v

Reference to the PtrVector class to initialize with.

Member Function Documentation

◆ operator=()

UtilExport PtrVector& operator= ( const PtrVector v)
protected
Remarks
Assignment operator.
Parameters:
const PtrVector& v

The reference to the PtrVector to assign.

◆ append()

UtilExport void append ( void ptr,
int  extra 
)
protected
Remarks
This method allows you to append data to the array.
Parameters:
void *ptr

A pointer to the data to add.

int extra

The extra space you wish to reserve. This will reshape the size of the array to nused + extra.

◆ insertAt()

UtilExport void insertAt ( void ptr,
int  at,
int  extra 
)
protected
Remarks
This method allows you to insert data at a specified location.
Parameters:
void *ptr

A pointer to the data to add.

int at

The index in the array you wish to insert at.

int extra

The extra space you wish to reserve. This will reshape the size of the array to nused + extra.

◆ remove()

UtilExport void* remove ( int  i)
protected
Remarks
This method allows you to remove an element from the array.
Parameters:
int i

The index of the element in the array you wish to remove.
Returns
A pointer to the removed element.

◆ removeLast()

UtilExport void* removeLast ( )
protected
Remarks
This method allows you to remove the last element in the array.
Returns
A pointer to the removed element.

◆ operator[]() [1/2]

void* operator[] ( int  i) const
inlineprotected
Remarks
Indexing operator.
Returns
The pointer to the data being referenced by the index.
Default Implementation:
{ return data[i]; }
84 { return data[i]; }

◆ operator[]() [2/2]

void*& operator[] ( int  i)
inlineprotected
Remarks
Indexing operator.
Default Implementation:
{ return data[i]; }

89 { return data[i]; }

◆ reshape()

UtilExport void reshape ( int  i)
Remarks
This method allows you set the capacity of the array.
Parameters:
int i

The capacity to set.

◆ setLength()

UtilExport void setLength ( int  i)
Remarks
This method allows you to set the length and capacity if necessary.
Parameters:
int i

The length to set.

◆ clear()

UtilExport void clear ( )
Remarks
This method allows you to delete the entire ptr array, but not the objects.

◆ shrink()

void shrink ( )
inline
Remarks
This method will shrink the array to its used capacity.
Default Implementation:
{ reshape(nused); }
108 { reshape(nused); }
UtilExport void reshape(int i)

◆ length()

int length ( ) const
inline
Remarks
This method returns the length of the array.
Default Implementation:
{ return nused; }
112 { return nused; }

◆ capacity()

int capacity ( ) const
inline
Remarks
This method returns the capacity of the array.
Default Implementation:
{ return size; }
116 { return size; }

Member Data Documentation

◆ size

int size
protected

◆ nused

int nused
protected

◆ data

void** data
protected