SOFA API  1a4bb3e7
Open source framework for multi-physics simuation
sofa::defaulttype::TypeInfoId Class Reference

#include <TypeInfoID.h>

Generates unique id for types. More...

Detailed Description

Generates unique id for types.


Compared to type_info.hash_code() this version is guaranteed to be in constant time

The common use case is get the type id to access a full AbstractTypeInfo from the TypeInfoRegistry. Example: TypeInfoId& shortinfo = TypeInfoId::getTypeId<double>(); AbstractTypeInfo* info = TypeInfoRegistry::Get(shortinfo.id); info->getName()

Public Attributes

int id
 
const std::type_info & nfo
 

Static Public Member Functions

template<class T >
static const TypeInfoIdGetTypeId ()
 

Attribute details

◆ id

int sofa::defaulttype::TypeInfoId::id

◆ nfo

const std::type_info& sofa::defaulttype::TypeInfoId::nfo

Function details

◆ GetTypeId()

template<class T >
static const TypeInfoId& sofa::defaulttype::TypeInfoId::GetTypeId ( )
inlinestatic