mirror of
				https://gitlab.com/klmp200/LO41.git
				synced 2025-11-04 11:13:06 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			689 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			689 B
		
	
	
	
		
			C
		
	
	
	
	
	
//
 | 
						|
// Created by Antoine Bartuccio on 05/06/2018.
 | 
						|
//
 | 
						|
 | 
						|
#ifndef LO41_ELEVATOR_H
 | 
						|
#define LO41_ELEVATOR_H
 | 
						|
 | 
						|
#include <pthread.h>
 | 
						|
#include "../Objects.h"
 | 
						|
#include "../List/List.h"
 | 
						|
 | 
						|
#define MAX_ELEVATOR_CAPACITY 10
 | 
						|
 | 
						|
typedef enum {running, waiting, sleeping} ELEVATOR_STATE;
 | 
						|
 | 
						|
typedef struct o_Elevator {
 | 
						|
	PRIVATE ELEVATOR_STATE state;
 | 
						|
	PRIVATE List * passenger_ids;
 | 
						|
	PRIVATE char * name;
 | 
						|
	PRIVATE pthread_mutex_t passenger_mutex;
 | 
						|
 | 
						|
	SYNCHRONIZE PUBLIC int (*get_number_of_passengers)(_THIS(Elevator));
 | 
						|
	SYNCHRONIZE PUBLIC int (*can_get_more_passengers)(_THIS(Elevator));
 | 
						|
	DESTRUCTOR(Elevator);
 | 
						|
} Elevator;
 | 
						|
 | 
						|
FRIENDLY(state, Building)
 | 
						|
 | 
						|
Elevator *_init_Elevator(char* name);
 | 
						|
 | 
						|
#endif //LO41_ELEVATOR_H
 |