VolumeHandle Class Reference

Class for handling different types and needs for volumes. More...

#include <volumehandle.h>

Inheritance diagram for VolumeHandle:
Serializable Observable< VolumeHandleObserver > ObservableBase

List of all members.

Public Types

enum  HardwareVolumes { HARDWARE_VOLUME_NONE = 0, HARDWARE_VOLUME_GL = 1, HARDWARE_VOLUME_CUDA = 2, HARDWARE_VOLUME_ALL = 0xFFFF }
 

All types of available hardware specializations.

More...

Public Member Functions

 VolumeHandle ()
 Default constructor.
 VolumeHandle (Volume *const volume, const float time=0.f)
 Constructor.
virtual ~VolumeHandle ()
 Delete all Volume pointers and the hardware specific ones, if they have been generated.
void releaseVolumes ()
 Gives up ownership of associated volumes without deleting them.
VolumegetVolume () const
 Returns the generic Volume.
void setVolume (Volume *const volume)
 (Re)Sets the volume for this handle and deletes the previous one.
void setModality (Modality modality)
Modality getModality () const
float getTimestep () const
 Returns the associated timestep of this volume handle.
void setTimestep (float timestep)
 Sets the timestep for this VolumeHandle.
void setOrigin (const VolumeOrigin &origin)
const VolumeOrigingetOrigin () const
bool reloadVolume ()
 Reloads the volume from its origin, usually from the hard disk, and regenerates the dependent hardware volumes.
int getHardwareVolumeMask () const
 Returns the mask indicating what hardware volume are currently used by this handle.
bool hasHardwareVolumes (int volumeMask) const
 Returns whether the specified types of hardware volumes exists.
void generateHardwareVolumes (int volumeMask)
 Generate hardware volumes.
void freeHardwareVolumes (int volumeMask=HARDWARE_VOLUME_ALL)
 Remove hardware volumes and free memory.
LargeVolumeManagergetLargeVolumeManager ()
void setLargeVolumeManager (LargeVolumeManager *largeVolumeManager)
virtual void serialize (XmlSerializer &s) const
virtual void deserialize (XmlDeserializer &s)
VolumeGLgetVolumeGL ()
 Returns an OpenGL hardware volume for this volume, generating a new one via generateHardwareVolumes() if it does not already exist.

Protected Member Functions

void notifyDelete ()
 Notifies the registered VolumeHandleObservers about the pending deletion of the VolumeHandle.
void notifyReload ()
 Notifies the registered VolumeHandleObservers that a reload of the volume was done.

Protected Attributes

VolumeOrigin origin_
Volumevolume_
float time_
Modality modality_
int hardwareVolumeMask_
LargeVolumeManagerlargeVolumeManager_
VolumeGLvolumeGL_
 In case this handle holds a bricked volume, this is the Manager responsible for updating bricks etc.

Static Protected Attributes

static const std::string loggerCat_

Friends

class KeyValueFactory

Detailed Description

Class for handling different types and needs for volumes.

Besides the hardware volume this class holds information about the volume's origin, modality and timestep. It is designed for being the only class which has to take care of what kind of hardware volumes are used.

Definition at line 159 of file volumehandle.h.


Member Enumeration Documentation

All types of available hardware specializations.

This enum is used to create a mask by OR-ing the values.

Definition at line 167 of file volumehandle.h.


Constructor & Destructor Documentation

VolumeHandle ( Volume *const   volume,
const float  time = 0.f 
)

Constructor.

Note:
No hardware specific volume data like VolumeGL are created initially. If you want to use hardware specific volume data / textures, call generateHardwareVolumes() or directly use getVolumeGL() which implicitly generates a hardware volume.
Parameters:
volume The volume data for this VolumeHandle.
time The timestep for this VolumeHandle.

Definition at line 278 of file volumehandle.cpp.


Member Function Documentation

void deserialize ( XmlDeserializer s  )  [virtual]
See also:
Serializable::deserialize

Implements Serializable.

Definition at line 498 of file volumehandle.cpp.

void freeHardwareVolumes ( int  volumeMask = HARDWARE_VOLUME_ALL  ) 

Remove hardware volumes and free memory.

Parameters:
volumeMask OR-junction of HardwareVolumes enum determining which hardware volumes to delete.

Definition at line 441 of file volumehandle.cpp.

void generateHardwareVolumes ( int  volumeMask  ) 

Generate hardware volumes.

If the hardware volume already exists, it is rebuild.

Parameters:
volumeMask OR-junction of HardwareVolumes enum determining what kind of hardware volumes to create.

Definition at line 407 of file volumehandle.cpp.

int getHardwareVolumeMask (  )  const

Returns the mask indicating what hardware volume are currently used by this handle.

The used types can be extracted by AND-ing the mask with the desired bit(s) like usual.

Definition at line 399 of file volumehandle.cpp.

VolumeGL * getVolumeGL (  ) 

Returns an OpenGL hardware volume for this volume, generating a new one via generateHardwareVolumes() if it does not already exist.

You can use hasHardwareVolumes() to check if such a hardware volume already exists.

Definition at line 464 of file volumehandle.cpp.

void releaseVolumes (  ) 

Gives up ownership of associated volumes without deleting them.

Calls this in order to prevent deletion of the volumes on destruction of the handle.

Definition at line 317 of file volumehandle.cpp.

bool reloadVolume (  ) 

Reloads the volume from its origin, usually from the hard disk, and regenerates the dependent hardware volumes.

Note:
The Volume object as well as the dependent hardware volume objects are replaced during this operation.

After a successful reload, volumeChanged() is called on the registered observers. In case the reloading failed, the VolumeHandle's state remains unchanged.

Returns:
true, if the volume could be successfully reloaded.

Definition at line 358 of file volumehandle.cpp.

void serialize ( XmlSerializer s  )  const [virtual]
See also:
Serializable::serialize

Implements Serializable.

Definition at line 492 of file volumehandle.cpp.

void setVolume ( Volume *const   volume  ) 

(Re)Sets the volume for this handle and deletes the previous one.

Usually there should be no need for using this method as the volume is initialized within the ctor, but some VolumeReaders need to modify the read data.

Definition at line 338 of file volumehandle.cpp.


Member Data Documentation

VolumeGL* volumeGL_ [protected]

In case this handle holds a bricked volume, this is the Manager responsible for updating bricks etc.

0 if no bricked volume is present.

Definition at line 334 of file volumehandle.h.