3ds Max C++ API Reference
Loading...
Searching...
No Matches
LinkedListT< T, TE > Class Template Reference

#include <linklist.h>

+ Inheritance diagram for LinkedListT< T, TE >:

Public Member Functions

 LinkedListT ()=default
 
 ~LinkedListT ()
 
void New ()
 
int Count () const
 
void Append (const T &item)
 
T & operator[] (int index)
 
const T & operator[] (int index) const
 
LinkedListToperator= (const LinkedListT &from)
 

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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 

Detailed Description

template<class T, class TE>
class LinkedListT< T, TE >
Description:
Simple linked list class. Methods and operators are provided to create new linked lists, return the number of items in the list, access item using the array operator ([]), and assign one list to another. All methods of this class are implemented by the system.

Constructor & Destructor Documentation

◆ LinkedListT()

LinkedListT ( )
default
Remarks
Constructor. The list is initialed to NULL and the count is set to 0.

◆ ~LinkedListT()

~LinkedListT ( )
inline
Remarks
Destructor.
62 {
63 New();
64 }
void New()
Definition: linklist.h:67

Member Function Documentation

◆ New()

void New ( )
inline
Remarks
The items in the list are deleted. The list is initialed to NULL and the count is set to 0.
68 {
69 while (head)
70 {
71 TE* next = (TE*)head->next;
72 delete head;
73 head = next;
74 }
75 head = tail = nullptr;
76 count = 0;
77 }

◆ Count()

int Count ( ) const
inline
Remarks
Returns the number of items in the list.
79{ return count; }

◆ Append()

void Append ( const T &  item)
inline
Remarks
Adds a new item to the end of the list.
Parameters:
T& item

The item to add.
Operators:
87 {
88 TE* entry = new TE(item);
89 if (tail)
90 tail->next = entry;
91 tail = entry;
92 if (!head)
93 head = entry;
94 count++;
95 }

◆ operator[]() [1/2]

T & operator[] ( int  index)
inline
Remarks
Allows access to items in the list using the array operator. The first item in the list has an index of 0.
Parameters:
int index

The array index of the item to access.
101{ return getAtIndex(*this, index); }

◆ operator[]() [2/2]

const T & operator[] ( int  index) const
inline
102{ return getAtIndex(*this, index);}

◆ operator=()

LinkedListT & operator= ( const LinkedListT< T, TE > &  from)
inline
Remarks
Assignment operator.
Parameters:
LinkedListT &from

The list to copy.
Returns
A new linked list that is a copy of the list passed.
109 {
110 New();
111 for (int i = 0; i < from.Count(); ++i)
112 Append(from[i]);
113 return *this;
114 }
void Append(const T &item)
Definition: linklist.h:86
int Count() const
Definition: linklist.h:79