Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
TypedCounter Class Reference

#include "lib/typed-counter.hpp"

Description

Utility providing a set of counters, each tied to a specific type.

The actual allocation of id numbers is delegated to TypedContext. Such a counter is used to build symbolic instance IDs with a per-type running counter. Such IDs are used for lib::idi::EntryID and for lib::diff::GenNode.

Warning
the index space for typeIDs is application global; the more distinct types are used, the more slots will be present in each instance of TypedCounter. As of 2023 we are using < 30 distinct types for these use cases, and thus the wasted memory is not much of a concern.

Definition at line 139 of file typed-counter.hpp.

Public Member Functions

template<class X >
int64_t get () const
 
template<class X >
int64_t inc ()
 
template<class X >
int64_t dec ()
 
size_t size () const
 
bool empty () const
 

Private Member Functions

template<typename TY >
IxID slot () const
 

Private Attributes

deque< std::atomic_int64_t > counters_
 

Additional Inherited Members

- Static Public Member Functions inherited from Sync< CONF >
static MonitorgetMonitor (Sync const *forThis)
 

Member Function Documentation

◆ slot()

template<typename TY >
IxID slot ( ) const
inlineprivate

Definition at line 146 of file typed-counter.hpp.

References TypedCounter::counters_, and TypedCounter::size().

+ Here is the call graph for this function:

◆ get()

template<class X >
int64_t get ( ) const
inline

Definition at line 164 of file typed-counter.hpp.

References TypedCounter::counters_.

Referenced by WrappedStandardExeBuilder::invokeOriginalBuilder(), TypedAllocationManager::numSlots(), and TypedCounter_test::simpleUsageTest().

+ Here is the caller graph for this function:

◆ inc()

template<class X >
int64_t inc ( )
inline

Definition at line 171 of file typed-counter.hpp.

References TypedCounter::counters_.

Referenced by TypedAllocationManager::allocateSlot(), and TypedCounter_test::simpleUsageTest().

+ Here is the caller graph for this function:

◆ dec()

template<class X >
int64_t dec ( )
inline

Definition at line 178 of file typed-counter.hpp.

References TypedCounter::counters_.

Referenced by TypedAllocationManager::releaseSlot(), and TypedCounter_test::simpleUsageTest().

+ Here is the caller graph for this function:

◆ size()

size_t size ( ) const
inline

Definition at line 186 of file typed-counter.hpp.

References TypedCounter::counters_.

Referenced by TypedCounter_test::simpleUsageTest(), and TypedCounter::slot().

+ Here is the caller graph for this function:

◆ empty()

bool empty ( ) const
inline

Definition at line 187 of file typed-counter.hpp.

References TypedCounter::counters_.

Member Data Documentation

◆ counters_

deque<std::atomic_int64_t> counters_
mutableprivate
+ Inheritance diagram for TypedCounter:
+ Collaboration diagram for TypedCounter:

The documentation for this class was generated from the following file: