VTK  9.3.20240327
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 ()=default
 
void Clear ()
 
template<class T >
void Append (const T &value, const char *name)
 
bool operator!= (const vtkStateStorage &b) const
 
vtkStateStorageoperator= (const vtkStateStorage &b)=default
 

Protected Attributes

std::vector< unsigned char > Storage
 

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 123 of file vtkStateStorage.h.

Constructor & Destructor Documentation

◆ vtkStateStorage()

vtkStateStorage::vtkStateStorage ( )
default

Member Function Documentation

◆ Clear()

void vtkStateStorage::Clear ( )
inline

Definition at line 129 of file vtkStateStorage.h.

◆ Append()

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

Definition at line 147 of file vtkStateStorage.h.

◆ operator!=()

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

Definition at line 135 of file vtkStateStorage.h.

◆ operator=()

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

Member Data Documentation

◆ Storage

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

Definition at line 140 of file vtkStateStorage.h.


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