ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::boxing::detail::VTable Struct Reference

Description:

The custom function hash.

DOXYGEN This struct is used internally with ALib Boxing to provide run-time type information and virtual method invocations to boxed values. A singleton instance of this struct is attached to each Box.

Definition at line 226 of file vtable.inl.

Inheritance diagram for alib::boxing::detail::VTable:
[legend]
Collaboration diagram for alib::boxing::detail::VTable:
[legend]

Public Type Index:

enum class  DbgFactoryType { Unregistered , Static , Dynamic }
 
enum  MappingType : integer { Value = 0 , Pointer = -1 , Enum = -2 }
 

Public Field Index:

uinteger DbgCntUsage = 0
 
DbgFactoryType DbgProduction = DbgFactoryType::Unregistered
 Debug information.
 
const std::type_info & ElementType
 
FunctionTable Functions
 Box-functions attached with BootstrapRegister.
 
const MappingType Mapping
 
const unsigned int PlaceholderUsage
 
const std::type_info & Type
 

Public Method Index:

 VTable (const std::type_info &type, const std::type_info &elementType, MappingType mapping, unsigned int placeholderUsage)
 
virtual ~VTable ()
 
bool IsArray () const
 
bool IsEnum () const
 
bool IsPointer () const
 

Enumeration Details:

◆ DbgFactoryType

These flags are available in debug-compilations only. Denotes whether this vtable is statically or dynamically created. In the case of Unregistered, a customized vtable was not properly registered on bootstrap.

Enumerator
Unregistered 

Not registered, yet.

Static 

A static VTable is in place.

Dynamic 

The VTable is created dynamically from the templated type VTableUnoptimized.

Definition at line 265 of file vtable.inl.

◆ MappingType

Denotes if the mapped type is a value type, a pointer type, an enum or an array. The latter is not specified by an enum element, but rather is true for all enum elements that have a value greater than 0. The value in this case provides the size of the array's element type.

Enumerator
Value 

Value boxing.

Pointer 

Pointer boxing.

Enum 

Enum type boxing.

Definition at line 232 of file vtable.inl.

Field Details:

◆ DbgCntUsage

uinteger alib::boxing::detail::VTable::DbgCntUsage = 0

Counter for the number of unbox operations and function invocations made on boxes that used this vtable. Precisely, the counter is increased with invocations of Box::Unbox, Box::UnboxArray, Box::UnboxElement, Box::TypeID and Box::GetFunction.

Available only with debug-builds.

Definition at line 286 of file vtable.inl.

◆ DbgProduction

DbgFactoryType alib::boxing::detail::VTable::DbgProduction = DbgFactoryType::Unregistered

Debug information.

Definition at line 274 of file vtable.inl.

◆ ElementType

const std::type_info& alib::boxing::detail::VTable::ElementType

In case of array types, information about the element type. Otherwise this field is equal to typeid(void).

Definition at line 245 of file vtable.inl.

◆ Functions

FunctionTable alib::boxing::detail::VTable::Functions

Box-functions attached with BootstrapRegister.

Definition at line 259 of file vtable.inl.

◆ Mapping

const MappingType alib::boxing::detail::VTable::Mapping

Denotes if the mapped type is a value type, a pointer type, an enum or an array. In the case of array types, the enum element value provides the size of the array's element type (a value greater than 0).

Definition at line 250 of file vtable.inl.

◆ PlaceholderUsage

const unsigned int alib::boxing::detail::VTable::PlaceholderUsage

The number of relevant bytes used in the placeholder.

See also
The documentation of SizeTraits provides details on and rationals for the existence of this property.

Definition at line 256 of file vtable.inl.

◆ Type

const std::type_info& alib::boxing::detail::VTable::Type

Information about the encapsulated type. In the case of arrays, this field is equal to typeid(void).

Definition at line 241 of file vtable.inl.

Constructor(s) / Destructor Details:

◆ VTable()

alib::boxing::detail::VTable::VTable ( const std::type_info & type,
const std::type_info & elementType,
MappingType mapping,
unsigned int placeholderUsage )
inline

Constructor.

Parameters
typeType information of the derived VTable type.
elementTypeType information of the elements of the boxed array.
mappingThe type of boxing: value, pointer, enum or arrays.
placeholderUsageThe size of elements of the boxed array.

Definition at line 295 of file vtable.inl.

◆ ~VTable()

virtual alib::boxing::detail::VTable::~VTable ( )
inlinevirtual

Virtual destructor.
Note: This is not really needed and empty. Because derived class VTable derives from virtual type Singleton, having this destructor allows cleaning memory on termination "more precisely" and reduce warnings raised by analytics tools like valgrind.

Definition at line 311 of file vtable.inl.

Method Details:

◆ IsArray()

bool alib::boxing::detail::VTable::IsArray ( ) const
inline

Returns true if this vtable represents boxed array types. In this case, method Box::UnboxLength will return the length of the array and Box::UnboxElement may be used to access elements of the array.

Returns
true if this vtable is representing an array type, false otherwise.

Definition at line 321 of file vtable.inl.

◆ IsEnum()

bool alib::boxing::detail::VTable::IsEnum ( ) const
inline

Returns true if this vtable represents a scoped or non-scoped enum type.

Returns
true if this vtable is representing an enum type, false otherwise.

Definition at line 337 of file vtable.inl.

◆ IsPointer()

bool alib::boxing::detail::VTable::IsPointer ( ) const
inline

Returns true if this vtable represents mapped pointer type.

Returns
true if this vtable is representing a pointer type, false otherwise.

Definition at line 329 of file vtable.inl.


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