CRINSA-team2025 V1
Documentation du Club Robot INSA Rennes 2025
Chargement...
Recherche...
Aucune correspondance
Node.h
1//
2// Created by awing on 09/05/2026.
3//
4
5#ifndef TEAM2026_NODE_H
6#define TEAM2026_NODE_H
7
8#include <vector>
9#include <memory_resource>
10
11namespace Grafcet {
12 class StateMachine;
13
14 class Node {
15 public:
16 explicit Node(const std::pmr::vector<Node*> &parent = {}, const std::pmr::vector<Node*> &child = {}) : parent(parent), children(child) {}
17 virtual ~Node() = default;
18 virtual bool enabled() = 0;
19 virtual void action() = 0;
20
25 void addChild(Node *child) {
26 this->children.push_back(child);
27 child->parent.push_back(this);
28 }
29
31 bool isTransition = false;
33 bool synchronize = false;
35 bool active = false;
36 protected:
38 std::pmr::vector<Node*> parent = {};
40 std::pmr::vector<Node*> children = {};
41
42 friend StateMachine;
43 };
44}
45#endif //TEAM2026_NODE_H
void addChild(Node *child)
attach a child node to the current node
Definition Node.h:25
std::pmr::vector< Node * > parent
List of parents node of the current node.
Definition Node.h:38
bool isTransition
true if the current node is a transition
Definition Node.h:31
bool synchronize
true if the current node needs to wait for all its parent to be enabled before executing
Definition Node.h:33
bool active
true if the node is currently active
Definition Node.h:35
std::pmr::vector< Node * > children
List of children node of the current node.
Definition Node.h:40
Definition StateMachine.h:12