VMan  1.0
Library for voxel managment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
vman.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  vmanLayer
 
struct  vmanStatistics
 
struct  vmanVolumeParameters
 
struct  vmanSelection
 

Macros

#define VMAN_API
 

Typedefs

typedef void * vmanVolume
 
typedef void * vmanAccess
 

Enumerations

enum  vmanError { VMAN_NO_ERROR = 0, VMAN_OUT_OF_MEMORY }
 
enum  { VMAN_MAX_LAYER_NAME_LENGTH = 31 }
 
enum  vmanLogLevel { VMAN_LOG_DEBUG = 0, VMAN_LOG_INFO, VMAN_LOG_WARNING, VMAN_LOG_ERROR }
 
enum  vmanAccessMode { VMAN_READ_ACCESS = 1, VMAN_WRITE_ACCESS = 2 }
 

Functions

VMAN_API int vmanGetError ()
 
VMAN_API void vmanPanicExit ()
 
VMAN_API void vmanInitVolumeParameters (vmanVolumeParameters *parameters)
 
VMAN_API vmanVolume vmanCreateVolume (const vmanVolumeParameters *parameters)
 
VMAN_API void vmanDeleteVolume (const vmanVolume volume)
 
VMAN_API void vmanSetUnusedChunkTimeout (const vmanVolume volume, int seconds)
 
VMAN_API void vmanSetModifiedChunkTimeout (const vmanVolume volume, int seconds)
 
VMAN_API void vmanResetStatistics (const vmanVolume volume)
 
VMAN_API bool vmanGetStatistics (const vmanVolume volume, vmanStatistics *statisticsDestination)
 
VMAN_API vmanAccess vmanCreateAccess (const vmanVolume volume)
 
VMAN_API void vmanDeleteAccess (const vmanAccess access)
 
VMAN_API void vmanSelect (vmanAccess access, const vmanSelection *selection)
 
VMAN_API void vmanLockAccess (vmanAccess access, int mode)
 
VMAN_API int vmanTryLockAccess (vmanAccess access, int mode)
 
VMAN_API void vmanUnlockAccess (vmanAccess access)
 
VMAN_API const void * vmanReadVoxelLayer (const vmanAccess access, int x, int y, int z, int layer)
 
VMAN_API void * vmanReadWriteVoxelLayer (const vmanAccess access, int x, int y, int z, int layer)
 

Macro Definition Documentation

#define VMAN_API

Definition at line 30 of file vman.h.

Typedef Documentation

typedef void* vmanVolume

Definition at line 174 of file vman.h.

typedef void* vmanAccess

Definition at line 236 of file vman.h.

Enumeration Type Documentation

enum vmanError
Enumerator
VMAN_NO_ERROR 
VMAN_OUT_OF_MEMORY 

Definition at line 41 of file vman.h.

anonymous enum
Enumerator
VMAN_MAX_LAYER_NAME_LENGTH 

Definition at line 56 of file vman.h.

Enumerator
VMAN_LOG_DEBUG 
VMAN_LOG_INFO 
VMAN_LOG_WARNING 
VMAN_LOG_ERROR 

Definition at line 121 of file vman.h.

Enumerator
VMAN_READ_ACCESS 
VMAN_WRITE_ACCESS 

Definition at line 230 of file vman.h.

Function Documentation

VMAN_API int vmanGetError ( )
VMAN_API void vmanPanicExit ( )

Call this function on abnormal or abprupt program termination.

Definition at line 14 of file vman.cpp.

+ Here is the call graph for this function:

VMAN_API void vmanInitVolumeParameters ( vmanVolumeParameters parameters)

Initializes a volume parameter structure.

Definition at line 19 of file vman.cpp.

VMAN_API vmanVolume vmanCreateVolume ( const vmanVolumeParameters parameters)

Creates a new volume object.

Parameters
parametersParameter structure. Should be initialized using vmanInitVolumeParameters before.
Returns
NULL when something went wrong.

Definition at line 24 of file vman.cpp.

VMAN_API void vmanDeleteVolume ( const vmanVolume  volume)

Deletes the given volume object and all its allocated resources.

Definition at line 29 of file vman.cpp.

VMAN_API void vmanSetUnusedChunkTimeout ( const vmanVolume  volume,
int  seconds 
)

Timeout after that unreferenced chunks are unloaded.

Negative values disable this behaviour.

Definition at line 35 of file vman.cpp.

VMAN_API void vmanSetModifiedChunkTimeout ( const vmanVolume  volume,
int  seconds 
)

Timeout after that modified chunks are saved to disk.

Negative values disable this behaviour.

Definition at line 41 of file vman.cpp.

VMAN_API void vmanResetStatistics ( const vmanVolume  volume)

Resets all statistics to zero.

Definition at line 47 of file vman.cpp.

VMAN_API bool vmanGetStatistics ( const vmanVolume  volume,
vmanStatistics statisticsDestination 
)

Writes the current statistics to statisticsDestination.

Parameters
statisticsDestinationStatistics are written to this structure.
Returns
whether the operation succeeded. May return false even if statistics were enabled.

Definition at line 53 of file vman.cpp.

VMAN_API vmanAccess vmanCreateAccess ( const vmanVolume  volume)

Creates an access object, which provides r/w access to the volume.

Will preload chunks as soon as a valid selection is set. Initially the selection will be invalid and all r/w operations will fail.

Returns
NULL when something went wrong.

Definition at line 59 of file vman.cpp.

VMAN_API void vmanDeleteAccess ( const vmanAccess  access)

Deleting a locked access object will cause an error!

Definition at line 65 of file vman.cpp.

VMAN_API void vmanSelect ( vmanAccess  access,
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 71 of file vman.cpp.

VMAN_API void vmanLockAccess ( vmanAccess  access,
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.

Parameters
modeAccess mode bitmask.
See Also
vmanAccessMode

Definition at line 77 of file vman.cpp.

VMAN_API int vmanTryLockAccess ( vmanAccess  access,
int  mode 
)

Behaves like vmanLockAccess, except that it returns 0 if the selection is already locked.

Returns a positive value on success.

See Also
vmanLockAccess

Definition at line 83 of file vman.cpp.

VMAN_API void vmanUnlockAccess ( vmanAccess  access)

Unlocks access.

Definition at line 92 of file vman.cpp.

VMAN_API const void* vmanReadVoxelLayer ( const vmanAccess  access,
int  x,
int  y,
int  z,
int  layer 
)
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 98 of file vman.cpp.

VMAN_API void* vmanReadWriteVoxelLayer ( const vmanAccess  access,
int  x,
int  y,
int  z,
int  layer 
)
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 104 of file vman.cpp.