LAMA
lama::Context::ContextData Struct Reference

#include <Context.hpp>

Inheritance diagram for lama::Context::ContextData:

Public Types

enum  AccessKind { Read, Write, MaxAccessKind }

Public Member Functions

 ContextData (ContextPtr context)
 Constructor, context must always be given.
 ~ContextData ()
void allocate (const size_t size)
 allocate data for the Context array on the context
void setRef (void *reference, const size_t size)
 set reference instead of own data allocation.
void realloc (const size_t newSize, const size_t saveSize)
 Reallocate new memory on the context.
void free ()
 free data for the Context array on the context
bool isPinned () const
void setPinned () const
void setCleanFunction (boost::function< void(void *)> cleanFunktion) const

Data Fields

ContextPtr context
 shared pointer to the context
void * pointer
 pointer to the data on the context
size_t size
 size of a single element
bool allocated
 is true if data has been allocated by context
bool valid
 is true if there is a valid copy on the context
unsigned char lock [MaxAccessKind]
 read, write lock

Private Member Functions

 ContextData ()

Private Attributes

bool pinned
boost::function< void(void *) mCleanFunktion )

Member Enumeration Documentation

Enumerator:
Read 

read access to the array, can be multiple

Write 

write access to the array, only one at a time

MaxAccessKind 

internal use for dimension of arrays


Constructor & Destructor Documentation

Constructor, context must always be given.

References lock, Read, and Write.


Member Function Documentation

void lama::Context::ContextData::allocate ( const size_t  size)

allocate data for the Context array on the context

References LAMA_ASSERT_DEBUG, and LAMA_THROWEXCEPTION.

Referenced by lama::LAMAArray< T >::LAMAArray().

free data for the Context array on the context

References LAMA_ASSERT_DEBUG.

Referenced by lama::DefaultHostContext::free(), and lama::LAMAArray< T >::purge().

void lama::Context::ContextData::realloc ( const size_t  newSize,
const size_t  saveSize 
)

Reallocate new memory on the context.

Parameters:
newCapacitynumber of entries for new allocated memory
saveCapacitynumber of entries to copy back from old memory

References LAMA_ASSERT_DEBUG, and LAMA_ASSERT_ERROR.

void lama::Context::ContextData::setCleanFunction ( boost::function< void(void *)>  cleanFunktion) const
void lama::Context::ContextData::setRef ( void *  reference,
const size_t  size 
)

set reference instead of own data allocation.

References LAMA_ASSERT_DEBUG, and LAMA_THROWEXCEPTION.

Referenced by lama::LAMAArrayRef< T >::LAMAArrayRef().


Field Documentation

is true if data has been allocated by context

boost::function<void( void* ) lama::Context::ContextData::mCleanFunktion) [mutable, private]
bool lama::Context::ContextData::pinned [mutable, private]

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