component-based

AngularJs 1.5 - Component Based Architecture, Bindings and Good Practices

那年仲夏 提交于 2020-01-05 07:17:19
问题 following my question Angularjs 1.5 - CRUD pages and Components I've some additional design questions on component based architecture. 1- By Guidelines, if I have a child component with bindings from a parent, I should handle data manipulation on the parent. SO, were do I save data, for instance, in the parent or in the child ? Example <my-child on-save="$ctrl.save"></my-child> MyChild component contain a form for saving data. In this scenario, where I should save data, in parent or child ?

How to index all the derived components in a base component list in Entity

老子叫甜甜 提交于 2020-01-02 12:20:13
问题 I am trying to do a entity component system design for simulation. Here is what confuses me now. I am trying to make a Entity class Entity.h class Entity { public: Entity(); virtual ~Entity() = 0; //---------------------Methods---------------------// void AddComponent(const shared_ptr<Component> component); template<class T> T* GetComponent() const; //---------------------Members---------------------// vector<shared_ptr<Component>> m_components; } Entity.cpp template<typename T> T* Entity:

How to index all the derived components in a base component list in Entity

99封情书 提交于 2019-12-06 11:43:16
I am trying to do a entity component system design for simulation. Here is what confuses me now. I am trying to make a Entity class Entity.h class Entity { public: Entity(); virtual ~Entity() = 0; //---------------------Methods---------------------// void AddComponent(const shared_ptr<Component> component); template<class T> T* GetComponent() const; //---------------------Members---------------------// vector<shared_ptr<Component>> m_components; } Entity.cpp template<typename T> T* Entity::GetComponent() const { Component::component_type_t typeIndex = /*T::component_type*/ T* returnPtr =