ECSM v0.2.0
DoNotDuplicateSystem

Handles entities that should not be duplicated. More...

#include <ecsm.hpp>

Public Types

typedef Singleton< DoNotDuplicateSystem, true > Instance
 Singleton class type.
 

Public Member Functions

std::type_index getComponentType () const override
 Returns specific component typeid() of the system.
 
View< ComponentgetComponent (ID< Component > instance) override
 Returns specific component View.
 
View< DoNotDuplicateComponentgetComponent (ID< Entity > entity) const
 Returns entity specific component view.
 
void disposeComponents () override
 Actually destroys system components.
 
bool hasComponent (ID< Entity > entity) const
 Returns true if entity has specific component.
 
View< DoNotDuplicateComponenttryGetComponent (ID< Entity > entity) const
 Returns entity specific component view if exist.
 

Static Public Member Functions

static bool has ()
 Returns true if class singleton or manager instance is exist.
 
static DoNotDuplicateSystemget ()
 Returns class singleton or manager instance.
 
static DoNotDuplicateSystemtryGet ()
 Returns class singleton or manager instance if exist.
 

Protected Member Functions

 DoNotDuplicateSystem (bool setSingleton=true)
 Creates a new do not duplicate system instance.
 
 ~DoNotDuplicateSystem () override
 Destroys baked transformer system instance.
 
const std::stringgetComponentName () const override
 Returns specific component name of the system.
 
ID< ComponentcreateComponent (ID< Entity > entity) override
 Creates a new component instance for the entity.
 
void destroyComponent (ID< Component > instance) override
 Destroys component instance.
 
void copyComponent (View< Component > source, View< Component > destination) override
 Copies component data from source to destination.
 
void setSingleton ()
 Sets a new class singleton instance.
 
void unsetSingleton () noexcept
 Unsets this class singleton instance.
 

Protected Attributes

LinearPool< DoNotDuplicateComponent, DestroyComponents > components
 System component pool.
 

Static Protected Attributes

static DoNotDuplicateSystemsingletonInstance
 Singleton class instance.
 

Friends

class ecsm::Manager
 

Detailed Description

Handles entities that should not be duplicated.

Constructor & Destructor Documentation

◆ DoNotDuplicateSystem()

DoNotDuplicateSystem ( bool setSingleton = true)
protected

Creates a new do not duplicate system instance.

Parameters
setSingletonset system singleton instance

Member Function Documentation

◆ getComponentName()

const std::string & getComponentName ( ) const
overrideprotectedvirtual

Returns specific component name of the system.

Reimplemented from ComponentSystem< DoNotDuplicateComponent, false >.

◆ createComponent()

ID< Component > createComponent ( ID< Entity > entity)
inlineoverrideprotectedvirtualinherited

Creates a new component instance for the entity.

You should use Manager to add components to the entity.

Reimplemented from System.

◆ destroyComponent()

void destroyComponent ( ID< Component > instance)
inlineoverrideprotectedvirtualinherited

Destroys component instance.

You should use Manager to remove components from the entity.

Reimplemented from System.

◆ copyComponent()

void copyComponent ( View< Component > source,
View< Component > destination )
inlineoverrideprotectedvirtualinherited

Copies component data from source to destination.

You should use Manager to copy component data of entities.

Reimplemented from System.

◆ getComponentType()

std::type_index getComponentType ( ) const
inlineoverridevirtualinherited

Returns specific component typeid() of the system.

Note
Override it to define a custom component of the system.

Reimplemented from System.

◆ getComponent() [1/2]

View< Component > getComponent ( ID< Component > instance)
inlineoverridevirtualinherited

Returns specific component View.

Reimplemented from System.

◆ getComponent() [2/2]

View< DoNotDuplicateComponent > getComponent ( ID< Entity > entity) const
inlineinherited

Returns entity specific component view.

Parameters
entitytarget entity with component
Note
This function is faster than the Manager one.

◆ disposeComponents()

void disposeComponents ( )
inlineoverridevirtualinherited

Actually destroys system components.

Components are not destroyed immediately, only after the dispose call.

Reimplemented from System.

◆ hasComponent()

bool hasComponent ( ID< Entity > entity) const
inlineinherited

Returns true if entity has specific component.

Parameters
entitytarget entity with component
Note
This function is faster than the Manager one.

◆ tryGetComponent()

View< DoNotDuplicateComponent > tryGetComponent ( ID< Entity > entity) const
inlineinherited

Returns entity specific component view if exist.

Parameters
entitytarget entity with component
Note
This function is faster than the Manager one.