SOFA API  d5b6f761
Open source framework for multi-physics simuation
sofa::defaulttype::TypeInfoRegistry Class Reference

#include <TypeInfoRegistry.h>

An unique singleton to register all the type info defined in Sofa. More...

Detailed Description

An unique singleton to register all the type info defined in Sofa.


AbstractTypeInfo offers an API to manipulate the data content of a specific type without requiering the inner details of the type. Have a look in AbstractTypeInfo for more informations.

On its side, TypeInfoRegistry holds all the instances of object thats inherits from AbstractTypeInfo

The common use case is get the type id to access a full AbstractTypeInfo from the TypeInfoRegistry. The acces is done with a TypeInfoId instance that stores an unique identifier for each data type.

Example of use: TypeInfoId& shortinfo = TypeInfoId::GetTypeId<double>(); AbstractTypeInfo* info = TypeInfoRegistry::Get(shortinfo); info->getName()

Static Public Member Functions

static const AbstractTypeInfoGet (const TypeInfoId &id)
 
static int Set (const TypeInfoId &tid, AbstractTypeInfo *info, const std::string &compilationTarget)
 
static std::vector< const AbstractTypeInfo * > GetRegisteredTypes (const std::string &target="")
 
static int AllocateNewTypeId (const std::type_info &nfo)
 Returns a new int to generates the corresponding TypeInfoId. More...
 

Function details

◆ AllocateNewTypeId()

int sofa::defaulttype::TypeInfoRegistry::AllocateNewTypeId ( const std::type_info &  nfo)
static

Returns a new int to generates the corresponding TypeInfoId.

◆ Get()

const AbstractTypeInfo * sofa::defaulttype::TypeInfoRegistry::Get ( const TypeInfoId id)
static

Returns the abstractTypeInfo corresponding to the provided TypeInfoId If there is none a NamedOnlyTypeInfo object is created an returned

◆ GetRegisteredTypes()

std::vector< const AbstractTypeInfo * > sofa::defaulttype::TypeInfoRegistry::GetRegisteredTypes ( const std::string &  target = "")
static

Returns a vecotr with all the AbstractTypeInfo that have been registered in the specified target. An empty target select everything that is in the registry.

◆ Set()

int sofa::defaulttype::TypeInfoRegistry::Set ( const TypeInfoId tid,
AbstractTypeInfo info,
const std::string &  compilationTarget 
)
static

Register a new AbstractTypeInfo to the provided TypeInfoId. A Third parameter is used to provides the compilationTarget where the typeinfo is declared to ease the tracking of DataTypes.