47 #ifndef vtkStateStorage_h 48 #define vtkStateStorage_h 50 #include "vtkRenderingOpenGL2Module.h" 55 #ifndef NDEBUG // a debug implementation 64 this->Storage.clear();
65 this->StorageOffsets.clear();
66 this->StorageNames.clear();
71 void Append(
const T &
value,
const char *
name);
75 this->WhatWasDifferent =
"";
76 if (this->Storage.size() != b.
Storage.size())
78 this->WhatWasDifferent =
"Different state sizes";
81 for (
size_t i = 0; i < this->Storage.size(); ++i)
83 if (this->Storage[i] != b.
Storage[i])
86 while (this->StorageOffsets.size() > block + 1 && this->StorageOffsets[block+1] >= i)
90 this->WhatWasDifferent = this->StorageNames[block] +
" was different";
117 this->StorageOffsets.push_back(this->Storage.size());
118 this->StorageNames.push_back(name);
119 const char *start =
reinterpret_cast<const char *
>(&
value);
120 this->Storage.insert(this->Storage.end(), start, start +
sizeof(T));
123 #else // release implementation 125 class VTKRENDERINGOPENGL2_EXPORT vtkStateStorage
131 void Clear() { this->Storage.clear(); }
135 void Append(
const T &
value,
const char *
name);
138 return this->Storage != b.
Storage;
141 vtkStateStorage& operator=(
const vtkStateStorage&b) {
147 std::vector<unsigned char> Storage;
150 vtkStateStorage(
const vtkStateStorage&) =
delete;
156 const char *start =
reinterpret_cast<const char *
>(&
value);
157 this->Storage.insert(this->Storage.end(), start, start +
sizeof(T));
160 #endif // Release implementation 162 #endif // vtkStateStorage_h std::string WhatWasDifferent
std::vector< std::string > StorageNames
vtkStateStorage & operator=(const vtkStateStorage &b)
std::vector< size_t > StorageOffsets
std::vector< unsigned char > Storage
void Append(const T &value, const char *name)
VTKCOMMONCORE_EXPORT bool operator!=(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
Class to make storing and comparing state quick and easy.