SH::ShStorage Class Reference
[Buffer Management]

A Storage object Storage represents actual, physical storage of some memory's contents. More...

#include <ShMemory.hpp>

Inheritance diagram for SH::ShStorage:

Inheritance graph
[legend]
Collaboration diagram for SH::ShStorage:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ShStorage ()
virtual ~ShStorage ()
int timestamp () const
 Return the version of the data currently stored by this storage.
const ShMemorymemory () const
 Return the memory this storage represents.
ShMemorymemory ()
 Return the memory this storage represents.
void sync () const
 Make sure this storage is in sync with the latest version of the memory.
void dirty ()
 Mark an upcoming write to this storage.
void dirtyall ()
 Mark an upcoming write to this storage.
virtual std::string id () const =0
 Return an id uniquely identifying the _type_ of this storage This is used for looking up transfer functions.
void orphan ()
 Called by ShMemory when it destructs. Necessary for refcounting purposes.
ShValueType value_type () const
 Return the type that is stored inside this object.
void value_type (ShValueType value_type)
 Change the internal type (does NOT convert the values).
int value_size () const
 Return the size in bytes of one value in the storage array.

Static Public Member Functions

static int cost (const ShStorage *from, const ShStorage *to)
 Return the cost of transferring from one storage to another.
static bool transfer (const ShStorage *from, ShStorage *to)
 Transfer data from one storage to another.
static void addTransfer (const std::string &from, const std::string &to, ShTransfer *transfer)
 Use this to register new transfer functions when they are instantiated.

Protected Member Functions

 ShStorage (ShMemory *memory, ShValueType value_type)

Protected Attributes

ShValueType m_value_type
int m_value_size

Detailed Description

A Storage object Storage represents actual, physical storage of some memory's contents.

This might be on the CPU, the GPU, a filesystem or even across the network.

See also:
ShMemory

ShTransfer

Definition at line 150 of file ShMemory.hpp.


Member Function Documentation

int SH::ShStorage::cost const ShStorage from,
const ShStorage to
[static]
 

Return the cost of transferring from one storage to another.

Returns -1 if there is no possible transfer.

Definition at line 198 of file ShMemory.cpp.

References id().

Referenced by sync().

void SH::ShStorage::dirty  ) 
 

Mark an upcoming write to this storage.

This will sync, if necessary.

Definition at line 185 of file ShMemory.cpp.

References dirtyall(), and sync().

void SH::ShStorage::dirtyall  ) 
 

Mark an upcoming write to this storage.

Don't call sync, all storages are replaced.

Definition at line 193 of file ShMemory.cpp.

References SH::ShMemory::increment_timestamp().

Referenced by dirty().

virtual std::string SH::ShStorage::id  )  const [pure virtual]
 

Return an id uniquely identifying the _type_ of this storage This is used for looking up transfer functions.

e.g.: host, opengl:texture, sm:texture

Implemented in SH::ShHostStorage, shgl::GlTextureStorage, and shgl::PBufferStorage.

Referenced by cost(), and transfer().

bool SH::ShStorage::transfer const ShStorage from,
ShStorage to
[static]
 

Transfer data from one storage to another.

Returns true if the transfer succeeded.

Definition at line 210 of file ShMemory.cpp.

References id(), and setTimestamp().

Referenced by addTransfer(), and SH::ShTextureNode::build_mipmaps().


The documentation for this class was generated from the following files:
Generated on Thu Feb 16 14:56:26 2006 for Sh by  doxygen 1.4.6