CORGI
An open source project by
FPL.
|
A Component used to track the metadata about the Entities themselves. More...
#include <meta.h>
Inherits corgi::Component< MetaData >.
A Component used to track the metadata about the Entities themselves.
Public Member Functions | |
virtual | ~MetaComponent () |
The destructor for MetaComponent. | |
virtual void | AddFromRawData (corgi::EntityRef &entity, const void *raw_data) |
Deserialize a flat binary buffer to create and populate an Entity's MetaData from raw data. More... | |
void | AddFromPrototypeData (corgi::EntityRef &entity, const corgi::MetaDef *meta_def) |
Adds the comment from the prototype data to an Entity's MetaData. More... | |
void | AddWithSourceFile (corgi::EntityRef &entity, const std::string &source_file) |
Adds a source file name to an Entity's MetaData. More... | |
virtual RawDataUniquePtr | ExportRawData (const corgi::EntityRef &entity) const |
Serializes a MetaComponent's data for a given Entity. More... | |
virtual void | InitEntity (corgi::EntityRef &entity) |
Adds the given Entity to the dictionary tracked by this Component. More... | |
virtual void | CleanupEntity (corgi::EntityRef &entity) |
Removes the given Entity from the dictionary tracked by this Component. More... | |
virtual void | UpdateAllEntities (corgi::WorldTime) |
Does nothing. This is only implemented as part of the ComponentInterface. | |
const std::string & | GetEntityID (const corgi::EntityRef &entity) |
Get the ID for this Entity. More... | |
corgi::EntityRef | GetEntityFromDictionary (const std::string &key) |
Get an Entity from the dictionary at a given key. More... | |
Public Member Functions inherited from corgi::Component< MetaData > | |
Component () | |
Construct a Component without an EntityManager. | |
virtual | ~Component () |
Destructor for a Component. | |
virtual void | AddEntityGenerically (EntityRef &entity) |
Provides an alternate way to add Entities if you do not care about the returned data structure, and if you do not feel like casting the BaseComponent into something more specific. More... | |
MetaData * | AddEntity (EntityRef &entity, AllocationLocation alloc_location) |
Adds an Entity to the list that this Component is tracking. More... | |
MetaData * | AddEntity (EntityRef &entity) |
Adds an Entity to the list that this Component is tracking. More... | |
virtual void | RemoveEntity (EntityRef &entity) |
Removes an Entity from the list of Entities. More... | |
virtual EntityIterator | RemoveEntity (EntityIterator iter) |
Removes an Entity from the list of Entities. More... | |
virtual EntityIterator | begin () |
Gets an iterator that will iterate over every Entity associated with the Component, starting from the beginning. More... | |
virtual EntityIterator | end () |
Gets an iterator that points to the end of the list of all entites in the Component. More... | |
virtual bool | HasDataForEntity (const EntityRef &entity) |
Checks if this component contains any data associated with the supplied entity. | |
virtual void * | GetComponentDataAsVoid (const EntityRef &entity) |
Gets the data for a given Entity as a void pointer. More... | |
virtual const void * | GetComponentDataAsVoid (const EntityRef &entity) const |
Gets the data for a given Entity as a const void pointer. More... | |
MetaData * | GetComponentData (size_t data_index) |
Gets the Component data stored at a given index. More... | |
MetaData * | GetComponentData (const EntityRef &entity) |
Gets the data for a given Entity. More... | |
const MetaData * | GetComponentData (size_t data_index) const |
Gets the Component data stored at a given index. More... | |
const MetaData * | GetComponentData (const EntityRef &entity) const |
Gets the data for a given Entity. More... | |
virtual void | ClearComponentData () |
Clears all tracked Component data. | |
ComponentDataType * | Data (const EntityRef &entity) |
A utility function for retrieving the Component data for an Entity from a specific Component. More... | |
ComponentDataType * | Data (const EntityRef &entity) const |
A utility function for retrieving the Component data for an Entity from a specific Component. More... | |
bool | IsRegisteredWithComponent (const EntityRef &entity) |
A utility function for checking if an entity is registered with a particular component. More... | |
ComponentDataType * | GetComponent () |
A utility function for retrieving a reference to a specific Component object, by type. More... | |
virtual void | Init () |
Override this function with code that should be executed when the Component is added to the EntityManager. (This typically happens once, at the beginning of the game before any Entities are added.) | |
virtual void | Cleanup () |
Override this function with any code that executes when this Component is removed from the EntityManager. (i.e. Usually when the game/state is over and everything is shutting down.) | |
virtual void | SetEntityManager (EntityManager *entity_manager) |
Set the EntityManager for this Component. More... | |
virtual void | SetComponentIdOnDataType (ComponentId id) |
Sets the Component ID on the data type. More... | |
Public Member Functions inherited from corgi::ComponentInterface | |
virtual | ~ComponentInterface () |
A destructor for the Component interface. | |
Additional Inherited Members | |
Public Types inherited from corgi::Component< MetaData > | |
typedef VectorPool < ComponentData >::Iterator | EntityIterator |
An iterator to iterate through all of the Entities in the Component. | |
typedef MetaData | value_type |
The templated data type stored by this Component. | |
Public Types inherited from corgi::ComponentInterface | |
typedef std::unique_ptr < uint8_t, std::function< void(uint8_t *)> > | RawDataUniquePtr |
A pointer type for exported raw data. | |
Static Public Member Functions inherited from corgi::Component< MetaData > | |
static ComponentId | GetComponentId () |
Get the ID for this Component. More... | |
Protected Member Functions inherited from corgi::Component< MetaData > | |
size_t | GetComponentDataIndex (const EntityRef &entity) const |
Get the index of the Component data for a given Entity. More... | |
Protected Attributes inherited from corgi::Component< MetaData > | |
VectorPool< ComponentData > | component_data_ |
Storage for all of the data for the Component. | |
EntityManager * | entity_manager_ |
A pointer to the EntityManager for this Component. This is the main point of contact for Components that need to talk to other things. | |
std::unordered_map < EntityIdType, ComponentIndex > | component_index_lookup_ |
A map, for translating unique entity IDs into vectorpool indexes. | |
void corgi::component_library::MetaComponent::AddFromPrototypeData | ( | corgi::EntityRef & | entity, |
const corgi::MetaDef * | meta_def | ||
) |
|
virtual |
Deserialize a flat binary buffer to create and populate an Entity's MetaData from raw data.
entity An EntityRef reference that points to an Entity whose MetaData is being populated from raw data. raw_data A void pointer to the raw FlatBuffer data.
Implements corgi::ComponentInterface.
void corgi::component_library::MetaComponent::AddWithSourceFile | ( | corgi::EntityRef & | entity, |
const std::string & | source_file | ||
) |
|
virtual |
Removes the given Entity from the dictionary tracked by this Component.
[in] | entity | The EntityRef to the Entity that should be removed from the dictionary. |
Reimplemented from corgi::Component< MetaData >.
|
virtual |
Serializes a MetaComponent's data for a given Entity.
[in] | entity | An EntityRef referene to an Entity whose corresponding MetaData will be serialized. |
Reimplemented from corgi::Component< MetaData >.
corgi::EntityRef corgi::component_library::MetaComponent::GetEntityFromDictionary | ( | const std::string & | key | ) |
const std::string& corgi::component_library::MetaComponent::GetEntityID | ( | const corgi::EntityRef & | entity | ) |
|
virtual |
Adds the given Entity to the dictionary tracked by this Component.
[in] | entity | The EntityRef to the Entity to add to the dictionary. |
Reimplemented from corgi::Component< MetaData >.