use case diagram

This commit is contained in:
Debucquoy 2023-11-17 16:10:39 +01:00
parent 3b2f4c84d7
commit c4e193e45f
Signed by: tonitch
GPG Key ID: A78D6421F083D42E
7 changed files with 178 additions and 2 deletions

View File

@ -2,7 +2,10 @@
CC = gcc CC = gcc
CFLAGS = -g -Wall CFLAGS = -g -Wall
all: ex1 ex2 ex3 ex4 ex5 all: ex1 ex2 ex3 ex4 ex5 ex6 ex7 group
group: group.o mergeSort.o
$(CC) $(CFLAGS) -o $@ $+
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
@ -16,7 +19,7 @@ clean:
mrproper: clean mrproper: clean
rm -f ex1 rm -f ex1
run: ex6 run: group
./$< ./$<
graph: run graph: run

6
bac2/os/chap3/ex7.c Normal file
View File

@ -0,0 +1,6 @@
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
}

23
bac2/os/chap3/group.c Normal file
View File

@ -0,0 +1,23 @@
#include "mergeSort.h"
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define printlist(s, x) printf("%s = [", #x); for (int i = 0; i < s; ++i) { printf("%d, ", x[i]); } printf("\b\b]\n");
#define listSize 10000000
int list[listSize];
int main(void)
{
srand(time(NULL));
for (int i = 0; i < listSize; ++i) {
list[i] = rand();
}
/* printlist(listSize, list); */
margs_t args = {list, 0, 9};
merge_sort(&args);
printlist(listSize, list);
}

58
bac2/os/chap3/mergeSort.c Normal file
View File

@ -0,0 +1,58 @@
#include "mergeSort.h"
#include <stdlib.h>
#include <assert.h>
#include <pthread.h>
#define THREADS
pthread_t threads[THREADS];
void* merge_sort(void* args) {
margs_t* f = (margs_t*) args;
if(f->start < f->final) {
pthread_t t1, t2;
index middle = (f->start + f->final) / 2;
margs_t args1 = {f->array, f->start, middle};
assert(!pthread_create(&t1, NULL, merge_sort, (void*) &args1));
margs_t args2 = {f->array, middle+1, f->final};
assert(!pthread_create(&t2, NULL, merge_sort, (void*) &args2));
assert(pthread_join(t1, NULL));
assert(pthread_join(t2, NULL));
merge(f->array, f->start, middle, f->final);
}
int *ret = 0;
return ret;
}
void merge(int array[], index start, index middle, index final) {
length countL = middle - start + 1;
int *arrayL = malloc(countL * sizeof(int));
for(index currentL = 0; currentL < countL; currentL ++)
arrayL[currentL] = array[start + currentL ];
length countR = final - middle;
int* arrayR = malloc(countR * sizeof(int));
for(index currentR = 0; currentR < countR; currentR ++)
arrayR[currentR] = array[middle + 1 + currentR ];
index currentL, currentR, current;
for(currentL = 0, currentR = 0, current = start;
current <= final && currentL < countL && currentR < countR;
current ++)
if(arrayL[currentL] <= arrayR[currentR])
array[current] = arrayL[currentL++];
else
array[current] = arrayR[currentR++];
while(currentR < countR)
array[current++] = arrayR[currentR++];
while(currentL < countL)
array[current++] = arrayL[currentL++];
free(arrayL);
free(arrayR);
}

15
bac2/os/chap3/mergeSort.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
typedef unsigned int index;
typedef unsigned int length;
typedef struct merge_args{
int* array;
index start;
index final;
} margs_t;
void merge(int array[], index start, index middle, index final);
/* void merge_sort(int array [], index start , index final ); */
void* merge_sort(void*);

View File

@ -0,0 +1,32 @@
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amsfonts, amssymb, amsthm}
\usepackage{tikz}
\author{Debucquoy Anthony}
\title{Extension messagerie}
\begin{document}
\section{Use case diagram}
\begin{center}
\resizebox{390pt}{!}{
\input{./use_case_messagerie.tex}
}
\end{center}
\subsection{Answer topic}
\subsection{Create discutions}
\subsubsection{Send messages}
\subsection{Ask apointment}
\subsubsection{Export to calendar}
\subsection{Manage apointment}
\subsubsection{Propose new apointment}
\subsection{Create forum}
\subsubsection{Post topics}
\subsubsection{Post poll}
\end{document}

View File

@ -0,0 +1,39 @@
@startuml
left to right direction
:Student: as s
:Teacher: as t
package "Messagerie"{
(Answer topics) as at
(Ask apointement) as aa
(Create Discution) as cd
(Create Forum) as cf
(Manage apointement) as ma
s -- at
s -- aa
s -- cd
t -- cd
t -- cf
t -- ma
(Export to calendar) as etc
aa <-- etc : << extend >>
ma <-- etc : << extend >>
(Post topics) as pt
cf <-- pt : << include >>
pt <|-- (Post poll)
cd <-- (Send messages) : << include >>
ma <-- (Propose new appointment) : << exlude>> \n [refuse]
}
@enduml