#include <ComponentManager.h>
|
| ComponentManager (const std::string &filename) |
| The main constructor of the ComponentManager, created the components based of the file's description.
|
|
| ComponentManager (std::shared_ptr< Component > component) |
| Create a ComponentManager with a reference component.
|
|
const std::string & | getName () |
| Return the name of the component managed by this instance.
|
|
const std::string & | getType (const std::string &data) |
| Return a string which give the type of the data.
|
|
void | subscribe (int entity) |
| Subscribe an entity to this component.
|
|
void | subscribe (int entity, dataVector data) |
| Subscribe an entity to this component with specific values.
|
|
void | unsubscribe (int entity) |
| Remove the link between an entity and its component.
|
|
std::vector< int > | getEntities (bool checkState) |
| Return the list of entities linked in this component's manager.
|
|
std::shared_ptr< Component > | getComponent (int entity) |
| Return the component of a specific entity.
|
|
bool | hasEntity (int entity) |
| Return true if the given entity possess this component, false otherwise.
|
|
bool | getState (int entity) |
| Return the actual state of the given entity's component, true or false.
|
|
void | setState (int entity, bool newState) |
| Set the state of the given entity's component.
|
|
void | give (int giver, int receiver, bool copy) |
| Give the ownership, or make a copy, of an entity's component to another component.
|
|
void | toString (std::ostream &stream) |
| Add to the given buffer, the serialized version of this ComponentManager, which will consist of the list of entities' ID + their components data.
|
|
◆ ComponentManager() [1/2]
ComponentManager::ComponentManager |
( |
const std::string & | filename | ) |
|
The main constructor of the ComponentManager, created the components based of the file's description.
- Parameters
-
filename | Full path towards the component's file. |
◆ ComponentManager() [2/2]
ComponentManager::ComponentManager |
( |
std::shared_ptr< Component > | component | ) |
|
Create a ComponentManager with a reference component.
The resulting file will be named after the component's name.
Useful when you making on-the-fly components creation.
- Parameters
-
component | The reference component of this manager, a copy will be created. |
◆ getComponent()
std::shared_ptr< Component > ComponentManager::getComponent |
( |
int | entity | ) |
|
Return the component of a specific entity.
- Parameters
-
entity | The ID of the entity. |
◆ getEntities()
std::vector< int > ComponentManager::getEntities |
( |
bool | checkState | ) |
|
Return the list of entities linked in this component's manager.
checkState will tell this method if you want the state of the entities' components to be verify, entities with a state at "false" will not be returned.
- Parameters
-
◆ getName()
const std::string & ComponentManager::getName |
( |
| ) |
|
Return the name of the component managed by this instance.
◆ getState()
bool ComponentManager::getState |
( |
int | entity | ) |
|
Return the actual state of the given entity's component, true or false.
- Parameters
-
entity | The ID of the entity. |
◆ getType()
const std::string & ComponentManager::getType |
( |
const std::string & | data | ) |
|
Return a string which give the type of the data.
Wrapper of the component's method for the save action.
- Parameters
-
◆ give()
void ComponentManager::give |
( |
int | giver, |
|
|
int | receiver, |
|
|
bool | copy ) |
Give the ownership, or make a copy, of an entity's component to another component.
- Parameters
-
giver | The ID of the entity which give its component. |
receiver | The ID of the entity which take the component. |
copy | If true the component is just copied, otherwise the giver doesn't have the component anymore. |
◆ hasEntity()
bool ComponentManager::hasEntity |
( |
int | entity | ) |
|
Return true if the given entity possess this component, false otherwise.
- Parameters
-
entity | The ID of the entity. |
◆ setState()
void ComponentManager::setState |
( |
int | entity, |
|
|
bool | newState ) |
Set the state of the given entity's component.
- Parameters
-
entity | The ID of the entity. |
newState | The entity's component new state. |
◆ subscribe() [1/2]
void ComponentManager::subscribe |
( |
int | entity | ) |
|
Subscribe an entity to this component.
Will give this entity's component the default values of its data's types.
- Parameters
-
entity | The ID of the entity to subscribe. |
◆ subscribe() [2/2]
void ComponentManager::subscribe |
( |
int | entity, |
|
|
dataVector | data ) |
Subscribe an entity to this component with specific values.
- Parameters
-
entity | The ID of the entity to subscribe. |
data | A vector with the data's names and values. |
- See also
- dataVector
◆ toString()
void ComponentManager::toString |
( |
std::ostream & | stream | ) |
|
Add to the given buffer, the serialized version of this ComponentManager, which will consist of the list of entities' ID + their components data.
- Parameters
-
stream | The stream on which the serialized version of the ComponentManager is append to. |
◆ unsubscribe()
void ComponentManager::unsubscribe |
( |
int | entity | ) |
|
Remove the link between an entity and its component.
- Parameters
-
entity | The ID of the entity to unsubscribe. |
The documentation for this class was generated from the following file:
- C:/Users/thoma/OneDrive/Programmation/C++/TailorMade/TailorMade/headers/ComponentManager.h