3 #ifndef vtkStringManager_h
4 #define vtkStringManager_h
22 #include <unordered_map>
23 #include <unordered_set>
25 VTK_ABI_NAMESPACE_BEGIN
42 using Hash = std::uint32_t;
45 using Visitor = std::function<Visit(Hash entry)>;
47 static constexpr
Hash Invalid = 0;
53 std::size_t Unmanage(
Hash hh);
91 bool Contains(
Hash ss,
Hash hh)
const;
95 bool Empty()
const {
return this->Data.empty(); }
105 Visit VisitMembers(Visitor visitor, Hash set = Invalid)
const;
115 Visit VisitSets(Visitor visitor)
const;
124 using LockGuard = std::lock_guard<std::mutex>;
126 std::pair<Hash, bool> ComputeInternal(
const std::string& s,
const LockGuard& proofOfLock)
const;
127 std::pair<Hash, bool> ComputeInternalAndInsert(
128 const std::string& s,
const LockGuard& proofOfLock);
129 std::size_t UnmanageInternal(Hash hh,
const LockGuard& proofOfLock);
131 std::unordered_map<Hash, std::string> Data;
132 std::unordered_map<Hash, std::unordered_set<Hash>> Sets;
133 mutable std::mutex WriteLock;
139 VTK_ABI_NAMESPACE_END
140 #endif // vtkStringManager_h
abstract base class for most VTK objects
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool Empty() const
Return true if the manager is empty (i.e., managing no hashes) and false otherwise.
a simple class to control print indentation
std::function< Visit(Hash entry)> Visitor
Signature for functions visiting strings in the manager or in a set held by the manager.
std::uint32_t Hash
The type of integer used to hash strings.
Manage string-token mappings.
Visit
An enumerant visitors return to terminate early (or not).
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
bool Contains(Hash hh) const