36 #ifndef vtkStateStorage_h
37 #define vtkStateStorage_h
39 #include "vtkABINamespace.h"
47 #ifdef USE_STATE_DEBUGGING
49 VTK_ABI_NAMESPACE_BEGIN
59 this->StorageOffsets.clear();
60 this->StorageNames.clear();
70 this->WhatWasDifferent =
"";
73 this->WhatWasDifferent =
"Different state sizes";
76 for (
size_t i = 0; i < this->
Storage.size(); ++i)
81 while (this->StorageOffsets.size() > block + 1 && this->StorageOffsets[block + 1] >= i)
85 this->WhatWasDifferent = this->StorageNames[block] +
" was different";
95 this->StorageNames = b.StorageNames;
96 this->StorageOffsets = b.StorageOffsets;
101 std::vector<unsigned char>
Storage;
102 std::vector<std::string> StorageNames;
103 std::vector<size_t> StorageOffsets;
113 this->StorageOffsets.push_back(this->
Storage.size());
114 this->StorageNames.push_back(name);
115 const char* start =
reinterpret_cast<const char*
>(&
value);
116 this->
Storage.insert(this->
Storage.end(), start, start +
sizeof(T));
119 VTK_ABI_NAMESPACE_END
120 #else // normal implementation
122 VTK_ABI_NAMESPACE_BEGIN
133 void Append(
const T& value,
const char* name);
149 const char* start =
reinterpret_cast<const char*
>(&
value);
150 this->
Storage.insert(this->
Storage.end(), start, start +
sizeof(T));
153 VTK_ABI_NAMESPACE_END
154 #endif // normal implementation
156 #endif // vtkStateStorage_h
vtkStateStorage & operator=(const vtkStateStorage &b)=default
bool operator!=(const vtkStateStorage &b) const
std::vector< unsigned char > Storage
vtkStateStorage()=default
void Append(const T &value, const char *name)
Class to make storing and comparing state quick and easy.