| 112 | | |
| 113 | | /** |
| 114 | | Selector function |
| 115 | | @param node Node to filter |
| 116 | | @param metrics Metrics from start node to this one |
| 117 | | @param priv Selector private data |
| 118 | | @returns whether the node is interesting |
| 119 | | */ |
| 120 | | typedef enum topo_crit_val_e crit_func_t(struct topo_node_s *node, struct topo_metrics_s *metrics, void *priv); |
| 121 | | |
| 122 | | error_t select( |
| 123 | | struct topo_node_s *start, /// Start node |
| 124 | | crit_func_t *crit, void *crit_priv, /// Criterium function, telling whether a node is eligible |
| 125 | | size_t max_nodes, /// Maximal number of nodes to return |
| 126 | | struct topo_node_s **nodes); /// Output nodes. Table must be allocated by caller and be able to contain max_nodes |
| | 141 | == Selection function == |
| | 142 | |
| | 143 | {{{ |
| | 144 | enum topo_crit_val_e |
| | 145 | { |
| | 146 | CRIT_DROP, /// Node is not interesting, stop recursion here in the graph |
| | 147 | CRIT_RECURS, /// Node is not selected, but we can recurs through it |
| | 148 | CRIT_SELECT, /// Node is selected, and may be recursed down |
| | 149 | }; |
| | 150 | |
| | 151 | /** |
| | 152 | Selector function |
| | 153 | @param node Node to filter |
| | 154 | @param metrics Metrics from start node to this one |
| | 155 | @param priv Selector private data |
| | 156 | @returns whether the node is interesting |
| | 157 | */ |
| | 158 | typedef enum topo_crit_val_e crit_func_t(struct topo_node_s *node, struct topo_metrics_s *metrics, void *priv); |
| | 159 | |
| | 160 | error_t select( |
| | 161 | struct topo_node_s *start, /// Start node |
| | 162 | crit_func_t *crit, void *crit_priv, /// Criterium function, telling whether a node is eligible |
| | 163 | size_t max_nodes, /// Maximal number of nodes to return |
| | 164 | struct topo_node_s **nodes); /// Output nodes. Table must be allocated by caller and be able to contain max_nodes |
| | 165 | }}} |
| | 166 | |