VTK
Public Member Functions | Protected Attributes | List of all members
vtkStateStorage Class Reference

Class to make storing and comparing state quick and easy. More...

#include <vtkStateStorage.h>

Public Member Functions

 vtkStateStorage ()
 
void Clear ()
 
template<class T >
void Append (const T &value, const char *name)
 
bool operator!= (const vtkStateStorage &b) const
 
vtkStateStorageoperator= (const vtkStateStorage &b)
 

Protected Attributes

std::vector< unsigned char > Storage
 
std::vector< std::string > StorageNames
 
std::vector< size_t > StorageOffsets
 
std::string WhatWasDifferent
 

Detailed Description

Class to make storing and comparing state quick and easy.

vtkStateStorage is just a thin wrapper around std::vector<unsigned char> It is best to use this class as an ivar so that allocs do not happen too often.

Example usage:

// compute the new state in a temp ivar
// note that clear does not free memory
this->TempState.Clear();
this->TempState.Append(act->GetProperty()->GetMTime(), "property mtime");
this->TempState.Append(
this->CurrentInput ? this->CurrentInput->GetMTime() : 0, "input mtime");
this->TempState.Append(
act->GetTexture() ? act->GetTexture()->GetMTime() : 0, "texture mtime");
// now compare against the last state value
if (this->VBOBuildState != this->TempState)
{
// set the ivar to the new state
this->VBOBuildState = this->TempState;
do something...
}

Definition at line 57 of file vtkStateStorage.h.

Constructor & Destructor Documentation

vtkStateStorage::vtkStateStorage ( )
inline

Definition at line 60 of file vtkStateStorage.h.

Member Function Documentation

void vtkStateStorage::Clear ( void  )
inline

Definition at line 63 of file vtkStateStorage.h.

template<class T >
void vtkStateStorage::Append ( const T &  value,
const char *  name 
)
inline

Definition at line 115 of file vtkStateStorage.h.

bool vtkStateStorage::operator!= ( const vtkStateStorage b) const
inline

Definition at line 73 of file vtkStateStorage.h.

vtkStateStorage& vtkStateStorage::operator= ( const vtkStateStorage b)
inline

Definition at line 97 of file vtkStateStorage.h.

Member Data Documentation

std::vector<unsigned char> vtkStateStorage::Storage
protected

Definition at line 105 of file vtkStateStorage.h.

std::vector<std::string> vtkStateStorage::StorageNames
protected

Definition at line 106 of file vtkStateStorage.h.

std::vector<size_t> vtkStateStorage::StorageOffsets
protected

Definition at line 107 of file vtkStateStorage.h.

std::string vtkStateStorage::WhatWasDifferent
mutableprotected

Definition at line 108 of file vtkStateStorage.h.


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