6#include <unordered_map>
7#include <unordered_set>
9#include "../ComponentSystem.h"
11#include "Components/Core/DynamicComponent.h"
19 using MessageId = size_t;
20 constexpr MessageId NoMessage =
static_cast<MessageId
>(-1);
22 constexpr size_t kMaxDynamicTypes = 1024;
23 constexpr size_t kMaxDynamicMethods = 64;
44 size_t messageMask = 0;
47 std::vector<const Reflection::Method *> methods;
75 void initialize(
Context * context)
override;
77 void cleanup(
Context * context)
override;
80 void preUpdate(
Context * context)
override;
83 void update(
Context * context)
override;
86 void postUpdate(
Context * context)
override;
90 CpuInstrumentationScope(SCOPE_SYSTEMS,
"DynamicComponentSystem::preUpdate");
97 CpuInstrumentationScope(SCOPE_SYSTEMS,
"DynamicComponentSystem::update");
104 CpuInstrumentationScope(SCOPE_SYSTEMS,
"DynamicComponentSystem::postUpdate");
110 void registerType(
Context * context,
const StringView & name,
size_t dispatchMask);
112 MessageId registerMessage(
const StringView & messageName);
113 MessageId getMessageId(
const StringView & messageName)
const;
115 void sendMessage(
Entity * entity, MessageId message);
116 void sendMessage(
Entity * entity, MessageId message,
void * arg);
119 using ComponentSystemBase::createComponent;
120 using ComponentSystemBase::destroyComponent;
127 std::vector<std::vector<DispatchInfo>> messageHandlers;
128 std::vector<MessageInfo> messages;
130 MessageId initializeMessage;
131 MessageId updateMessage;
132 MessageId postUpdateMessage;
133 MessageId cleanupMessage;
135 std::unordered_map<Reflection::TypeId, ComponentModel::ComponentPoolBase *> pools;
137 std::vector<DynamicTypeInfo> dynamicTypes;
Untyped Component pool base.
Container for components, providing composition of dynamic entities.
Base class for component systems.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
The dynamic component system handles instances of components derived from DynamicComponent.
void instrumentedPreUpdate() override
Provided for tagged engine instrumentation.
void instrumentedPostUpdate() override
Provided for tagged engine instrumentation.
void instrumentedUpdate() override
Provided for tagged engine instrumentation.
Simple method definition.
Represents a discrete type definition, describing a native type class.
Provides a weakly referenced view over the contents of a string.
uint16_t TypeId
Built in type used to uniquely identify a single type instance.
Contains all Cogs related functionality.
Handle to a Component instance.
Defines an update aware component and the method which to call during the update phase.
const Reflection::Method * method
ComponentModel::ComponentHandle component
Handle to the component to invoke.