Mana
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
Resource Class Reference

A generic reference counted resource object. More...

#include <resource.h>

Inheritance diagram for Resource:
Image ImageSet Music SoundEffect SpriteDef SubImage Tileset

Public Types

enum  OrphanPolicy { DeleteLater , DeleteImmediately }
 

Public Member Functions

 Resource ()=default
 
void incRef ()
 Increments the internal reference count.
 
void decRef (OrphanPolicy orphanPolicy=DeleteLater)
 Decrements the reference count.
 
const std::string & getIdPath () const
 Return the path identifying this resource.
 

Protected Member Functions

virtual ~Resource ()=default
 

Private Attributes

std::string mIdPath
 Path identifying this resource.
 
time_t mTimeStamp
 Time at which the resource was orphaned.
 
unsigned mRefCount = 0
 Reference count.
 

Friends

class ResourceManager
 

Detailed Description

A generic reference counted resource object.

Definition at line 30 of file resource.h.

Member Enumeration Documentation

◆ OrphanPolicy

Enumerator
DeleteLater 
DeleteImmediately 

Definition at line 35 of file resource.h.

Constructor & Destructor Documentation

◆ Resource()

Resource::Resource ( )
default

◆ ~Resource()

virtual Resource::~Resource ( )
protectedvirtualdefault

Member Function Documentation

◆ decRef()

void Resource::decRef ( OrphanPolicy  orphanPolicy = DeleteLater)

Decrements the reference count.

When no references are left, either schedules the object for deletion or deletes it immediately, depending on the orphanPolicy.

Definition at line 30 of file resource.cpp.

◆ getIdPath()

const std::string & Resource::getIdPath ( ) const
inline

Return the path identifying this resource.

Definition at line 57 of file resource.h.

◆ incRef()

void Resource::incRef ( )
inline

Increments the internal reference count.

Definition at line 45 of file resource.h.

Friends And Related Symbol Documentation

◆ ResourceManager

friend class ResourceManager
friend

Definition at line 32 of file resource.h.

Member Data Documentation

◆ mIdPath

std::string Resource::mIdPath
private

Path identifying this resource.

Definition at line 64 of file resource.h.

◆ mRefCount

unsigned Resource::mRefCount = 0
private

Reference count.

Definition at line 66 of file resource.h.

◆ mTimeStamp

time_t Resource::mTimeStamp
private

Time at which the resource was orphaned.

Definition at line 65 of file resource.h.


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