2023-10-19 23:05:11 +02:00
|
|
|
#ifndef TP5_PROJET_HPP
|
|
|
|
#define TP5_PROJET_HPP 1
|
|
|
|
|
2023-10-27 18:01:17 +02:00
|
|
|
#include "../includes/Tache.hpp"
|
|
|
|
|
2023-10-27 20:29:48 +02:00
|
|
|
class Projet {
|
|
|
|
// Graphe acyclique
|
|
|
|
std::vector<Tache *> taches;
|
2023-10-24 16:47:59 +02:00
|
|
|
|
2023-10-27 20:29:48 +02:00
|
|
|
// Première tâche qui sera exécutée
|
|
|
|
const Tache debut;
|
|
|
|
|
|
|
|
// Source du graphe aka la dernière à être exécutée
|
|
|
|
const Tache fin;
|
2023-10-19 23:05:11 +02:00
|
|
|
|
|
|
|
friend std::ostream &operator<<(std::ostream &, const Projet &);
|
|
|
|
|
2023-10-27 20:29:48 +02:00
|
|
|
protected:
|
2023-10-27 18:01:17 +02:00
|
|
|
Projet(); // constructor
|
2023-10-19 23:05:11 +02:00
|
|
|
virtual ~Projet(); // destructor
|
|
|
|
|
|
|
|
Projet(const Projet &); // copy constructor
|
|
|
|
const Projet &operator=(const Projet &); // copy assignement
|
2023-10-24 16:47:59 +02:00
|
|
|
|
|
|
|
// Retourne une paire d'indentifiants de tâches au hasard
|
2023-10-27 20:29:48 +02:00
|
|
|
const std::pair<const int, const int> pick_two_random_tasks() const;
|
2023-10-24 16:47:59 +02:00
|
|
|
|
|
|
|
// Indique pour une tâche si elle fait partie du projet
|
2023-10-27 20:29:48 +02:00
|
|
|
const Tache *contains(const int) const;
|
|
|
|
const Tache *contains(const std::string) const;
|
2023-10-24 16:47:59 +02:00
|
|
|
|
|
|
|
// Donne une version du vecteur de tâches non modifiable
|
2023-10-27 20:29:48 +02:00
|
|
|
const std::vector<Tache *> consult_tasks() const;
|
2023-10-26 19:08:00 +02:00
|
|
|
|
|
|
|
// Corrige les éventuelles anomalies du vector de tâches
|
2023-10-27 20:29:48 +02:00
|
|
|
void topologicalSort() const;
|
2023-10-19 23:05:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|