sys-sage
|
Generic class for all hardware and logical components in sys-sage. More...
#include <Component.hpp>
Public Member Functions | |
Component (int _id=0, std::string _name="unknown") | |
Generic Component constructor (no automatic insertion in the Component Tree). Usually one of the derived subclasses for different Component Types will be created, not this one. | |
Component (Component *parent, int _id=0, std::string _name="unknown") | |
Generic Component constructor with insertion into the Component Tree as the parent's child. Usually one of the derived subclasses for different Component Types will be created. | |
void | InsertChild (Component *child) |
Inserts a child component to this component (in the Component Tree). The child pointer will be inserted at the end of the children vector. | |
int | InsertBetweenParentAndChild (Component *parent, Component *child, bool alreadyParentsChild) |
Inserts this component between a parent and one of its children. The parent component remains the parent, this Component becomes a new child of the parent, and the specified child becomes this component's child. | |
int | InsertBetweenParentAndChildren (Component *parent, std::vector< Component * > children, bool alreadyParentsChild) |
Inserts this component between a parent and a (subset of) its children. The parent component remains parent, this Component becomes a new child, and the children become parent's grandchildren. | |
int | RemoveChild (Component *child) |
Removes the passed component from the list of children, without completely deleting (and deallocating) the child itself. | |
void | SetParent (Component *parent) |
Set a parent to the component. This is usually used when inserting a component in the tree (by calling InsertChild on the parent, and calling SetParent on the child). | |
void | PrintSubtree () const |
Prints the whole subtree of this component (including the component itself) to stdout. The tree is printed in DFS order, so that the hierarchy can be easily seen. Each child is indented by " ". For each component in the subtree, the following is printed: "<string component type> (name <name>) id <id> - children: <num children> | |
void | PrintAllDataPathsInSubtree () |
Prints all DataPaths that go from or to components in the subtree. | |
void | PrintAllRelationsInSubtree (RelationType::type RelationType=RelationType::Any) |
Prints all Relations in the subtree. | |
const std::string & | GetName () const |
Returns name of the component. | |
void | SetName (std::string _name) |
Sets name of the component. | |
int | GetId () const |
Returns id of the component. | |
sys_sage::ComponentType::type | GetComponentType () const |
Returns component type of the component. The component type denotes which class the instance is (often stored as Component*, even though they are a member of one of the child classes). | |
std::string | GetComponentTypeStr () const |
Returns component type as a human-readable string, as defined in ComponentType::names. | |
const std::vector< Component * > & | GetChildren () const |
Returns a const reference to std::vector containing all children of the component (empty vector if no children). | |
Component * | GetParent () const |
Returns Component pointer to parent (or NULL if this component is the root) | |
Component * | GetChild (int _id) const |
Retrieve a Component* to a child with child.id=_id. Identical to GetChildById Should there be more children with the same id, the first match will be retrieved (i.e. the one with lower index in the children array.) | |
Component * | GetChildById (int _id) const |
Retrieve a Component* to a child with child.id=_id. Should there be more children with the same id, the first match will be retrieved (i.e. the one with lower index in the children array.) | |
Component * | GetChildByType (ComponentType::type _componentType) const |
Retrieve a Component* to a child matching the given component type. Should there be more children with the same type, the first match will be retrieved (i.e. the one with lower index in the children array.) | |
std::vector< Component * > | GetAllChildrenByType (ComponentType::type _componentType) const |
Searches for all children matching the given component type. | |
void | GetAllChildrenByType (std::vector< Component * > *_outArray, ComponentType::type _componentType) const |
Searches for all the children matching the given component type. | |
Component * | GetSubcomponentById (int _id, ComponentType::type _componentType) |
Searches the subtree to find a component with a matching id and componentType, i.e. looks for a certain component with a matching ID. The search is a DFS. The search starts with the calling component. | |
void | GetAllSubcomponentsByType (std::vector< Component * > *outArray, ComponentType::type _componentType) |
Searches for all the subcomponents (children, their children and so on) matching the given component type. | |
std::vector< Component * > | GetAllSubcomponentsByType (ComponentType::type _componentType) |
Searches for all the subcomponents (children, their children and so on) matching the given component type. | |
int | CountAllSubcomponents () const |
Counts number of subcomponents (children, grandchildren, etc.). | |
int | CountAllSubcomponentsByType (ComponentType::type _componentType) const |
Counts number of subcomponents (children, their children and so on) matching the requested component type. | |
int | CountAllChildrenByType (ComponentType::type _componentType) const |
Counts number of children matching the requested component type. | |
Component * | GetAncestorByType (ComponentType::type _componentType) |
Moves up the tree until a parent of the given type is found. | |
int | GetSubtreeDepth () const |
Retrieves maximal distance to a leaf (i.e. the depth of the subtree). 0=leaf, 1=children are leaves, 2=at most children's children are leaves ..... | |
Component * | GetNthAncestor (int n) |
Retrieves Nth ancestor, which resides N levels above. E.g. if n=1, the parent is retrieved; if n=2, the grandparent is retrieved and so on. | |
void | GetNthDescendents (std::vector< Component * > *outArray, int depth) |
Retrieves a std::vector of Component pointers, which reside 'depth' levels deeper. The tree is traversed in order as the children are stored in std::vector children. E.g. if depth=1, only children of the current are retrieved; if depth=2, only children of the children are retrieved.. | |
std::vector< Component * > | GetNthDescendents (int depth) |
Retrieves a std::vector of Component pointers, which reside 'depth' levels deeper. The tree is traversed in order as the children are stored in the std::vector. E.g. if depth=1, only children of the current are retrieved; if depth=2, only children of the children are retrieved.. | |
void | GetSubcomponentsByType (std::vector< Component * > *outArray, int componentType) |
Retrieves a std::vector of Component pointers, which reside in the subtree and have a matching type. The tree is traversed DFS in order as the children are stored in each std::vector children. | |
std::vector< Component * > | GetSubcomponentsByType (ComponentType::type _componentType) |
Retrieves a std::vector of Component pointers, which reside in the subtree and have a matching type. The tree is traversed DFS in order as the children are stored in the std::vector. | |
void | GetComponentsInSubtree (std::vector< Component * > *outArray) |
Retrieves a std::vector of Component pointers, which form the subtree (current node and all the subcomponents) of this. | |
std::vector< Component * > | GetComponentsInSubtree () |
Retrieves a std::vector of Component pointers, which form the subtree (current node and all the subcomponents) of this. | |
const std::vector< Relation * > & | GetRelations (RelationType::type relationType) const |
Returns a (const) reference to the internal vector of relations for a given type. | |
std::vector< Relation * > | GetAllRelationsBy (RelationType::type relationType=RelationType::Any, int thisComponentPosition=-1) const |
Returns a newly-constructed vector of all relations of a given type and position. | |
DataPath * | GetDataPathByType (DataPathType::type dp_type, DataPathDirection::type direction=DataPathDirection::Any) const |
Retrieves a DataPath* from the list of this component's data paths with matching DataPathType and DataPathDirection. The first match is returned. | |
void | GetAllDataPaths (std::vector< DataPath * > *outDpArr, DataPathType::type dp_type=DataPathType::Any, DataPathDirection::type direction=DataPathDirection::Any) const |
Retrieves all DataPath* from the list of this component's data paths with matching type and orientation. Results are returned in std::vector<DataPath*>* outDpArr, where first the matching data paths in dp_outgoing are pushed back, then the ones in dp_incoming. | |
std::vector< DataPath * > | GetAllDataPaths (DataPathType::type dp_type=DataPathType::Any, DataPathDirection::type direction=DataPathDirection::Any) const |
Retrieves all DataPath* from the list of this component's data paths with matching type and orientation/direction. Results are returned in a std::vector<DataPath*>*. | |
int | CheckComponentTreeConsistency () const |
Checks the consistency of the component tree starting from this component. | |
int | GetTopologySize (unsigned *out_component_size, unsigned *out_dataPathSize) const |
Calculates approximate memory footprint of the subtree of this element (including the relevant Relations). | |
int | GetDepth (bool refresh) |
Retrieves the depth (level) of a component in the topology. | |
void | DeleteRelation (Relation *r) |
Deletes a Relation from this component as well as the Relation itself. | |
void | DeleteDataPath (DataPath *dp) |
Deletes and deallocates the DataPath pointer from the list of outgoing/incoming DataPaths. | |
void | DeleteAllRelations (RelationType::type relationType=RelationType::Any) |
Deletes all relations of this component (optionally filtered by type). | |
void | DeleteAllDataPaths () |
Deletes all DataPaths of this component. | |
void | DeleteSubtree () const |
void | Delete (bool withSubtree=true) |
Deletes a component, its children (if withSubtree = true), and all associated Relations. If only the component itself is deleted, its children are inserted into its parent's children list. | |
Public Attributes | |
std::map< std::string, void * > | attrib |
Protected Member Functions | |
Component (int _id, std::string _name, ComponentType::type _componentType) | |
Protected constructor for derived classes (no automatic insertion in the Component Tree). | |
Component (Component *parent, int _id, std::string _name, ComponentType::type _componentType) | |
Protected constructor for derived classes with insertion into the Component Tree. | |
Protected Attributes | |
int | id |
int | depth |
std::string | name |
int | count {-1} |
const ComponentType::type | componentType |
std::vector< Component * > | children |
Component * | parent { nullptr } |
std::array< std::vector< Relation * > *, RelationType::_num_relation_types > * | relations = nullptr |
Generic class for all hardware and logical components in sys-sage.
All components inherit from this class, which defines attributes and methods common to all components. This enables a unified interface for tree traversal, querying, and manipulation. Usually, a Component instance is one of the derived subclasses, but a generic Component is also possible.
sys_sage::Component::Component | ( | int | _id = 0, |
std::string | _name = "unknown" ) |
Generic Component constructor (no automatic insertion in the Component Tree). Usually one of the derived subclasses for different Component Types will be created, not this one.
_id | Numeric ID of the component (default 0) |
_name | Name of the component (default "unknown") |
Sets componentType to sys_sage::ComponentType::None.
sys_sage::Component::Component | ( | Component * | parent, |
int | _id = 0, | ||
std::string | _name = "unknown" ) |
Generic Component constructor with insertion into the Component Tree as the parent's child. Usually one of the derived subclasses for different Component Types will be created.
parent | Pointer to the parent component |
_id | Numeric ID of the component (default 0) |
_name | Name of the component (default "unknown") |
Sets componentType to sys_sage::ComponentType::None.
|
protected |
|
protected |
int sys_sage::Component::CheckComponentTreeConsistency | ( | ) | const |
Checks the consistency of the component tree starting from this component.
This function verifies that each child component has this component set as its parent. It logs an error message for each child that has an incorrect parent and increments the error count. The function then recursively checks the consistency of the entire subtree rooted at each child component.
The function returns the total number of errors found in the component tree, including errors in the direct children and any nested descendants.
int sys_sage::Component::CountAllChildrenByType | ( | ComponentType::type | _componentType | ) | const |
Counts number of children matching the requested component type.
_componentType | - ComponentType to look for. |
int sys_sage::Component::CountAllSubcomponents | ( | ) | const |
Counts number of subcomponents (children, grandchildren, etc.).
int sys_sage::Component::CountAllSubcomponentsByType | ( | ComponentType::type | _componentType | ) | const |
Counts number of subcomponents (children, their children and so on) matching the requested component type.
_componentType | - ComponentType to look for. |
void sys_sage::Component::Delete | ( | bool | withSubtree = true | ) |
Deletes a component, its children (if withSubtree = true), and all associated Relations. If only the component itself is deleted, its children are inserted into its parent's children list.
withSubtree | If true, the whole subtree is deleted; otherwise only the component itself. |
void sys_sage::Component::DeleteAllDataPaths | ( | ) |
Deletes all DataPaths of this component.
void sys_sage::Component::DeleteAllRelations | ( | RelationType::type | relationType = RelationType::Any | ) |
Deletes all relations of this component (optionally filtered by type).
relationType | Relation type to delete (default: Any) |
void sys_sage::Component::DeleteDataPath | ( | DataPath * | dp | ) |
Deletes and deallocates the DataPath pointer from the list of outgoing/incoming DataPaths.
dp | DataPath to delete |
void sys_sage::Component::DeleteRelation | ( | Relation * | r | ) |
void sys_sage::Component::DeleteSubtree | ( | ) | const |
Deletes the whole subtree (all the children) of the component.
std::vector< Component * > sys_sage::Component::GetAllChildrenByType | ( | ComponentType::type | _componentType | ) | const |
Searches for all children matching the given component type.
_componentType | Required type of components |
void sys_sage::Component::GetAllChildrenByType | ( | std::vector< Component * > * | _outArray, |
ComponentType::type | _componentType ) const |
Searches for all the children matching the given component type.
_componentType | - Required type of components |
outArray | - output parameter (vector with results) An input is pointer to a std::vector<Component *>, in which the elements will be pushed. It must be allocated before the call (but does not have to be empty). The method pushes back the found elements – i.e. the elements(pointers) can be found in this array after the method returns. (If no found, nothing will be pushed into the vector.) |
std::vector< sys_sage::DataPath * > sys_sage::Component::GetAllDataPaths | ( | DataPathType::type | dp_type = DataPathType::Any, |
DataPathDirection::type | direction = DataPathDirection::Any ) const |
Retrieves all DataPath* from the list of this component's data paths with matching type and orientation/direction. Results are returned in a std::vector<DataPath*>*.
dp_type | DataPath type to search for (default: Any) |
direction | Orientation (default: Any) |
void sys_sage::Component::GetAllDataPaths | ( | std::vector< DataPath * > * | outDpArr, |
DataPathType::type | dp_type = DataPathType::Any, | ||
DataPathDirection::type | direction = DataPathDirection::Any ) const |
Retrieves all DataPath* from the list of this component's data paths with matching type and orientation. Results are returned in std::vector<DataPath*>* outDpArr, where first the matching data paths in dp_outgoing are pushed back, then the ones in dp_incoming.
outDpArr | - output parameter (vector with results) An input is pointer to a std::vector<DataPath *>, in which the data paths will be pushed. It must be allocated before the call (but does not have to be empty). The method pushes back the found data paths – i.e. the data paths(pointers) can be found in this array after the method returns. (If no found, the vector is not changed.) |
dp_type | DataPath type to search for (default: Any) |
direction | Orientation/direction of a DataPath (default: Any) |
std::vector< sys_sage::Relation * > sys_sage::Component::GetAllRelationsBy | ( | RelationType::type | relationType = RelationType::Any, |
int | thisComponentPosition = -1 ) const |
Returns a newly-constructed vector of all relations of a given type and position.
relationType | Type of relation (default: Any) |
thisComponentPosition | Position of this component in the relation (default: -1 = do NOT care about position) |
std::vector< Component * > sys_sage::Component::GetAllSubcomponentsByType | ( | ComponentType::type | _componentType | ) |
Searches for all the subcomponents (children, their children and so on) matching the given component type.
_componentType | - Required type of components. |
void sys_sage::Component::GetAllSubcomponentsByType | ( | std::vector< Component * > * | outArray, |
ComponentType::type | _componentType ) |
Searches for all the subcomponents (children, their children and so on) matching the given component type.
_componentType | - Required type of components |
outArray | - output parameter (vector with results) An input is pointer to a std::std::vector<Component *>, in which the elements will be pushed. It must be allocated before the call (but does not have to be empty). The method pushes back the found elements – i.e. the elements(pointers) can be found in this array after the method returns. (If no found, nothing will be pushed into the vector.) |
sys_sage::Component * sys_sage::Component::GetAncestorByType | ( | ComponentType::type | _componentType | ) |
Moves up the tree until a parent of the given type is found.
_componentType | Desired component type |
sys_sage::Component * sys_sage::Component::GetChild | ( | int | _id | ) | const |
Retrieve a Component* to a child with child.id=_id. Identical to GetChildById
Should there be more children with the same id, the first match will be retrieved (i.e. the one with lower index in the children array.)
sys_sage::Component * sys_sage::Component::GetChildByType | ( | ComponentType::type | _componentType | ) | const |
Retrieve a Component* to a child matching the given component type. Should there be more children with the same type, the first match will be retrieved (i.e. the one with lower index in the children array.)
_componentType | Component type to match |
const std::vector< sys_sage::Component * > & sys_sage::Component::GetChildren | ( | ) | const |
Returns a const reference to std::vector containing all children of the component (empty vector if no children).
std::vector< sys_sage::Component * > sys_sage::Component::GetComponentsInSubtree | ( | ) |
Retrieves a std::vector of Component pointers, which form the subtree (current node and all the subcomponents) of this.
void sys_sage::Component::GetComponentsInSubtree | ( | std::vector< Component * > * | outArray | ) |
Retrieves a std::vector of Component pointers, which form the subtree (current node and all the subcomponents) of this.
outArray | - output parameter (vector with results) An input is pointer to a std::vector<Component *>, in which the elements will be pushed. It must be allocated before the call (but does not have to be empty). The method pushes back the found elements – i.e. the elements(pointers) can be found in this array after the method returns. (If no found, the vector is not changed.) |
sys_sage::ComponentType::type sys_sage::Component::GetComponentType | ( | ) | const |
Returns component type of the component. The component type denotes which class the instance is (often stored as Component*, even though they are a member of one of the child classes).
std::string sys_sage::Component::GetComponentTypeStr | ( | ) | const |
Returns component type as a human-readable string, as defined in ComponentType::names.
sys_sage::DataPath * sys_sage::Component::GetDataPathByType | ( | DataPathType::type | dp_type, |
DataPathDirection::type | direction = DataPathDirection::Any ) const |
Retrieves a DataPath* from the list of this component's data paths with matching DataPathType and DataPathDirection. The first match is returned.
dp_type | DataPath type to search for |
direction | Orientation (default: Any) |
int sys_sage::Component::GetDepth | ( | bool | refresh | ) |
Retrieves the depth (level) of a component in the topology.
refresh | If true, recalculate the position (depth) of the component in the tree; if false, return the already stored value |
int sys_sage::Component::GetId | ( | ) | const |
const std::string & sys_sage::Component::GetName | ( | ) | const |
sys_sage::Component * sys_sage::Component::GetNthAncestor | ( | int | n | ) |
Retrieves Nth ancestor, which resides N levels above. E.g. if n=1, the parent is retrieved; if n=2, the grandparent is retrieved and so on.
n | - how many levels above the tree should be looked. |
std::vector< sys_sage::Component * > sys_sage::Component::GetNthDescendents | ( | int | depth | ) |
Retrieves a std::vector of Component pointers, which reside 'depth' levels deeper. The tree is traversed in order as the children are stored in the std::vector. E.g. if depth=1, only children of the current are retrieved; if depth=2, only children of the children are retrieved..
depth | - how many levels down the tree should be looked |
void sys_sage::Component::GetNthDescendents | ( | std::vector< Component * > * | outArray, |
int | depth ) |
Retrieves a std::vector of Component pointers, which reside 'depth' levels deeper. The tree is traversed in order as the children are stored in std::vector children. E.g. if depth=1, only children of the current are retrieved; if depth=2, only children of the children are retrieved..
depth | - how many levels down the tree should be looked |
outArray | - output parameter (vector with results) An input is pointer to a std::vector<Component *>, in which the elements will be pushed. It must be allocated before the call (but does not have to be empty). The method pushes back the found elements – i.e. the elements(pointers) can be found in this array after the method returns. (If no found, nothing will be pushed into the vector.) |
const std::vector< sys_sage::Relation * > & sys_sage::Component::GetRelations | ( | RelationType::type | relationType | ) | const |
Returns a (const) reference to the internal vector of relations for a given type.
relationType | Type of relation (see RelationType for available types). Only use specific Relation Types, not RelationType::Any (you will get an empty vector). |
sys_sage::Component * sys_sage::Component::GetSubcomponentById | ( | int | _id, |
ComponentType::type | _componentType ) |
Searches the subtree to find a component with a matching id and componentType, i.e. looks for a certain component with a matching ID. The search is a DFS. The search starts with the calling component.
_id | - the id to look for |
_componentType | - the component type where to look for the id |
std::vector< Component * > sys_sage::Component::GetSubcomponentsByType | ( | ComponentType::type | _componentType | ) |
Retrieves a std::vector of Component pointers, which reside in the subtree and have a matching type. The tree is traversed DFS in order as the children are stored in the std::vector.
componentType | - componentType |
void sys_sage::Component::GetSubcomponentsByType | ( | std::vector< Component * > * | outArray, |
int | componentType ) |
Retrieves a std::vector of Component pointers, which reside in the subtree and have a matching type. The tree is traversed DFS in order as the children are stored in each std::vector children.
componentType | - componentType |
outArray | - output parameter (vector with results) An input is pointer to a std::vector<Component *>, in which the elements will be pushed. It must be allocated before the call (but does not have to be empty). The method pushes back the found elements – i.e. the elements(pointers) can be found in this array after the method returns. (If no found, the vector is not changed.) |
int sys_sage::Component::GetSubtreeDepth | ( | ) | const |
Retrieves maximal distance to a leaf (i.e. the depth of the subtree). 0=leaf, 1=children are leaves, 2=at most children's children are leaves .....
int sys_sage::Component::GetTopologySize | ( | unsigned * | out_component_size, |
unsigned * | out_dataPathSize ) const |
Calculates approximate memory footprint of the subtree of this element (including the relevant Relations).
out_component_size | output parameter (contains the footprint of the component tree elements); an already allocated unsigned * is the input, the value is expected to be 0 (the result is accumulated here) |
out_dataPathSize | output parameter (contains the footprint of the data-path graph elements); an already allocated unsigned * is the input, the value is expected to be 0 (the result is accumulated here) |
int sys_sage::Component::InsertBetweenParentAndChild | ( | Component * | parent, |
Component * | child, | ||
bool | alreadyParentsChild ) |
Inserts this component between a parent and one of its children. The parent component remains the parent, this Component becomes a new child of the parent, and the specified child becomes this component's child.
parent | The parent component to which this component will be inserted as a child. |
child | The child component that will become the child of this component and will remain a descendant of the original parent. |
alreadyParentsChild | A boolean flag indicating whether this component is already a child of the parent. If true, the function assumes that this component is already present as a child of the parent and only needs to reassign the specified child. If false, the function will add this component as a new child of the parent after reassigning the specified child. |
int sys_sage::Component::InsertBetweenParentAndChildren | ( | Component * | parent, |
std::vector< Component * > | children, | ||
bool | alreadyParentsChild ) |
Inserts this component between a parent and a (subset of) its children. The parent component remains parent, this Component becomes a new child, and the children become parent's grandchildren.
parent | The parent component to which this component will be inserted as a child. |
children | A vector of child components that will become the children of this component and the grandchildren of the original parent. |
alreadyParentsChild | A boolean flag indicating whether this component is already a child of the parent. If true, the function assumes that this component is already present as a child of the parent and only needs to reassign the specified children. If false, the function will add this component as a new child of the parent after reassigning the specified children. |
void sys_sage::Component::InsertChild | ( | Component * | child | ) |
Inserts a child component to this component (in the Component Tree). The child pointer will be inserted at the end of the children vector.
void sys_sage::Component::PrintAllDataPathsInSubtree | ( | ) |
Prints all DataPaths that go from or to components in the subtree.
void sys_sage::Component::PrintAllRelationsInSubtree | ( | RelationType::type | RelationType = RelationType::Any | ) |
Prints all Relations in the subtree.
RelationType | Filter by relation type (default: Any) |
int sys_sage::Component::RemoveChild | ( | Component * | child | ) |
Removes the passed component from the list of children, without completely deleting (and deallocating) the child itself.
Removes the passed component from the list of children, without completely deleting (and deallocating) the child itself
child | - child to remove |
child | Child to remove |
void sys_sage::Component::SetName | ( | std::string | _name | ) |
void sys_sage::Component::SetParent | ( | Component * | parent | ) |
Set a parent to the component. This is usually used when inserting a component in the tree (by calling InsertChild on the parent, and calling SetParent on the child).
std::map<std::string, void*> sys_sage::Component::attrib |
A map for storing arbitrary pieces of information or data.
key
denotes the name of the attribute.value
points to the data, stored as a void*
.This data structure is designed to store a wide variety of data types by utilizing pointers to void. Due to its flexibility, it is essential to manage the types and memory allocation/deallocation carefully to avoid issues such as memory leaks or undefined behavior.
Usage:
Note:
void*
pointers. Always ensure that dynamically allocated memory is freed when no longer needed.
|
protected |
Contains the list (std::vector) of pointers to children of the component in the component tree.
|
protected |
Component type of the component. The component type denotes of which class the instance is (often the components are stored as Component*, even though they are a member of one of the child classes) Component type is constant, set by constructor, readonly. It can be of types as listed in ComponentType::type (which is user-extensible).
|
protected |
Can be used to represent multiple Components with the same properties. By default, it represents only 1 component, and is set to -1.
|
protected |
Numeric ID of the component. There is no requirement for uniqueness of the ID, however it is advised to have unique IDs at least in the realm of parent's children (siblings). Some tree search functions, which take the id as a search parameter search for first match, so the user is responsible to manage uniqueness in the realm of the search subtree (or should be aware of the consequences of not doing so). Component's ID is set by the constructor, and is retrieved via int GetId();
|
protected |
Name of the component (as a std::string).
|
protected |
Contains pointer to the parent component in the component tree. If this component is the root, parent will be nullptr.
|
protected |
Contains a list (std::array) of different Relation types. Initially nullptr, it is allocated on the first call to AddRelation() or new Relation(). The array size is RelationType::_num_relation_types, which is defined in RelationType. Each element of the array is a pointer to a std::vector<Relation*> that contains all Relations of that type. (also lazy-allocated)