AtlasRequestHeader Struct Reference [Atlas Core]

#include <atlasRequestNote.h>

List of all members.


Detailed Description

Helper class for AtlasResourceStub book-keeping.

In order to properly page data in/out of the Atlas resource system, we not only need to know how many instances (if any) need the specified chunk, but who they are and what their current priority for it is.

To reconcile all of this book-keeping in order to determine a final priority, as well as a "yea/nay" for keeping the resource paged in, involves enough work we break it into its own helper class.

Note:
This system is plenty fast enough for scenarios with small (single-digit) numbers of terrain instances. For more complex scenarios, a linked list might not be enough, and may need to be replaced with a hash or map.


Public Member Functions

 AtlasRequestHeader ()
 ~AtlasRequestHeader ()
void request (void *who, F32 priority, U32 reason)
 Note a request from someone.
void cancel (void *who, U32 reason)
 Cancel a request from someone.
const F32 calculateCumulativePriority () const
 Calculate the total priority on this item.
const U32 getRefCount () const
 Get the current reference count to this stub, based on how many uncanceled requests there are.

Static Public Member Functions

static ARHNoteallocNote ()
static void freeNote (ARHNote *note)

Public Attributes

ARHNotehead
U32 refCount

Static Public Attributes

static FreeListChunker< ARHNotesmChunker

Classes

struct  ARHNote


Constructor & Destructor Documentation

AtlasRequestHeader::AtlasRequestHeader (  ) 

AtlasRequestHeader::~AtlasRequestHeader (  ) 


Member Function Documentation

static ARHNote* AtlasRequestHeader::allocNote (  )  [static]

static void AtlasRequestHeader::freeNote ( ARHNote note  )  [static]

void AtlasRequestHeader::request ( void who,
F32  priority,
U32  reason 
)

Note a request from someone.

This either adds a new ARHNote, or updates one if it exists.

void AtlasRequestHeader::cancel ( void who,
U32  reason 
)

Cancel a request from someone.

This will remove the appropriate ARHNote if it exists.

const F32 AtlasRequestHeader::calculateCumulativePriority (  )  const

Calculate the total priority on this item.

It's best to cache the result in a member so that it's not needlessly churned.

const U32 AtlasRequestHeader::getRefCount (  )  const [inline]

Get the current reference count to this stub, based on how many uncanceled requests there are.


Member Data Documentation