Caelum  0.6.3
Public Types | Static Public Member Functions | List of all members
Caelum::PrivateResourcePtrTraits< PointedT, InnerT, ManagerT > Struct Template Reference

PrivatePtr traits for uniquely-owned resources. More...

#include <PrivatePtr.h>

Public Types

typedef InnerT InnerPointerType
 

Static Public Member Functions

static const InnerT getNullValue ()
 
static PointedT * getPointer (const InnerPointerType &inner)
 
static void destroy (InnerPointerType &inner)
 

Detailed Description

template<class PointedT, class InnerT, class ManagerT>
struct Caelum::PrivateResourcePtrTraits< PointedT, InnerT, ManagerT >

PrivatePtr traits for uniquely-owned resources.

All ogre resources are tracked by a resource managed by name and can be globally referenced from multiple places. This traits class allows you to hold a pointer to a resource which you create and completely control.

The best example of this is a cloned material. It is frequently useful to create a clone of an existing material and tweak settings for one particular usage. After the clone is no longer useful the material must be explicitly removed from the MaterialManager. Otherwise an unloaded resource handle is leaked.

When the PrivatePtr gets out of scope the resource is removed from the manager. In debug mode this will also check that there are no other references to the destroyed resource.


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