RobWorkProject  23.9.11-
Public Member Functions | Static Public Member Functions | List of all members
TypeRepository Class Reference

The TypeRepository provides a repository in which types can be mapped to Type objects. More...

#include <TypeRepository.hpp>

Public Member Functions

template<class T >
Type add ()
 Adds a new Type to the repository for the template type T. More...
 
template<class T >
bool has ()
 Tests whether the template type T exists in the repository.
 
template<class T >
Type get (bool addIfNotExisting=false, bool throwException=true)
 Returns the Type associated to the template type T. More...
 

Static Public Member Functions

static TypeRepositoryinstance ()
 Returns the global instance of the TypeRepository. More...
 

Detailed Description

The TypeRepository provides a repository in which types can be mapped to Type objects.

Only one TypeRepository is allowed, hence it is implemented with a singleton pattern.

Notice that problems might occur if trying to use the TypeRepository with user defined type across dynamic linked libraries.

Member Function Documentation

◆ add()

Type add ( )
inline

Adds a new Type to the repository for the template type T.

If the type already exists the Type object associated are just returned.

Returns
Type object associated to the type T

◆ get()

Type get ( bool  addIfNotExisting = false,
bool  throwException = true 
)
inline

Returns the Type associated to the template type T.

With the get method is is possible to specify whether to add the type if it does not exists or whether to throw a rw::core::Exception. If the type if not defined and no exception is throw it returns Undefined.

◆ instance()

static TypeRepository& instance ( )
static

Returns the global instance of the TypeRepository.

Returns
Reference to the global TypeRepository

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