VMan  1.0
Library for voxel managment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Access Class Reference

#include <Access.h>

+ Collaboration diagram for Access:

Public Member Functions

 Access (Volume *volume)
 
 ~Access ()
 
void setPriority (int priority)
 
void select (const vmanSelection *selection)
 
void lock (int mode)
 
bool tryLock (int mode)
 
void unlock ()
 
const void * readVoxelLayer (int x, int y, int z, int layer) const
 
void * readWriteVoxelLayer (int x, int y, int z, int layer) const
 

Detailed Description

Access objects provide r/w access to the volume.

They precache chunks as soon as a valid selection has been set.

Definition at line 17 of file Access.h.

Constructor & Destructor Documentation

Access ( Volume volume)

Initially the selection will be invalid and all r/w operations will fail.

Definition at line 13 of file Access.cpp.

~Access ( )

Deleting a locked access object will cause an error!

Definition at line 23 of file Access.cpp.

+ Here is the call graph for this function:

Member Function Documentation

void setPriority ( int  priority)

Sets the priority value used for sorting io jobs, caused by this access object.

Definition at line 29 of file Access.cpp.

void select ( const vmanSelection selection)

Updates the selection.

At this point the affected chunks will be precached and preloaded. Setting the selection to NULL renders it invalid and will prevent any r/w operations.

Definition at line 34 of file Access.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void lock ( int  mode)

Locks access to the specified selection.

May block when intersecting chunks are already locked by other access objects. May also block while affected chunks are loaded from disk. Multiple access objects may read simultaneously from the same chunk. Will generate an error if its already locked!

Parameters
mode,:Access mode bitmask.
See Also
vmanAccessMode

Definition at line 71 of file Access.cpp.

bool tryLock ( int  mode)

Behaves like lock(), except that it returns false if the selection is already locked.

Returns true on success.

See Also
lock

Definition at line 84 of file Access.cpp.

void unlock ( )

Unlocks access.

Will generate an error if its not locked!

Definition at line 106 of file Access.cpp.

const void * readVoxelLayer ( int  x,
int  y,
int  z,
int  layer 
) const
Returns
: Returns a read only pointer to the voxel data in the specified layer. Will return NULL if the voxel lies outside the selection or an incomplatible access mode has been selected.

Definition at line 131 of file Access.cpp.

+ Here is the call graph for this function:

void * readWriteVoxelLayer ( int  x,
int  y,
int  z,
int  layer 
) const
Returns
: Returns a pointer to the voxel data in the specified layer. Will return NULL if the voxel lies outside the selection or an incomplatible access mode has been selected. Read operations may yield undefined values if write only is active.

Definition at line 137 of file Access.cpp.

+ Here is the call graph for this function:


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