Cogs.Core
|
Typed component system managing a pool of components with the given ComponentType. More...
#include <ComponentSystem.h>
Public Types | |
typedef ComponentType | component_type |
Public Member Functions | |
ComponentSystem (Memory::Allocator *allocator, SizeType size=16384, MemBlockType componentMemType=MemBlockType::Component) | |
void | instrumentedPreUpdate () override |
Provided for tagged engine instrumentation. | |
void | instrumentedUpdate () override |
Provided for tagged engine instrumentation. | |
void | instrumentedPostUpdate () override |
Provided for tagged engine instrumentation. | |
ComponentHandle | createComponent () override |
Create a new component instance. | |
void | destroyComponent (ComponentHandle component) override |
Destroy the component held by the given handle. | |
SizeType | getComponentIndex (const Component *component) const |
Get the index of the given component in the component pool. | |
size_t | size () |
Returns the number of active components. | |
void | clearCarryFlags () |
Clear carry flags of all active components. | |
void | resetFlags () |
Reset the flags of all active components. | |
void | prepareUpdate (Context *) override |
void | postUpdate (Context *) override |
ComponentHandle | getHandle (const ComponentType *component) |
Get a handle to the given Component instance. | |
virtual void | addEntitiesWithComponent (std::vector< EntityId > &entities, Reflection::TypeId componentTypeId) override |
Return all entities with a given. | |
![]() | |
virtual | ~ComponentSystemBase () |
Provided for destruction via pointer to base. | |
ComponentSystemBase (Reflection::TypeId componentType) | |
Constructs a ComponentSystemBase to manage components of the given componentType. | |
virtual void | initialize (Context *context) |
Initialize the system. | |
void | preUpdate () |
Run the pre-update method of the system. | |
void | update () |
Updates the system state to that of the current frame. | |
void | postUpdate () |
Perform post update logic in the system. | |
virtual void | preUpdate (Context *) |
Provided for custom pre update logic in derived systems. | |
virtual void | prepareUpdate (Context *) |
Provided for custom update preparation logic in derived systems. | |
virtual void | update (Context *) |
Provided for custom update logic in derived systems. | |
virtual void | postUpdate (Context *) |
Provided for custom post update logic in derived systems. | |
virtual void | instrumentedPreUpdate () |
Provided for tagged engine instrumentation. | |
virtual void | instrumentedUpdate () |
Provided for tagged engine instrumentation. | |
virtual void | instrumentedPostUpdate () |
Provided for tagged engine instrumentation. | |
virtual void | addEntitiesWithComponent (std::vector< EntityId > &, Reflection::TypeId) |
Return all entities with a given. | |
virtual void | cleanup (Context *) |
Provided for custom cleanup logic in derived systems. | |
virtual ComponentHandle | createComponent () |
Create a new component instance. | |
virtual void | destroyComponent (ComponentHandle) |
Destroy the component held by the given handle. | |
Reflection::TypeId | getComponentType () const |
Get the reflected type of the components managed by this system. | |
Static Public Member Functions | |
static Reflection::TypeId | getTypeId () |
Get the type id of the component type used by the system. | |
Public Attributes | |
ComponentPool< ComponentType > | pool |
Pool of components managed by the system. | |
![]() | |
Reflection::TypeId | componentType |
The type of components managed by this instance. | |
Context * | context = nullptr |
Pointer to the Context instance the system lives in. | |
Typed component system managing a pool of components with the given ComponentType.
Definition at line 143 of file ComponentSystem.h.
typedef ComponentType Cogs::Core::ComponentSystem< ComponentType >::component_type |
Definition at line 146 of file ComponentSystem.h.
|
inline |
Definition at line 148 of file ComponentSystem.h.
|
inlineoverridevirtual |
Return all entities with a given.
Reimplemented from Cogs::Core::ComponentSystemBase.
Definition at line 224 of file ComponentSystem.h.
References Cogs::Core::ComponentSystem< ComponentType >::pool.
|
inline |
Clear carry flags of all active components.
Definition at line 195 of file ComponentSystem.h.
References Cogs::ComponentModel::ComponentFlags::CarryChanged, and Cogs::Core::ComponentSystem< ComponentType >::pool.
Referenced by Cogs::Core::ComponentSystem< ComponentType >::prepareUpdate().
|
inlineoverridevirtual |
Create a new component instance.
Reimplemented from Cogs::Core::ComponentSystemBase.
Reimplemented in Cogs::Core::CurtainView::CurtainViewSystem, Cogs::Core::EchoSounder::UniformGridSystem, Cogs::Core::Image360System, Cogs::Core::OGC3DTilesSystem, Cogs::Core::PotreeSystem, Cogs::Core::SeaCurrentsSystem, Cogs::Core::TerrainSystem, Cogs::Core::VectorField::VectorFieldSystem, Cogs::Core::VideoPlaybackSystem, Cogs::Core::Volumetric::OctSystem, Cogs::Core::ComponentSystemWithDataPools< ComponentType, DataTypes >, Cogs::Core::ComponentSystemWithDataPools< AdaptivePlanarGridComponent, AdaptivePlanarGridData >, Cogs::Core::ComponentSystemWithDataPools< AnimationComponent, AnimationData >, Cogs::Core::ComponentSystemWithDataPools< AssetComponent, AssetData >, Cogs::Core::ComponentSystemWithDataPools< AudioComponent, AudioData >, Cogs::Core::ComponentSystemWithDataPools< BasicOceanComponent, BasicOceanData >, Cogs::Core::ComponentSystemWithDataPools< BoxCollisionComponent, CollisionData >, Cogs::Core::ComponentSystemWithDataPools< CameraArrayComponent, CameraArrayData >, Cogs::Core::ComponentSystemWithDataPools< CameraComponent, CameraData >, Cogs::Core::ComponentSystemWithDataPools< CapsuleCollisionComponent, CollisionData >, Cogs::Core::ComponentSystemWithDataPools< CaptureComponent, CaptureData >, Cogs::Core::ComponentSystemWithDataPools< CinematicCameraComponent, CinematicCameraData >, Cogs::Core::ComponentSystemWithDataPools< ClipShapeComponent, ClipShapeData >, Cogs::Core::ComponentSystemWithDataPools< T, CollisionData >, Cogs::Core::ComponentSystemWithDataPools< ComponentType, DataType >, Cogs::Core::ComponentSystemWithDataPools< T, ConstraintData >, Cogs::Core::ComponentSystemWithDataPools< CubeMarkerComponent, CubeMarkerData >, Cogs::Core::ComponentSystemWithDataPools< CurtainViewComponent, CurtainViewData >, Cogs::Core::ComponentSystemWithDataPools< CylinderCollisionComponent, CollisionData >, Cogs::Core::ComponentSystemWithDataPools< DepthAxisComponent, DepthAxisData >, Cogs::Core::ComponentSystemWithDataPools< DataSetComponent, DataSetData >, Cogs::Core::ComponentSystemWithDataPools< OctProviderComponent, OctProviderData >, Cogs::Core::ComponentSystemWithDataPools< PingIsoComponent, SinglePingIsoSurfacesData >, Cogs::Core::ComponentSystemWithDataPools< SwathBottomComponent, SwathBottomData >, Cogs::Core::ComponentSystemWithDataPools< SwathIsoComponent, SwathIsoSurfacesData >, Cogs::Core::ComponentSystemWithDataPools< UniformGridComponent, UniformGridData >, Cogs::Core::ComponentSystemWithDataPools< EmptyCollisionComponent, CollisionData >, Cogs::Core::ComponentSystemWithDataPools< EnvironmentComponent, EnvironmentData >, Cogs::Core::ComponentSystemWithDataPools< ExtrusionComponent, ExtrusionData, ExtrusionLogData >, Cogs::Core::ComponentSystemWithDataPools< FixedConstraintComponent, ConstraintData >, Cogs::Core::ComponentSystemWithDataPools< FogComponent, FogData >, Cogs::Core::ComponentSystemWithDataPools< GenericConstraintComponent, ConstraintData >, Cogs::Core::ComponentSystemWithDataPools< GhostComponent, GhostData >, Cogs::Core::ComponentSystemWithDataPools< GuiComponent, GuiData >, Cogs::Core::ComponentSystemWithDataPools< HeightMapComponent, HeightMapData >, Cogs::Core::ComponentSystemWithDataPools< HingeConstraintComponent, ConstraintData >, Cogs::Core::ComponentSystemWithDataPools< Image360Component, Image360Data >, Cogs::Core::ComponentSystemWithDataPools< InstancedMeshRenderComponent, InstancedMeshRenderData, LocalBounds, WorldBounds >, Cogs::Core::ComponentSystemWithDataPools< InstancedModelComponent, InstancedModelData >, Cogs::Core::ComponentSystemWithDataPools< LightComponent, LightData >, Cogs::Core::ComponentSystemWithDataPools< LodComponent, LodData >, Cogs::Core::ComponentSystemWithDataPools< LoftedCrossSectionsComponent, LoftedCrossSectionsData >, Cogs::Core::ComponentSystemWithDataPools< MarkerPointSetComponent, MarkerPointSetData >, Cogs::Core::ComponentSystemWithDataPools< MaterialComponent, MaterialData >, Cogs::Core::ComponentSystemWithDataPools< MeshCollisionComponent, CollisionData >, Cogs::Core::ComponentSystemWithDataPools< MeshGeneratorComponent, MeshGeneratorData >, Cogs::Core::ComponentSystemWithDataPools< ModelComponent, ModelData >, Cogs::Core::ComponentSystemWithDataPools< OGC3DTilesComponent, OGC3DTilesDataHolder >, Cogs::Core::ComponentSystemWithDataPools< OceanComponent, OceanData >, Cogs::Core::ComponentSystemWithDataPools< PlaneCollisionComponent, CollisionData >, Cogs::Core::ComponentSystemWithDataPools< PotreeComponent, PotreeDataHolder >, Cogs::Core::ComponentSystemWithDataPools< MeshRenderComponent, MeshRenderData, LocalBounds, WorldBounds >, Cogs::Core::ComponentSystemWithDataPools< RigidBodyComponent, RigidBodyData >, Cogs::Core::ComponentSystemWithDataPools< ScreenSizeComponent, ScreenSizeData >, Cogs::Core::ComponentSystemWithDataPools< ScriptComponent, ScriptData >, Cogs::Core::ComponentSystemWithDataPools< SeaCurrentsComponent, SeaCurrentsData >, Cogs::Core::ComponentSystemWithDataPools< SphereCollisionComponent, CollisionData >, Cogs::Core::ComponentSystemWithDataPools< SpringConstraintComponent, ConstraintData >, Cogs::Core::ComponentSystemWithDataPools< SpriteRenderComponent, SpriteRenderData >, Cogs::Core::ComponentSystemWithDataPools< StaticModelComponent, StaticModelData >, Cogs::Core::ComponentSystemWithDataPools< SubMeshRenderComponent, SubMeshRenderData, SubMeshLocalBounds, SubMeshWorldBounds >, Cogs::Core::ComponentSystemWithDataPools< TerrainComponent, TerrainData >, Cogs::Core::ComponentSystemWithDataPools< TrajectoryCrossSectionsComponent, TrajectoryCrossSectionsData >, Cogs::Core::ComponentSystemWithDataPools< TrajectoryComponent, TrajectoryData >, Cogs::Core::ComponentSystemWithDataPools< TransformComponent, LocalTransform, WorldTransform, TransformState >, Cogs::Core::ComponentSystemWithDataPools< TriggerComponent, RigidBodyData >, Cogs::Core::ComponentSystemWithDataPools< VariableExtrusionComponent, VariableExtrusionData >, Cogs::Core::ComponentSystemWithDataPools< VectorFieldComponent, VectorFieldData >, Cogs::Core::ComponentSystemWithDataPools< VideoCaptureComponent, VideoCaptureData >, Cogs::Core::ComponentSystemWithDataPools< Cogs::Core::VideoPlaybackComponent, VideoPlaybackData >, Cogs::Core::ComponentSystemWithDataPools< DensityFieldComponent, DensityFieldData >, Cogs::Core::ComponentSystemWithDataPools< VolOctDummyProviderComponent, OctDummyProviderData >, Cogs::Core::ComponentSystemWithDataPools< OctComponent, OctData >, Cogs::Core::ComponentSystemWithDataPools< PointVisualizationComponent, PointVisualizationData >, Cogs::Core::ComponentSystemWithDataPools< ZipComponent, ZipData >, Cogs::Core::AssetSystem, Cogs::Core::CameraSystem, Cogs::Core::InstancedMeshRenderSystem, Cogs::Core::RenderSystem, Cogs::Core::SpriteRenderSystem, Cogs::Core::SubMeshRenderSystem, and Cogs::Core::MarkerPointSetSystem.
Definition at line 183 of file ComponentSystem.h.
References Cogs::Core::ComponentSystem< ComponentType >::pool.
Referenced by Cogs::Core::InstancedModelSystem::update().
|
inlineoverridevirtual |
Destroy the component held by the given handle.
Reimplemented from Cogs::Core::ComponentSystemBase.
Reimplemented in Cogs::Core::FixedConstraintSystem, Cogs::Core::HingeConstraintSystem, Cogs::Core::SpringConstraintSystem, Cogs::Core::GenericConstraintSystem, Cogs::Core::GhostSystem, Cogs::Core::RigidBodySystem, Cogs::Core::TriggerSystem, Cogs::Core::EchoSounder::UniformGridSystem, Cogs::Core::Image360System, Cogs::Core::OGC3DTilesSystem, Cogs::Core::PotreeSystem, Cogs::Core::SeaCurrentsSystem, Cogs::Core::OceanSystem, Cogs::Core::TerrainSystem, Cogs::Core::VectorField::VectorFieldSystem, Cogs::Core::VideoCaptureSystem, Cogs::Core::ComponentSystemWithDataPools< ComponentType, DataTypes >, Cogs::Core::AssetSystem, Cogs::Core::CaptureSystem, Cogs::Core::InstancedMeshRenderSystem, Cogs::Core::RenderSystem, Cogs::Core::SpriteRenderSystem, Cogs::Core::SubMeshRenderSystem, Cogs::Core::MarkerPointSetSystem, Cogs::Core::AudioSystem, and Cogs::Core::VideoPlaybackSystem.
Definition at line 186 of file ComponentSystem.h.
References Cogs::Core::ComponentSystem< ComponentType >::pool.
|
inline |
Get the index of the given component in the component pool.
Definition at line 189 of file ComponentSystem.h.
References Cogs::Core::ComponentSystem< ComponentType >::pool.
Referenced by Cogs::Core::ComponentSystemWithDataPools< ComponentType, DataTypes >::getData(), and Cogs::Core::ComponentSystem< ComponentType >::getHandle().
|
inline |
Get a handle to the given Component instance.
Definition at line 219 of file ComponentSystem.h.
References Cogs::Core::ComponentSystem< ComponentType >::getComponentIndex(), Cogs::Core::ComponentSystemBase::getComponentType(), and Cogs::Core::ComponentSystem< ComponentType >::pool.
|
inlinestatic |
Get the type id of the component type used by the system.
Definition at line 156 of file ComponentSystem.h.
|
inlineoverridevirtual |
Provided for tagged engine instrumentation.
Reimplemented from Cogs::Core::ComponentSystemBase.
Definition at line 175 of file ComponentSystem.h.
References Cogs::Core::ComponentSystemBase::getComponentType(), Cogs::Reflection::Name::getName(), Cogs::Reflection::Type::getName(), Cogs::Reflection::TypeDatabase::getType(), and Cogs::Core::ComponentSystemBase::postUpdate().
|
inlineoverridevirtual |
Provided for tagged engine instrumentation.
Reimplemented from Cogs::Core::ComponentSystemBase.
Definition at line 161 of file ComponentSystem.h.
References Cogs::Core::ComponentSystemBase::getComponentType(), Cogs::Reflection::Name::getName(), Cogs::Reflection::Type::getName(), Cogs::Reflection::TypeDatabase::getType(), and Cogs::Core::ComponentSystemBase::preUpdate().
|
inlineoverridevirtual |
Provided for tagged engine instrumentation.
Reimplemented from Cogs::Core::ComponentSystemBase.
Definition at line 168 of file ComponentSystem.h.
References Cogs::Core::ComponentSystemBase::getComponentType(), Cogs::Reflection::Name::getName(), Cogs::Reflection::Type::getName(), Cogs::Reflection::TypeDatabase::getType(), and Cogs::Core::ComponentSystemBase::update().
|
inlineoverridevirtual |
Overridden to propagate carry flags. Any subclass overriding this method should also call base class.
Reimplemented from Cogs::Core::ComponentSystemBase.
Reimplemented in Cogs::Core::RigidBodySystem, Cogs::Core::AssetSystem, Cogs::Core::CameraSystem, Cogs::Core::InstancedMeshRenderSystem, Cogs::Core::ModelSystem, Cogs::Core::RenderSystem, Cogs::Core::SpriteRenderSystem, and Cogs::Core::SubMeshRenderSystem.
Definition at line 216 of file ComponentSystem.h.
References Cogs::Core::ComponentSystem< ComponentType >::resetFlags().
|
inlineoverridevirtual |
Overridden to clear carry flags. Any subclass overriding this method should also call base class.
Reimplemented from Cogs::Core::ComponentSystemBase.
Definition at line 212 of file ComponentSystem.h.
References Cogs::Core::ComponentSystem< ComponentType >::clearCarryFlags().
|
inline |
Reset the flags of all active components.
Definition at line 203 of file ComponentSystem.h.
References Cogs::Core::ComponentSystem< ComponentType >::pool.
Referenced by Cogs::Core::ComponentSystem< ComponentType >::postUpdate().
|
inline |
Returns the number of active components.
Definition at line 192 of file ComponentSystem.h.
References Cogs::Core::ComponentSystem< ComponentType >::pool.
ComponentPool<ComponentType> Cogs::Core::ComponentSystem< ComponentType >::pool |
Pool of components managed by the system.
Definition at line 235 of file ComponentSystem.h.
Referenced by Cogs::Core::ComponentSystem< ComponentType >::addEntitiesWithComponent(), Cogs::Core::ComponentSystem< ComponentType >::clearCarryFlags(), Cogs::Core::OGC3DTilesSystem::componentIsStale(), Cogs::Core::OGC3DTilesSystem::createComponent(), Cogs::Core::ComponentSystem< ComponentType >::createComponent(), Cogs::Core::ComponentSystemWithDataPools< ComponentType, DataTypes >::createComponent(), Cogs::Core::ComponentSystem< ComponentType >::destroyComponent(), Cogs::Core::ComponentSystemWithDataPools< ComponentType, DataTypes >::destroyComponent(), Cogs::Core::Image360::Bounds::getBounds(), Cogs::Core::OGC3DTilesBounds::getBounds(), Cogs::Core::Volumetric::OctBounds::getBounds(), Cogs::Core::ComponentSystem< ComponentType >::getComponentIndex(), Cogs::Core::ComponentSystem< ComponentType >::getHandle(), Cogs::Core::VectorField::VectorFieldRenderer::handleEvent(), Cogs::Core::PotreePicker::pickCamera(), Cogs::Core::Image360::RayPickExtension::pickCamera(), Cogs::Core::MarkerPointSetPicker::pickCamera(), Cogs::Core::EchoSounder::OctProviderSystem::preUpdate(), Cogs::Core::ClipShapeSystem::preUpdate(), Cogs::Core::ComponentSystem< ComponentType >::resetFlags(), Cogs::Core::ComponentSystem< ComponentType >::size(), Cogs::Core::TransformSystem::update(), Cogs::Core::DepthAxisSystem::update(), Cogs::Core::TrajectoryCrossSectionsSystem::update(), Cogs::Core::HeightMapSystem::update(), Cogs::Core::EnvironmentSystem::update(), Cogs::Core::LodSystem::update(), Cogs::Core::ScriptSystem::update(), Cogs::Core::ExtrusionSystem::update(), Cogs::Core::MeshGeneratorSystem::update(), Cogs::Core::VariableExtrusionSystem::update(), Cogs::Core::PlaneCollisionSystem::update(), Cogs::Core::FixedConstraintSystem::update(), Cogs::Core::GhostSystem::update(), Cogs::Core::TriggerSystem::update(), Cogs::Core::CubeMarkerSystem::update(), Cogs::Core::EchoSounder::PingIsoSystem::update(), Cogs::Core::EchoSounder::SwathIsoSystem::update(), Cogs::Core::OGC3DTilesSystem::update(), Cogs::Core::VectorField::VectorFieldSystem::update(), Cogs::Core::Volumetric::DensityFieldSystem::update(), Cogs::Core::Volumetric::PointVisualizationSystem::update(), Cogs::Core::ZipSystem::update(), Cogs::Core::MaterialSystem::update(), Cogs::Core::CameraArraySystem::update(), and Cogs::Core::InstancedModelSystem::update().