ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::boxing::debug::DbgStringTable< TAssociatedTypes > Struct Template Reference

Description:

template<typename... TAssociatedTypes>
struct alib::boxing::debug::DbgStringTable< TAssociatedTypes >

Template class implementing a monotonically allocated vector of variadic tuples whose first element is of type String.

When new tuples are added with the method Add, then memory for copying the provided string is allocated using an internal field of type MonoAllocator. This allows adding single strings, which are allocated in bigger memory buffers.

Standard vector operations, including insertions and deletions are still allowed. In other words, it is allowed to store string objects which are pointing to string data that is not allocated in the internal buffers.

The associated values are especially useful when the vector is sorted (e.g., using std::sort), because such associations will be kept intact and allow referencing back to whatever the strings represents.

Availability
This function is an extension, which is injected by the higher-level module ALib Format and is accessed through the header file ALib.Format.H. Furthermore, the compiler-symbol ALIB_DEBUG_BOXING has to be set.

Definition at line 34 of file boxing_format_debug.inl.

Inheritance diagram for alib::boxing::debug::DbgStringTable< TAssociatedTypes >:
[legend]
Collaboration diagram for alib::boxing::debug::DbgStringTable< TAssociatedTypes >:
[legend]

Public Type Index:

using Base = std::vector<ElementType>
 Shortcut to the base type of this type.
 
using ElementType = std::tuple<String, TAssociatedTypes...>
 Shortcut to the std::tuple-type that instantiations of this template class store.
 

Public Field Index:

MonoAllocatorallocator
 Allocator for making copies of inserted strings.
 

Public Method Index:

 DbgStringTable (MonoAllocator &monoAllocator)
 
template<typename... TArgs>
StringAdd (const String &src, TArgs &&... args)
 

Type Definition Details:

◆ Base

template<typename... TAssociatedTypes>
using alib::boxing::debug::DbgStringTable< TAssociatedTypes >::Base = std::vector<ElementType>

Shortcut to the base type of this type.

Definition at line 40 of file boxing_format_debug.inl.

◆ ElementType

template<typename... TAssociatedTypes>
using alib::boxing::debug::DbgStringTable< TAssociatedTypes >::ElementType = std::tuple<String, TAssociatedTypes...>

Shortcut to the std::tuple-type that instantiations of this template class store.

Definition at line 37 of file boxing_format_debug.inl.

Field Details:

◆ allocator

template<typename... TAssociatedTypes>
MonoAllocator& alib::boxing::debug::DbgStringTable< TAssociatedTypes >::allocator

Allocator for making copies of inserted strings.

Definition at line 43 of file boxing_format_debug.inl.

Constructor(s) / Destructor Details:

◆ DbgStringTable()

template<typename... TAssociatedTypes>
alib::boxing::debug::DbgStringTable< TAssociatedTypes >::DbgStringTable ( MonoAllocator & monoAllocator)
inline

Constructor.

Parameters
monoAllocatorA mono allocator used to create copies of the inserted strings

Definition at line 47 of file boxing_format_debug.inl.

Method Details:

◆ Add()

template<typename... TAssociatedTypes>
template<typename... TArgs>
String & alib::boxing::debug::DbgStringTable< TAssociatedTypes >::Add ( const String & src,
TArgs &&... args )
inline

Adds a tuple. The contents of the string of the tuple (its first element) is copied from the given string src. The memory for this string is allocated using the allocator provided in the constructor.
The other members of the tuple added are forwarded from variadic parameter block args.

Parameters
srcThe string to copy into the first member of the tuple.
argsVariadic arguments to fill the rest of the inserted tuple.
Returns
A reference to the string that was added.

Definition at line 61 of file boxing_format_debug.inl.


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