Visual Computing Library
|
The Types module defines all the utility definitions, types, classes and type traits that are common in the library. More...
Classes | |
class | vcl::FakePointerWithValue< T > |
A simple utility class to represent a pointer with a value. More... | |
struct | vcl::MakeConstPointer< T > |
Utility type that makes possible to treat const pointers in a templated class that can treat a both const and non-const pointer type. More... | |
struct | vcl::MakeConstPointer< T * > |
Utility type that makes possible to treat const pointers in a templated class that can treat a both const and non-const pointer type. More... | |
struct | vcl::FilterTypesByCondition< typename,... > |
Removes all types that do not satisfy a condition, and get them as a tuple. More... | |
struct | vcl::FilterTypesByCondition< Pred, Head, Tail... > |
Removes all types that do not satisfy a condition, and get them as a tuple. More... | |
struct | vcl::FilterTypesByCondition< Pred, TypeWrapper< Tail... > > |
Removes all types that do not satisfy a condition, and get them as a tuple. More... | |
struct | vcl::TypesSatisfyCondition< Pred, Args > |
Its value is set to true if there is at least one type in the given pack Args... that satisfies the given condition. More... | |
struct | vcl::TypesSatisfyCondition< Pred, TypeWrapper< Args... > > |
Its value is set to true if there is at least one type in the given pack Args... that satisfies the given condition. More... | |
struct | vcl::GetTypeByCondition< Pred, Args > |
The the first type of a pack that satisfies the given condition. More... | |
struct | vcl::GetTypeByCondition< Pred, TypeWrapper< Args... > > |
The the first type of a pack that satisfies the given condition. More... | |
struct | vcl::CompId |
The CompId struct enumerates the components that can compose a element or a mesh. More... | |
struct | vcl::ComponentString< COMP_ID > |
The ComponentString class is used to retrieve the string associated to a COMP_ID value, trough its member 'str'. More... | |
struct | vcl::ElemId |
The ElemId struct enumerates the elements that can compose a mesh. More... | |
struct | vcl::ElementString< ELEM_ID > |
The ElementString class is used to retrieve the string associated to a ELEM_ID value, trough its member 'str'. More... | |
struct | vcl::TypeWrapper< Args > |
A simple structure that wraps a list of variadic templates, without instantiating anything. Useful when you need to wrap a list of types, and consider them as a single type. More... | |
struct | vcl::FirstType< TypeWrapper< Args... > > |
Get the first type of a pack of types (variadic templates) or a TypeWrapper. More... | |
struct | vcl::FirstType< Args > |
Get the first type of a pack of types (variadic templates) or a TypeWrapper. More... | |
struct | vcl::ForEachType< T > |
Allows to apply a function to each type in a variadic template pack. More... | |
class | vcl::View< It > |
The View class is a simple class that stores and exposes two iterators begin and end. More... | |
Typedefs | |
template<typename T > | |
using | vcl::MakeConstPointerT = typename MakeConstPointer< T >::type |
Utility alias for the MakeConstPointer type. | |
template<typename derived , template< typename... > class base> | |
using | vcl::IsDerivedFromTemplateSpecialization = std::invoke_result< detail::IsDerivedFromImplementation< base >, typename std::remove_cv< derived >::type * >::type |
Utility class that allows to check if given class 'Derived' is derived from a specialization of a templated class. | |
template<typename T > | |
using | vcl::RemovePtr = std::remove_pointer_t< T > |
Utility alias to get a type without the pointer. e.g. If T is int*, the resulting type is int. | |
template<typename T > | |
using | vcl::RemoveRef = std::remove_reference_t< T > |
Utility alias to get a type type without the reference. e.g. If T is int&, the resulting type is int. | |
template<typename T > | |
using | vcl::RemoveCVRefAndPointer = std::remove_cvref_t< RemovePtr< T > > |
Utility alias to get clean type from an input type that could have a reference or a pointer. | |
template<typename T > | |
using | vcl::RemoveConstFromPointer = std::conditional_t< std::is_pointer_v< T >, std::add_pointer_t< std::remove_cv_t< RemovePtr< T > > >, T > |
Utility alias to get a pointer type without the constness. e.g. If T is const int*, the resulting type is int* If the type is not a pointer, it is left as it was. | |
template<typename... Args> | |
using | vcl::FirstTypeT = typename FirstType< Args... >::type |
Alias for the type of the first type in a pack of types. | |
Enumerations | |
enum class | vcl::PrimitiveType { CHAR , UCHAR , SHORT , USHORT , INT , UINT , FLOAT , DOUBLE , NONE } |
A simple type that enumerates the main primitive types. More... | |
enum class | vcl::MatrixStorageType { ROW_MAJOR , COLUMN_MAJOR } |
A simple type that enumerates the main storage types for matrices (row or column major). | |
Functions | |
template<typename T > | |
constexpr T & | vcl::asConst (const T &value) noexcept |
Utility function that converts a const pointer/reference to a non-const pointer/reference. | |
template<typename T > | |
constexpr T * | vcl::asConst (const T *value) noexcept |
Utility function that converts a const pointer/reference to a non-const pointer/reference. | |
template<typename T > | |
constexpr T * | vcl::asConst (T *value) noexcept |
Utility function that converts a const pointer/reference to a non-const pointer/reference. | |
template<uint COMP_ID> | |
constexpr const char * | vcl::componentEnumString () |
Returns the string associated to the COMP_ID value. | |
template<uint ELEM_ID> | |
constexpr const char * | vcl::elementEnumCString () |
Returns the string associated to the ELEM_ID value. | |
template<uint ELEM_ID> | |
const std::string & | vcl::elementEnumString () |
Returns the string associated to the ELEM_ID value. | |
template<typename T > | |
auto & | vcl::dereferencePtr (T &&obj) |
Utility function that applies the unary operator '*' to the argument only if the object is a pointer, and returns a reference to the object itself. | |
template<typename T > | |
auto | vcl::addressOfObj (T &obj) |
Utility function that applies the unary operator '&' to the argument only if it is not a pointer. | |
template<typename T , typename U , typename... Us> | |
constexpr uint | vcl::indexInTypePack () |
Function that returns the index of a Type T in a pack of types (variadic templates). The pack is composed of U and Us... | |
template<typename U , typename... Us> | |
uint | vcl::indexInTypePack (std::type_index ti) |
Function that returns the index of the type having the given type_index in a pack of types (variadic templates). The pack is composed of U and Us... | |
Variables | |
constexpr uint | vcl::UINT_NULL = std::numeric_limits<uint>::max() |
The UINT_NULL value represent a null value of uint that is the maximum value that can be represented with unsigned int. | |
constexpr const char * | vcl::COMPONENT_ENUM_STRINGS [CompId::COMPONENTS_NUMBER] |
The COMPONENT_ENUM_STRINGS array contains the string representation of the CompId::Enum values. | |
constexpr const char * | vcl::ELEMENT_ENUM_STRINGS [ElemId::ELEMENTS_NUMBER] |
The ELEMENT_ENUM_STRINGS array contains the string representation of the elements that can compose a mesh. | |
The Types module defines all the utility definitions, types, classes and type traits that are common in the library.
This module does not depend on any other module of the library, and it is used by all the other modules to define the types that are used in the library.
You can access all the types of VCLib by including #include <vclib/types.h>
using vcl::FirstTypeT = typedef typename FirstType<Args...>::type |
Alias for the type of the first type in a pack of types.
Usage:
using vcl::IsDerivedFromTemplateSpecialization = typedef std::invoke_result< detail::IsDerivedFromImplementation<base>, typename std::remove_cv<derived>::type*>::type |
Utility class that allows to check if given class 'Derived' is derived from a specialization of a templated class.
Given a class X and a templated class C<template T>, it can be used in the following way:
and will return true if X derives from any specialization of C.
derived | The class to be checked. |
base | The templated class to be checked. |
using vcl::MakeConstPointerT = typedef typename MakeConstPointer<T>::type |
Utility alias for the MakeConstPointer type.
T | The type to be converted to a const pointer. |
using vcl::RemoveConstFromPointer = typedef std::conditional_t< std::is_pointer_v<T>, std::add_pointer_t<std::remove_cv_t<RemovePtr<T> >>, T> |
Utility alias to get a pointer type without the constness. e.g. If T is const int*, the resulting type is int* If the type is not a pointer, it is left as it was.
T | The input type. |
using vcl::RemoveCVRefAndPointer = typedef std::remove_cvref_t<RemovePtr<T> > |
Utility alias to get clean type from an input type that could have a reference or a pointer.
T | The input type. |
using vcl::RemovePtr = typedef std::remove_pointer_t<T> |
Utility alias to get a type without the pointer. e.g. If T is int*, the resulting type is int.
It corresponds to std::remove_pointer_t.
T | The input type. |
using vcl::RemoveRef = typedef std::remove_reference_t<T> |
Utility alias to get a type type without the reference. e.g. If T is int&, the resulting type is int.
It corresponds to std::remove_reference_t.
T | The input type. |
|
strong |
A simple type that enumerates the main primitive types.
It is used mostly for I/O operations, but can be useful in any context where a type must be described in a variable at runtime.
Utility function that applies the unary operator '&' to the argument only if it is not a pointer.
obj |
Utility function that converts a const pointer/reference to a non-const pointer/reference.
It is useful when you need to re-use the same code for const and non-const member functions.
T | The type of the pointer/reference. |
[in] | value | The const pointer/reference to be const-casted. |
Utility function that converts a const pointer/reference to a non-const pointer/reference.
It is useful when you need to re-use the same code for const and non-const member functions.
T | The type of the pointer/reference. |
[in] | value | The const pointer/reference to be const-casted. |
Utility function that converts a const pointer/reference to a non-const pointer/reference.
It is useful when you need to re-use the same code for const and non-const member functions.
T | The type of the pointer/reference. |
[in] | value | The const pointer/reference to be const-casted. |
Returns the string associated to the COMP_ID value.
COMP_ID | an unsigned integer that identifies the component. |
Utility function that applies the unary operator '*' to the argument only if the object is a pointer, and returns a reference to the object itself.
[in] | obj | The object to dereference. |
Returns the string associated to the ELEM_ID value.
ELEM_ID | an unsigned integer that identifies the element. |
const std::string & vcl::elementEnumString | ( | ) |
Returns the string associated to the ELEM_ID value.
ELEM_ID | an unsigned integer that identifies the element. |
uint vcl::indexInTypePack | ( | std::type_index | ti | ) |
Function that returns the index of the type having the given type_index in a pack of types (variadic templates). The pack is composed of U and Us...
ti | the type_index of the type to search. |
The COMPONENT_ENUM_STRINGS array contains the string representation of the CompId::Enum values.
The ELEMENT_ENUM_STRINGS array contains the string representation of the elements that can compose a mesh.
The UINT_NULL value represent a null value of uint that is the maximum value that can be represented with unsigned int.
Allows to fully use all the possible values (except one) that can be represented in an unsigned int, but with the possibility to flag whether the value is not initialized or is set to null.