Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Protected Attributes
ManagedVector< Value > Class Template Reference

#include <ManagedVector.h>

Inheritance diagram for ManagedVector< Value >:

List of all members.

Public Member Functions

__inline bool getManaged () const
 ManagedVector ()
 ManagedVector (bool manageMemory)
__inline void setManaged (bool val)
virtual ~ManagedVector ()

Protected Attributes

bool _manageMemory

Detailed Description

template<class Value>
class ManagedVector< Value >

An extension of the vector class that deletes all items in its destructor It manages a vector's memory by deleting in the destructor as long as "Managed" is true By default, managed equals zero

Definition at line 13 of file ManagedVector.h.


Constructor & Destructor Documentation

template<class Value >
ManagedVector< Value >::ManagedVector ( ) [inline]

Constructor

Definition at line 22 of file ManagedVector.h.

                    : _manageMemory(false) 
    {
    }
template<class Value >
ManagedVector< Value >::ManagedVector ( bool  manageMemory) [inline]

Constructor Sets whether or not memory is managed by this dictionary

Definition at line 30 of file ManagedVector.h.

                                     : _manageMemory(manageMemory) 
    {
    }
template<class Value >
virtual ManagedVector< Value >::~ManagedVector ( ) [inline, virtual]

Destructor If "managed" is true, then this will delete all values in this dictionary

Definition at line 38 of file ManagedVector.h.

References ManagedVector< Value >::_manageMemory.

    {
        //if we are not managing memory, then abort
        if(!_manageMemory)
            return;

        std::vector<Value*>::const_iterator iter = begin();
        std::vector<Value*>::const_iterator endIter = end();
        while(iter != endIter)
        {
            delete (*iter);
            ++iter;
        }
    }

Member Function Documentation

template<class Value >
__inline bool ManagedVector< Value >::getManaged ( ) const [inline]

Definition at line 54 of file ManagedVector.h.

template<class Value >
__inline void ManagedVector< Value >::setManaged ( bool  val) [inline]

Definition at line 55 of file ManagedVector.h.


Member Data Documentation

template<class Value >
bool ManagedVector< Value >::_manageMemory [protected]

Definition at line 16 of file ManagedVector.h.

Referenced by ManagedVector< Value >::~ManagedVector().


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

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net