2018-06-18 13:51:48 +00:00
|
|
|
//
|
|
|
|
// Created by Antoine Bartuccio on 18/06/2018.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef LO41_PASSENGER_H
|
|
|
|
#define LO41_PASSENGER_H
|
|
|
|
|
|
|
|
#include "../Resident/Resident.h"
|
|
|
|
#include "../Visitor/Visitor.h"
|
2018-06-20 17:36:00 +00:00
|
|
|
#include <string.h>
|
2018-06-18 13:51:48 +00:00
|
|
|
|
|
|
|
typedef enum {RESIDENT, VISITOR} PASSENGER_TYPE;
|
|
|
|
|
2018-06-20 16:19:49 +00:00
|
|
|
typedef struct o_Passenger {
|
2018-06-18 13:51:48 +00:00
|
|
|
PASSENGER_TYPE type;
|
2018-06-18 14:09:28 +00:00
|
|
|
union {
|
|
|
|
Resident * resident;
|
|
|
|
Visitor * visitor;
|
|
|
|
};
|
2018-06-20 16:19:49 +00:00
|
|
|
|
|
|
|
PUBLIC char * (*get_name)(_THIS(Passenger));
|
|
|
|
PUBLIC int (*get_id)(_THIS(Passenger));
|
2018-06-20 20:06:45 +00:00
|
|
|
PUBLIC int (*get_destination)(_THIS(Passenger));
|
2018-06-20 16:19:49 +00:00
|
|
|
PUBLIC void * (*runnable)(void* void_this);
|
2018-06-20 17:36:00 +00:00
|
|
|
PUBLIC int (*compare)(void * passenger1, void * passenger2);//yeah I know, but i needed int (*) (void*, void*)
|
2018-06-20 16:19:49 +00:00
|
|
|
|
|
|
|
DESTRUCTOR(Passenger);
|
2018-06-18 14:09:28 +00:00
|
|
|
} Passenger;
|
2018-06-18 13:51:48 +00:00
|
|
|
|
2018-06-20 17:36:00 +00:00
|
|
|
Passenger *_init_Passenger(void* passenger_data, PASSENGER_TYPE type);
|
2018-06-20 16:19:49 +00:00
|
|
|
|
2018-06-18 13:51:48 +00:00
|
|
|
#endif //LO41_PASSENGER_H
|