1
0
mirror of https://gitlab.com/klmp200/LO41.git synced 2025-07-11 20:29:24 +00:00

Les premières méthodes synchronisées

This commit is contained in:
2018-06-07 22:04:30 +02:00
parent 027f2bcc15
commit 44ddb79df8
7 changed files with 113 additions and 11 deletions

View File

@ -8,8 +8,6 @@
#define LINE_BUFFER 256
GETTER(Building, Elevator **, elevators)
void remove_end_char(char * string, char character){
size_t string_size = strlen(string);
if (string[string_size - 1] == character)
@ -110,6 +108,7 @@ void _free__Building(THIS(Building)){
Building *_init_Building(char * residents_file, char * visitors_file){
Building * new_building = malloc_or_die(sizeof(Building));
char elevator_name[] = "@";
int i;
new_building->floors = FLOORS;
@ -117,13 +116,14 @@ Building *_init_Building(char * residents_file, char * visitors_file){
new_building->residents = NEW(List);
new_building->visitors = NEW(List);
new_building->box = NEW(CommunicationBox);
for (i=0; i<ELEVATOR_NB; i++)
new_building->elevators[i] = NEW(Elevator);
for (i=0; i<ELEVATOR_NB; i++) {
elevator_name[0]++;
new_building->elevators[i] = NEW(Elevator, elevator_name);
}
LINK_ALL(Building, new_building,
get_elevators,
parse_residents,
parse_visitors
)

View File

@ -20,7 +20,6 @@ typedef struct o_Building {
CommunicationBox * box;
Elevator ** elevators;
SYNCHRONIZE Elevator ** (*get_elevators)(_THIS(Building));
PRIVATE void (*parse_residents)(_THIS(Building), char * file);
PRIVATE void (*parse_visitors)(_THIS(Building), char * file);