The Nebula Device 3: FrameSync::FrameSyncSharedData Class Reference

The Nebula Device 3

FrameSync::FrameSyncSharedData Class Reference

#include <framesyncshareddata.h>

Inheritance diagram for FrameSync::FrameSyncSharedData:

Core::RefCounted

Detailed Description

A lock-less, double buffered data exchange object between 2 threads which are running in lockstep through the FrameSync system (e.g. the main thread and render thread). The owner thread is defined as the thread which owns the FrameSyncSharedData object (usually the main thread), and the client thread is usually the render thread.

(C) 2010 Radon Labs GmbH

Public Member Functions

 FrameSyncSharedData ()
 constructor
virtual ~FrameSyncSharedData ()
 destructor
template<typename T>
void OwnerSetup (T *ignoreMe=0)
 owner-side setup function
template<typename T>
void OwnerDiscard (T *ignoreMe=0)
 owner-discard, must be called when owner is done with the object
template<typename T>
T & Owner ()
 access data as owner
template<typename T>
void ClientSetup (T *ignoreMe=0)
 client-side setup function
template<typename T>
void ClientDiscard (T *ignoreMe=0)
 client-discard, must be called when the client is done with the object
template<typename T>
T & Client ()
 access data as client
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Static Public Member Functions

static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Member Function Documentation

template<typename TYPE>
void FrameSync::FrameSyncSharedData::OwnerSetup ( TYPE *  ignoreMe = 0  )  [inline]

owner-side setup function

Call this method from the owner thread before handing a smart ptr to the object to the client thread!

template<typename TYPE>
void FrameSync::FrameSyncSharedData::OwnerDiscard ( TYPE *  ignoreMe = 0  )  [inline]

owner-discard, must be called when owner is done with the object

Call this method from the owner thread when the owner thread no longer needs the object.

template<typename TYPE>
void FrameSync::FrameSyncSharedData::ClientSetup ( TYPE *  ignoreMe = 0  )  [inline]

client-side setup function

Call this method on the client thread. It must be guaranteed that OwnerSetup() has already finished when this method is called! The provided template type must be identical between all method calls!

template<typename TYPE>
void FrameSync::FrameSyncSharedData::ClientDiscard ( TYPE *  ignoreMe = 0  )  [inline]

client-discard, must be called when the client is done with the object

Call this method from the client thread when the client thread no longer needs the object.

int Core::RefCounted::GetRefCount (  )  const [inline, inherited]

get the current refcount

Return the current refcount of the object.

void Core::RefCounted::AddRef (  )  [inline, inherited]

increment refcount by one

Increment the refcount of the object.

void Core::RefCounted::Release (  )  [inline, inherited]

decrement refcount and destroy object if refcount is zero

Decrement the refcount and destroy object if refcount is zero.

const Util::String & Core::RefCounted::GetClassName (  )  const [inline, inherited]

get the class name

Get the class name of the object.

Util::FourCC Core::RefCounted::GetClassFourCC (  )  const [inline, inherited]

get the class FourCC code

Get the class FourCC of the object.

void Core::RefCounted::DumpRefCountingLeaks (  )  [static, inherited]

dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

This method should be called as the very last before an application exits.