Registry< T, R > Class Template Reference 系统

#include <registrybase.h>

详细描述

template<typename T, typename R>
class maxon::Registry< T, R >

A Registry manages a set of entries of the same type. E.g., all classes are registered at the registry Classes , while all data types are registered at DataTypes.

Registries are declared by the macro MAXON_REGISTRY as derived classes of Registry with the template parameter R being the derived class. For the entries all types are supported which are supported by 数据 .

Each registry is identified by a unique identifier.

Template Parameters
T Type of the values which are stored at the registry. Has to be supported by 数据 .
R Registry class (created by the macro MAXON_REGISTRY).

Classes

class   IdIteratorBase
class   IteratorBase
class   IteratorTemplate

Public Types

using  依赖 = Tuple <>
using  EntryType = T
using  Iterator = IteratorTemplate < IteratorBase >
using  IdIterator = IteratorTemplate < IdIteratorBase >

静态公共成员函数

static Iterator   GetEntries ()
static IdIterator   GetEntriesWithId ()
static const T *  Find (const Id &eid)
static const T &  Get (const Id &eid)
static Result < void >  Insert (const Id &eid, const T &object, const ModuleInfo *module)
static Result < void >  Insert (const Id &eid, T &&object, const ModuleInfo *module)
static Result < void >  PrivateInsert (const Id &eid, T &object, const ModuleInfo *module)
static Result < GenericData 注册 (const Id &eid, const T &object)
static Result < GenericData 注册 (const Id &eid, T &&object)
static Result < GenericData PrivateRegister (const Id &eid, T &object)
static Result < Bool Erase (const Id &eid)

Member Typedef Documentation

◆  依赖

using 依赖 = Tuple <>

◆  EntryType

using EntryType = T

The type of entries stored at this registry.

◆  Iterator

using Iterator = IteratorTemplate < IteratorBase >

◆  IdIterator

using IdIterator = IteratorTemplate < IdIteratorBase >

成员函数文档编制

◆  GetEntries()

static Iterator GetEntries ( )
static

Returns an iterator over all entries registered at this registry. Because the iterator supports the foreach-protocol, you can write

for ( const Class<ExecutionRef>& execCls : ExecutionJobs::GetEntries()) { ... }

If you are also interested in the Id of the entry, you have to use the iterator returned by GetEntriesWithId() .

返回
Iterator over all entries.

◆  GetEntriesWithId()

static IdIterator GetEntriesWithId ( )
static

Returns an iterator over all entries registered at this registry. Each entry is returned as a pair of the Id and the entry itself. Because the iterator supports the foreach-protocol, you can write

for ( const auto & entry : ExecutionJobs::GetEntriesWithId()) { const Id& eid = entry.GetKey(); const Class<ExecutionRef>& execCls = entry.GetValue(); ... }
返回
Iterator over all registry entries (i.e., id-entry-pairs).

◆  Find()

static const T* Find ( const Id eid )
static

Returns a pointer to the registry entry registered at this registry under the given identifier. If no entry exists for the given identifier, nullptr is returned.

参数
[in] eid Identifier within this registry.
返回
Registered entry, or nullptr.

◆  Get()

static const T& Get ( const Id eid )
static

Returns the entry registered at this registry under the given identifier. If no entry exists for the given identifier, a null-value reference is returned.

参数
[in] eid Identifier within this registry.
返回
Registered entry, or a null-value reference.

◆  Insert() [1/2]

static Result <void> Insert ( const Id eid ,
const T &  object ,
const ModuleInfo *  module  
)
static

Registers an entry at this registry under the given identifier. If an entry already exists for the identifier, nothing happens, and an IllegalStateError is returned.

参数
[in] eid Identifier within this registry.
[in] object Value to register.
[in] module The module which initiates the call. When the module is freed, the entry will be freed too.
返回
Success of operation.

◆  Insert() [2/2]

static Result <void> Insert ( const Id eid ,
T &&  object ,
const ModuleInfo *  module  
)
static

Registers an entry at this registry under the given identifier. If an entry already exists for the identifier, nothing happens, and an IllegalStateError is returned.

参数
[in] eid Identifier within this registry.
[in] object Value to register.
[in] module The module which initiates the call. When the module is freed, the entry will be freed too.
返回
Success of operation.

◆  PrivateInsert()

static Result <void> PrivateInsert ( const Id eid ,
T &  object ,
const ModuleInfo *  module  
)
static

◆  Register() [1/2]

static Result < GenericData > Register ( const Id eid ,
const T &  object  
)
static

Registers an entry at this registry under the given identifier. If an entry already exists for the identifier, nothing happens, and an IllegalStateError is returned. The entry will be removed when the lifetime of the object wrapped in the return value ends.

参数
[in] eid Identifier within this registry.
[in] object Value to register.
返回
An object to which the lifetime of the added entry is bound. You have to keep this alive as long as the entry shall remain in the registry.

◆  Register() [2/2]

static Result < GenericData > Register ( const Id eid ,
T &&  object  
)
static

Registers an entry at this registry under the given identifier. If an entry already exists for the identifier, nothing happens, and an IllegalStateError is returned. The entry will be removed when the lifetime of the object wrapped in the return value ends.

参数
[in] eid Identifier within this registry.
[in] object Value to register.
返回
An object to which the lifetime of the added entry is bound. You have to keep this alive as long as the entry shall remain in the registry.

◆  PrivateRegister()

static Result < GenericData > PrivateRegister ( const Id eid ,
T &  object  
)
static

◆  Erase()

static Result < Bool > Erase ( const Id eid )
static

Removes the entry identified by eid from this registry. If no such entry exists, nothing happens.

参数
[in] eid Identifier of the entry to be removed.