36#ifndef vtkStateStorage_h
37#define vtkStateStorage_h
39#include "vtkABINamespace.h"
47#ifdef USE_STATE_DEBUGGING
49VTK_ABI_NAMESPACE_BEGIN
59 this->StorageOffsets.clear();
60 this->StorageNames.clear();
65 void Append(
const T& value,
const char* name);
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;
104 mutable std::string WhatWasDifferent;
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));
122VTK_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));
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