50 #ifndef LIB_TYPED_COUNTER_H 51 #define LIB_TYPED_COUNTER_H 62 std::string showSize (
size_t) noexcept;
92 newTypeID (IxID& typeID)
96 typeID = ++lastGeneratedTypeID;
101 template<
typename TY>
113 return newTypeID(typeID);
124 template<
typename TY>
142 mutable deque<std::atomic_int64_t> counters_;
144 template<
typename TY>
153 counters_.resize (typeID);
156 ENSURE (counters_.size() >= typeID);
166 return counters_[slot<X>()].load(std::memory_order_relaxed);
173 return 1 + counters_[slot<X>()].fetch_add(+1, std::memory_order_relaxed);
180 return -1 + counters_[slot<X>()].fetch_add(-1, std::memory_order_relaxed);
186 size_t size()
const {
return counters_.size(); }
187 bool empty()
const {
return counters_.empty();}
202 template<
typename TY>
214 return memberCounter.fetch_add(+1, std::memory_order_relaxed);
219 : id_{allocateNextMember()}
222 operator size_t()
const 227 operator string()
const 229 return util::showSize (this->id_);
235 return prefix+string(
id);
241 return string(prefix)+id;
246 template<
typename TY>
Facility for monitor object based locking.
Utility providing a set of counters, each tied to a specific type.
static IxID lastGeneratedTypeID
storage for the type-ID generation mechanism
Implementation namespace for support and library code.
static size_t allocateNextMember()
threadsafe allocation of member ID
std::string operator+(std::string str, Literal const &sym)
string concatenation
static std::atomic_size_t memberCounter
member counter shared per template instance
A special implementation of lib::Sync, where the storage of the object monitor is associated directly...
Lumiera error handling (C++ interface).
A synchronisation protection guard employing a lock scoped to the parameter type as a whole...
Utility to produce member IDs for objects belonging to a "Family", as defined by a distinguishing typ...
static IxID typeID
table holding all the generated type-IDs
Provide type-IDs for a specific context.