9#ifndef SQUID_BASE_INSTANCE_ID_H
10#define SQUID_BASE_INSTANCE_ID_H
45template <
class Class,
class ValueType = InstanceIdDefaultValueType>
59 std::ostream &
print(std::ostream &)
const;
77#define InstanceIdDefinitions3(Class, pfx, ValueType, ...) \
78 template<> const char * \
79 InstanceId<Class, ValueType>::prefix() const { \
82 template<> std::ostream & \
83 InstanceId<Class, ValueType>::print(std::ostream &os) const { \
84 return os << pfx << value; \
87 InstanceId<Class, ValueType>::change() { \
88 static auto Last = Value(); \
89 value = ++Last ? Last : ++Last; \
93#define InstanceIdDefinitions(...) InstanceIdDefinitions3(__VA_ARGS__, InstanceIdDefaultValueType)
96template <
class Class,
class ValueType>
std::ostream & operator<<(std::ostream &os, const ScopedId &id)
unsigned int InstanceIdDefaultValueType
const char * prefix() const
bool operator==(const InstanceId &o) const
InstanceId & operator=(const InstanceId &)
not implemented
ValueType Value
id storage type
bool operator!=(const InstanceId &o) const
InstanceId(const InstanceId &)
not implemented; IDs are unique
std::ostream & print(std::ostream &) const
writes a compact text representation of the ID
Value value
instance identifier
ScopedId(const char *s, uint64_t v)