Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CComponentContainer< BaseType > Class Template Reference

A generic container for components. More...

#include <ComponentContainer.h>

Inheritance diagram for CComponentContainer< BaseType >:
CApplication

Public Member Functions

template<class T >
std::shared_ptr< T > GetComponent ()
 Obtain a component.
 
template<class T >
std::shared_ptr< const T > GetComponent () const
 Obtain a component.
 
std::size_t size () const
 Returns number of registered components.
 

Protected Member Functions

void RegisterComponent (const std::shared_ptr< BaseType > &component)
 Register a new component instance.
 
void DeregisterComponent (const std::type_info &typeInfo)
 Deregister a component.
 

Detailed Description

template<class BaseType>
class CComponentContainer< BaseType >

A generic container for components.

A component has to be derived from the BaseType. Only a single instance of each derived type can be registered. Intended use is through inheritance.

Member Function Documentation

◆ DeregisterComponent()

template<class BaseType >
void CComponentContainer< BaseType >::DeregisterComponent ( const std::type_info & typeInfo)
inlineprotected

Deregister a component.

◆ GetComponent() [1/2]

template<class BaseType >
template<class T >
std::shared_ptr< T > CComponentContainer< BaseType >::GetComponent ( )
inline

Obtain a component.

◆ GetComponent() [2/2]

template<class BaseType >
template<class T >
std::shared_ptr< const T > CComponentContainer< BaseType >::GetComponent ( ) const
inline

Obtain a component.

◆ RegisterComponent()

template<class BaseType >
void CComponentContainer< BaseType >::RegisterComponent ( const std::shared_ptr< BaseType > & component)
inlineprotected

Register a new component instance.

◆ size()

template<class BaseType >
std::size_t CComponentContainer< BaseType >::size ( ) const
inline

Returns number of registered components.


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