1 /**
2  * The interface for classes that are used to manage NodeLists (set as the familyClass property 
3  * in the Engine object). Most developers don't need to use this since the default implementation
4  * is used by default and suits most needs.
5  */
6 module ashd.core.ifamily;
7 
8 import ashd.core.entity  : Entity;
9 import ashd.core.node    : Node;
10 import ashd.core.nodelist: NodeList;
11 
12 
13 
14 interface IFamily
15 {
16     /**
17      * Returns the NodeList managed by this class. This should be a reference that remains valid always
18      * since it is retained and reused by Systems that use the list. i.e. never recreate the list,
19      * always modify it in place.
20      */
21     NodeList nodeList();
22 
23     /**
24      * clean the node (reset component pointers)
25      */
26     void resetNode( Node node_a );
27 
28     /**
29      * An entity has been added to the engine. It may already have components so test the entity
30      * for inclusion in this family's NodeList.
31      */
32     void newEntity( Entity entity_a );
33 
34     /**
35      * An entity has been removed from the engine. If it's in this family's NodeList it should be removed.
36      */
37     void removeEntity( Entity entity_a );
38 
39     /**
40      * A component has been added to an entity. Test whether the entity's inclusion in this family's
41      * NodeList should be modified.
42      */
43     void componentAddedToEntity( Entity entity_a, ClassInfo class_a );
44 
45     /**
46      * A component has been removed from an entity. Test whether the entity's inclusion in this family's
47      * NodeList should be modified.
48      */
49     void componentRemovedFromEntity( Entity entity_a, ClassInfo class_a );
50 
51     /**
52      * The family is about to be discarded. Clean up all properties as necessary. Usually, you will
53      * want to empty the NodeList at this time.
54      */
55     void cleanUp();
56 
57 }