47#ifndef vtkStateStorage_h
48#define vtkStateStorage_h
56#ifdef USE_STATE_DEBUGGING
67 this->StorageOffsets.clear();
68 this->StorageNames.clear();
73 void Append(
const T& value,
const char* name);
78 this->WhatWasDifferent =
"";
81 this->WhatWasDifferent =
"Different state sizes";
84 for (
size_t i = 0; i < this->
Storage.size(); ++i)
89 while (this->StorageOffsets.size() > block + 1 && this->StorageOffsets[block + 1] >= i)
93 this->WhatWasDifferent = this->StorageNames[block] +
" was different";
103 this->StorageNames = b.StorageNames;
104 this->StorageOffsets = b.StorageOffsets;
109 std::vector<unsigned char>
Storage;
110 std::vector<std::string> StorageNames;
111 std::vector<size_t> StorageOffsets;
112 mutable std::string WhatWasDifferent;
121 this->StorageOffsets.push_back(this->
Storage.size());
122 this->StorageNames.push_back(name);
123 const char* start =
reinterpret_cast<const char*
>(&
value);
124 this->
Storage.insert(this->
Storage.end(), start, start +
sizeof(T));
139 void Append(
const T& value,
const char* name);
155 const char* start =
reinterpret_cast<const char*
>(&value);
156 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)
vtkStateStorage()=default
bool operator!=(const vtkStateStorage &b) const
vtkStateStorage & operator=(const vtkStateStorage &b)=default