59 #ifndef LIB_TYPED_COUNTER_H 60 #define LIB_TYPED_COUNTER_H 71 std::string showSize (
size_t) noexcept;
101 newTypeID (IxID& typeID)
105 typeID = ++lastGeneratedTypeID;
110 template<
typename TY>
122 return newTypeID(typeID);
133 template<
typename TY>
151 mutable deque<std::atomic_int64_t> counters_;
153 template<
typename TY>
162 counters_.resize (typeID);
165 ENSURE (counters_.size() >= typeID);
175 return counters_[slot<X>()].load(std::memory_order_relaxed);
182 return 1 + counters_[slot<X>()].fetch_add(+1, std::memory_order_relaxed);
189 return -1 + counters_[slot<X>()].fetch_add(-1, std::memory_order_relaxed);
195 size_t size()
const {
return counters_.size(); }
196 bool empty()
const {
return counters_.empty();}
211 template<
typename TY>
223 return memberCounter.fetch_add(+1, std::memory_order_relaxed);
228 : id_{allocateNextMember()}
231 operator size_t()
const 236 operator string()
const 238 return util::showSize (this->id_);
244 return prefix+string(
id);
250 return string(prefix)+id;
255 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.