Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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

int timestamp () const
 Return the version of the data currently stored by this storage.
void setTimestamp (int timestamp)
 Force-set 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 ()
 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 ()
 Don't call sync, all storages are replaced.
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.

Static Public Member Functions

static int cost (ShStorage *from, ShStorage *to)
 Return the cost of transferring from one storage to another.
static bool transfer (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)

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 146 of file ShMemory.hpp.


Member Function Documentation

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

Return the cost of transferring from one storage to another.

Returns -1 if there is no possible transfer.

Definition at line 197 of file ShMemory.cpp.

Referenced by sync().

void SH::ShStorage::dirty  ) 
 

Mark an upcoming write to this storage.

This will sync, if necessary.

Definition at line 183 of file ShMemory.cpp.

References dirtyall(), and sync().

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.

void SH::ShStorage::sync  ) 
 

Make sure this storage is in sync with the latest version of the memory.

Todo:
Maybe make this const... after all, we need to do this on a read!

Definition at line 149 of file ShMemory.cpp.

References cost(), SH::ShMemory::m_storages, timestamp(), SH::ShMemory::timestamp(), and transfer().

Referenced by dirty().

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

Transfer data from one storage to another.

Returns true if the transfer succeeded.

Definition at line 209 of file ShMemory.cpp.

Referenced by addTransfer(), and sync().


The documentation for this class was generated from the following files:
Generated on Mon Jan 24 18:38:14 2005 for Sh by  doxygen 1.4.1