47 #ifndef vtkStateStorage_h
48 #define vtkStateStorage_h
50 #include "vtkRenderingOpenGL2Module.h"
58 #ifdef USE_STATE_DEBUGGING
68 this->Storage.clear();
69 this->StorageOffsets.clear();
70 this->StorageNames.clear();
75 void Append(
const T&
value,
const char*
name);
80 this->WhatWasDifferent =
"";
81 if (this->Storage.size() != b.
Storage.size())
83 this->WhatWasDifferent =
"Different state sizes";
86 for (
size_t i = 0; i < this->Storage.size(); ++i)
88 if (this->Storage[i] != b.
Storage[i])
91 while (this->StorageOffsets.size() > block + 1 && this->StorageOffsets[block + 1] >= i)
95 this->WhatWasDifferent = this->StorageNames[block] +
" was different";
105 this->StorageNames = b.StorageNames;
106 this->StorageOffsets = b.StorageOffsets;
111 std::vector<unsigned char> Storage;
112 std::vector<std::string> StorageNames;
113 std::vector<size_t> StorageOffsets;
123 this->StorageOffsets.push_back(this->
Storage.size());
124 this->StorageNames.push_back(
name);
125 const char* start =
reinterpret_cast<const char*
>(&
value);
126 this->
Storage.insert(this->
Storage.end(), start, start +
sizeof(T));
137 void Clear() { this->Storage.clear(); }
141 void Append(
const T&
value,
const char*
name);
161 const char* start =
reinterpret_cast<const char*
>(&
value);
162 this->
Storage.insert(this->
Storage.end(), start, start +
sizeof(T));
Class to make storing and comparing state quick and easy.
std::vector< unsigned char > Storage
void Append(const T &value, const char *name)
bool operator!=(const vtkStateStorage &b) const
vtkStateStorage & operator=(const vtkStateStorage &b)
VTKCOMMONCORE_EXPORT bool operator!=(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)