This repository has been archived on 2023-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
GestionProjet/src/Projet.cpp

43 lines
923 B
C++
Raw Normal View History

2023-10-19 23:05:11 +02:00
#include "../includes/Projet.hpp"
Projet::Projet() { std::cout << "Hello, project!\n"; }
Projet::~Projet() {}
Projet::Projet(const Projet &) {}
const Projet &Projet::operator=(const Projet &src) {
if (this == &src) {
return *this;
}
return *this;
}
2023-10-24 16:47:59 +02:00
std::pair <int, int> Projet::pick_two_random_tasks(){
int size = this->taches.size();
int rand1 = rand() % size;
int rand2 = rand() % size;
if(this->taches[rand1]->depends_from(*this->taches[rand2])) pick_two_random_tasks();
//Heritage de tache ?
int id1 = this->taches[rand1]->unique_id;
int id2 = this->taches[rand2]->unique_id;
return std::make_pair(id1, id2);
}
Tache Projet::contains(int id){
for(Tache *t:this->taches)
if(id==t->unique_id) return *t;
return nullptr;
}
std::ostream& operator<<(std::ostream &out, Projet &x){
for(Tache *t: x.taches)
out << *t;
return out;
}
std::vector<Tache *> consult_tasks(){
}