Open PaperOpt
AutoDelete< C > Class Template Reference

#include <utilities.h>

List of all members.

Public Member Functions

 AutoDelete ()
 AutoDelete (C *p)
 ~AutoDelete ()
C * operator-> () const
C & operator* () const
C * Ptr () const
 operator C * () const
void clear ()
void set (C *p)
void operator= (C *p)
C * detatch ()

Detailed Description

template<class C>
class AutoDelete< C >

this file contains all the solitary functions used in p3d and the ancillary class Index of classes in this file: Update

1. template <class c>=""> class AutoDelete memory management class 2. template <class c>=""> class AutoDeleteV memory management class 3. class SimpleDist Definition template <int numbins>=""> SimpleDist 4. class SubdivPatch 5. class SubdivEnv 6. class fiberdata 7. class TreeNode 8. class FiberSample

This class can be used to simplify memory deallocation. It's only simple wrapper for a pointer and its only function is to destroy the referenced object when the pointer is itself destroyed the difference between class AutoDelete and AutoDeleteV is that class AutoDeleteV is used to manage the memory for the array.


Constructor & Destructor Documentation

template<class C>
AutoDelete< C >::AutoDelete ( ) [inline]

default constructor

template<class C>
AutoDelete< C >::AutoDelete ( C *  p) [inline]

constructor allocate memory from the existing pointer

Parameters:
pthe pointer to the given memory space
template<class C>
AutoDelete< C >::~AutoDelete ( ) [inline]

Member Function Documentation

template<class C>
void AutoDelete< C >::clear ( ) [inline]

set the ptr=0

Here is the caller graph for this function:

template<class C>
C* AutoDelete< C >::detatch ( ) [inline]

explicitly invoke this function to release the memory when you use this class to allocate memory to the variables

Here is the caller graph for this function:

template<class C>
AutoDelete< C >::operator C * ( ) const [inline]

overload the pointer operator "*" it returns an address of the memory space

template<class C>
C& AutoDelete< C >::operator* ( ) const [inline]

overload the pointer operator "*" it returns the element that the ptr points to

template<class C>
C* AutoDelete< C >::operator-> ( ) const [inline]

overload pointer operator "->" make the '->' has the same function as the normal pointer to the class

template<class C>
void AutoDelete< C >::operator= ( C *  p) [inline]

overload the operator "="

Parameters:
pthe pointer to the given memory space
template<class C>
C* AutoDelete< C >::Ptr ( ) const [inline]

return the private data member --ptr which is used to point the allocated the memory space.

template<class C>
void AutoDelete< C >::set ( C *  p) [inline]

set the ptr to the given pointer

Parameters:
pthe pointer to the given memory space

The documentation for this class was generated from the following file: