parent
601cfb3f66
commit
03eff8d454
@ -1,59 +1,94 @@
|
||||
/**
|
||||
* @file structure.h
|
||||
* @brief Header file containing structures and definitions for project management.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* @def TMAXTRAV
|
||||
* @brief Maximum number of works (travaux) in the project.
|
||||
*/
|
||||
#define TMAXTRAV 8
|
||||
#define TRACE false
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *nomE;
|
||||
char *adresse;
|
||||
int capital;
|
||||
int duree;
|
||||
int prix;
|
||||
|
||||
/**
|
||||
* @enum Booleen
|
||||
* @brief Boolean type definition.
|
||||
*/
|
||||
typedef enum {
|
||||
false, /**< Boolean value representing false. */
|
||||
true /**< Boolean value representing true. */
|
||||
} Booleen;
|
||||
|
||||
/**
|
||||
* @struct Devis
|
||||
* @brief Structure representing a quote or bid for a work.
|
||||
*/
|
||||
typedef struct {
|
||||
char *nomE; /**< Name of the company. */
|
||||
char *adresse; /**< Address of the company. */
|
||||
int capital; /**< Capital of the company. */
|
||||
int duree; /**< Duration of the work. */
|
||||
int prix; /**< Price proposed for the work. */
|
||||
} Devis;
|
||||
|
||||
typedef struct maillonDevis
|
||||
{
|
||||
Devis dev;
|
||||
struct maillonDevis *suiv;
|
||||
/**
|
||||
* @struct MaillonDevis
|
||||
* @brief Node structure representing a quote in the list of quotes.
|
||||
*/
|
||||
typedef struct maillonDevis {
|
||||
Devis dev; /**< Information about the quote. */
|
||||
struct maillonDevis *suiv; /**< Pointer to the next quote in the list. */
|
||||
} MaillonDevis, *ListeDevis;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char travaux[30];
|
||||
ListeDevis ldevis;
|
||||
/**
|
||||
* @struct Offre
|
||||
* @brief Structure representing a work offer.
|
||||
*/
|
||||
typedef struct {
|
||||
char travaux[30]; /**< Type of work. */
|
||||
ListeDevis ldevis; /**< List of quotes for the work. */
|
||||
} Offre;
|
||||
|
||||
typedef enum {
|
||||
false, true
|
||||
} Booleen;
|
||||
|
||||
typedef struct maillonSucc
|
||||
{
|
||||
char tache[20];
|
||||
struct maillonSucc *nxt;
|
||||
/**
|
||||
* @struct MaillonSucc
|
||||
* @brief Node structure representing a successor in the list of successors.
|
||||
*/
|
||||
typedef struct maillonSucc {
|
||||
char tache[20]; /**< Task name. */
|
||||
struct maillonSucc *nxt; /**< Pointer to the next successor in the list. */
|
||||
} MaillonSucc, *Liste;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char tache[20];
|
||||
int duree;
|
||||
int nbPred;
|
||||
Liste succ;
|
||||
int dateDebut;
|
||||
Booleen traite;
|
||||
/**
|
||||
* @struct Tache
|
||||
* @brief Structure representing a task in the project.
|
||||
*/
|
||||
typedef struct {
|
||||
char tache[20]; /**< Task name. */
|
||||
int duree; /**< Duration of the task. */
|
||||
int nbPred; /**< Number of predecessors. */
|
||||
Liste succ; /**< List of successors. */
|
||||
int dateDebut; /**< Start date of the task. */
|
||||
Booleen traite; /**< Boolean flag indicating whether the task has been processed. */
|
||||
} Tache;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char travauxPrec[30];
|
||||
char travauxSucc[30];
|
||||
/**
|
||||
* @struct Precedence
|
||||
* @brief Structure representing a precedence relationship between two works.
|
||||
*/
|
||||
typedef struct {
|
||||
char travauxPrec[30]; /**< Type of preceding work. */
|
||||
char travauxSucc[30]; /**< Type of succeeding work. */
|
||||
} Precedence;
|
||||
|
||||
/**
|
||||
* @struct ListeAttente
|
||||
* @brief Structure representing a queue for tasks waiting to be processed.
|
||||
*/
|
||||
typedef struct fileAtt {
|
||||
Tache *tab[TMAXTRAV];
|
||||
int debut;
|
||||
int fin;
|
||||
} ListeAttente;
|
||||
Tache *tab[TMAXTRAV]; /**< Array to store tasks. */
|
||||
int debut; /**< Front of the queue. */
|
||||
int fin; /**< Rear of the queue. */
|
||||
} ListeAttente;
|
||||
|
@ -1,34 +1,55 @@
|
||||
/**
|
||||
* @file main.c
|
||||
* @brief Fichier principal du programme, contenant la fonction main et la fonction de traçage.
|
||||
*/
|
||||
|
||||
#include "../includes/main.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
/**
|
||||
* @brief Fonction principale du programme.
|
||||
* @return 0 en cas de succès.
|
||||
*/
|
||||
int main() {
|
||||
// Initialisation des variables
|
||||
Precedence *tabP;
|
||||
Offre **tabTravaux;
|
||||
Tache **tabTaches;
|
||||
int p_tmax;
|
||||
int p_tlog;
|
||||
|
||||
// Chargement des offres
|
||||
tabTravaux = loadOffre();
|
||||
|
||||
// Traitement minimal des travaux
|
||||
minTravaux(tabTravaux);
|
||||
|
||||
// Chargement des précédences
|
||||
tabP = loadPrec(&p_tmax, &p_tlog);
|
||||
|
||||
// Affichage des précédences
|
||||
displayPrecedences(tabP, p_tlog);
|
||||
|
||||
// Chargement des tâches
|
||||
tabTaches = loadTaches(tabTravaux);
|
||||
|
||||
// Traitement des tâches
|
||||
traiterTaches(tabTaches);
|
||||
|
||||
// Tri fusion des tâches
|
||||
triFusion(tabTaches, TMAXTRAV);
|
||||
|
||||
// Affichage des tâches triées
|
||||
afficherTachesTriees(tabTaches, TMAXTRAV);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void trace(char str[])
|
||||
{
|
||||
/**
|
||||
* @brief Affiche une trace si la constante TRACE est définie.
|
||||
* @param str Chaîne de caractères à afficher en tant que trace.
|
||||
*/
|
||||
void trace(char str[]) {
|
||||
// Vérification de la constante TRACE
|
||||
if(TRACE)
|
||||
printf("\n*-*-* %s *-*-*\n", str);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue