This ALib Module implements the concept of "monotonic allocation" by providing central class MonoAllocator and a few corresponding container and utility types.
Please consult ALib Module Memory - Programmer's Manual for further information.
Nested namespaces | |
detail | |
util | |
Classes | |
class | HashTable |
class | List |
class | MonoAllocator |
struct | Recycling |
class | SelfContained |
struct | StdContMA |
struct | StdContMAOptional |
struct | StdContMARecycling |
class | StringTree |
struct | StringTreeNamesDynamic |
struct | StringTreeNamesMonoAlloc |
struct | StringTreeNamesStatic |
class | TMAString |
Typedefs | |
template<typename TKey , typename TMapped , typename THash = std::hash <TKey>, typename TEqual = std::equal_to<TKey>, Caching THashCaching = Caching::Auto, typename TRecycling = Recycling::Private> | |
using | HashMap = lib::monomem::HashTable< std::pair< const TKey, TMapped >, std::pair< TKey, TMapped >, TKey, TMapped, THash, TEqual, lib::monomem::detail::HashMapAccess< TKey, TMapped >, THashCaching, TRecycling > |
template<typename T , typename THash = std::hash <T>, typename TEqual = std::equal_to<T>, Caching THashCaching = Caching::Auto, typename TRecycling = Recycling::Private> | |
using | HashSet = lib::monomem::HashTable< T, T, T, void, THash, TEqual, lib::monomem::detail::HashSetAccess< T >, THashCaching, TRecycling > |
Variables | |
MonoAllocator | GlobalAllocator (8 *1024) |
ALIB_API ThreadLock | GlobalAllocatorLock |
Functions | |
MonoAllocator & | AcquireGlobalAllocator (const NCString &dbgFile, int dbgLine, const NCString &dbgFunc) |
template<typename THashtable > | |
AString | DbgDumpDistribution (const THashtable &hashtable, bool detailedBucketList) |
template<typename THashtable > | |
AString | DbgDumpHashtable (const THashtable &hashtable) |
template<typename THashtable > | |
std::tuple< double, double, integer, integer > | DbgGetHashTableDistribution (const THashtable &hashtable) |
template<typename T > | |
static ALIB_FORCE_INLINE void | Destruct (T *object) |
void | ReleaseGlobalAllocator () |
using HashMap = lib::monomem::HashTable<std::pair<const TKey, TMapped>, std::pair< TKey, TMapped>, TKey, TMapped, THash, TEqual, lib::monomem::detail::HashMapAccess<TKey, TMapped>, THashCaching, TRecycling > |
This type definition is a shortcut to HashTable, usable if the data stored in the container consists of two parts, a key and a mapped part, where only the key-part is to be used for the comparison of values.
TKey | The type of the key-portion of the inserted data. This type is published as HashTable::KeyType. |
TMapped | The type of the mapped-portion of the inserted data. This type is published as HashTable::MappedType. |
THash | The hash functor applicable to TKey. Defaults to std::hash<TKey> and is published as HashTable::HashType. |
TEqual | The comparison functor on TKey. Defaults to std::equal_to<TKey> and is published as HashTable::EqualType. |
THashCaching | Determines if hash codes are cached when elements are inserted. Defaults to Caching::Auto, which enables caching if std::is_arithmetic<TKey>::value evaluates to false . |
TRecycling | Denotes the type of recycling that is to be performed. Possible values are Recycling::Private (the default), Recycling::Shared or Recycling::None. |
Definition at line 95 of file hashmap.hpp.
using HashSet = lib::monomem::HashTable< T, T, T, void, THash, TEqual, lib::monomem::detail::HashSetAccess<T>, THashCaching, TRecycling > |
This type definition is a shortcut to HashTable, usable if the full portion of the data stored in the container is used for the comparison of values.
T | The element type stored with this container. This type is published as HashTable::ValueType and type definition HashTable::KeyType becomes a synonym. |
THash | The hash functor applicable to TKey. Defaults to std::hash<TKey> and is published as HashTable::HashType. |
TEqual | The comparison functor on TKey. Defaults to std::equal_to<TKey> and is published as HashTable::EqualType. |
THashCaching | Determines if hash codes are cached when elements are inserted. Defaults to Caching::Auto, which enables caching if std::is_arithmetic<T>::value evaluates to false . |
TRecycling | Denotes the type of recycling that is to be performed. Possible values are Recycling::Private (the default), Recycling::Shared or Recycling::None. |
Definition at line 82 of file hashset.hpp.
|
inline |
Simple inline function that acquires GlobalAllocatorLock and returns the object singleton GlobalAllocator.
dbgFile | Caller information. Available only with debug builds and if ALib Threads is included in the ALib Distribution. |
dbgLine | Caller information. Available only with debug builds and if ALib Threads is included in the ALib Distribution. |
dbgFunc | Caller information. Available only with debug builds and if ALib Threads is included in the ALib Distribution. |
|
inline |
Invokes method DbgGetHashTableDistribution and creates human readable output, ready to be logged or written to the console.
Available only if compiler symbol ALIB_DEBUG_MONOMEM is set and module ALib Text is included in the alibdist.
THashtable | A specification of templated type HashTable. Deduced by the compiler by given parameter hashtable. |
hashtable | The hashtable to investigate on. |
detailedBucketList | If true is given, for each bucket a line with its size value and a "size bar" is written. |
Definition at line 2460 of file hashtable.hpp.
|
inline |
Dumps all values of the hash table sorted by buckets. Besides other scenarios of usage, this method allows to investigate into how the keys of the table are distributed in the buckets, and thus learn something about the hash algorithm used.
Prior to invoking this method, specializations of T_Append have to be made and furthermore, boxed values of the type have to be "made appendable" to instances of type AString. The latter is rather simple, if done using this macro during bootstrap.
Available only if compiler symbol ALIB_DEBUG_MONOMEM is set and module ALib Text is included in the alibdist.
THashtable | A specification of templated type HashTable. Deduced by the compiler by given parameter hashtable. |
hashtable | The hashtable to investigate on. |
Definition at line 2548 of file hashtable.hpp.
|
inline |
Generates statistics on the given hash table. The meanings of the returned tuple are: 0. The expected average size of a bucket (simply table size divided by number of buckets).
1.0
denotes the gaussian distribution which indicates perfect randomness. However, this value is unlikely (impossible) to be achieved.Available only if compiler symbol ALIB_DEBUG_MONOMEM is set.
THashtable | A specification of templated type HashTable. Deduced by the compiler by given parameter hashtable. |
hashtable | The hashtable to investigate on. |
Definition at line 2403 of file hashtable.hpp.
|
static |
This static inline namespace function calls the destructor ~T()of given object. The use of this method is recommended instead of calling the destructor directly, to increase readability of the code.
T | The object type. Deduced by the compiler and not needed to be given. |
object | The object to destruct. |
Definition at line 659 of file monoallocator.hpp.
|
inline |
Simple inline function that releases GlobalAllocatorLock, previously acquired with AcquireGlobalAllocator.
ALIB_API MonoAllocator GlobalAllocator |
This is the global monotonic allocator singleton instance.
Definition at line 710 of file monoallocator.hpp.
ALIB_API ThreadLock GlobalAllocatorLock |
This mutex is used by methods AcquireGlobalAllocator and ReleaseGlobalAllocator to control access over the global allocator instance GlobalAllocator.
This object may be controlled directly as an alternative to using the functions named above, for example in combination with macro ALIB_LOCK_WITH, with attaches the locking/unlocking mechanisms "automatically" to the current call stack.