-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroom.h
More file actions
122 lines (103 loc) · 2.97 KB
/
room.h
File metadata and controls
122 lines (103 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* room.h
*
* Created on: May 30, 2017
* Author: master
*/
#ifndef ROOM_H_
#define ROOM_H_
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include "set.h"
#include "mtm_ex3.h"
#include "common.h"
typedef struct room_t{
char* email;
int id;
TechnionFaculty faculty;
int price;
int num_ppl;
int from_hrs, to_hrs;
int difficulty;
} *Room;
typedef int SetKey;
typedef int(*RecommendSetElement)(SetElement, SetKey, SetKey);
/* copy escaper function
* @param
* escaper - a new escaper object that same to the original *
* @return
* escaper - copy of the escaper if success
* NULL - otherwise (memory leak)
*/
SetElement copyRoom(SetElement room);
/* free room function
* @param
* room - a room to free
*/
void freeRoom(SetElement room);
/* compare two rooms function
* @param
* room1 - first of the rooms to compare
* room2 - second of the rooms to compare
* @return
* 0 - room1 equal to room2 (email)
* 1 - room1 higher than room2 (email)
* -1 - room2 higher than room1 (email)
*/
int compareRooms(const SetElement room1, const SetElement room2);
/* create a new room function
* @param
* room - a new room object that will be initialized
* email - email of the room's company
* id - id of the room
* faculty - faculty of the room
* price - price of the room
* num_ppl - recommended number of people
* from - from open hour
* to - to open hour
* difficulty - difficulty of the room
* @return
* MTM_OUT_OF_MEMORY - out of memory
* MTM_INVALID_PARAMETER - if one of the parameters invalid
* MTM_SUCCESS - company created
*/
MtmErrorCode initRoom(Room newRoom, const char* email, int id, int faculty, int price, int num_ppl, int from, int to, int difficulty);
/* calculate the price of the order
* @param
* room - room that was ordered
* faculty - faculty of the escaper ordered the room
* num_ppl - number of people in the order
* @return
* price - total price of the order
* -1 - if room or faculty invalid
*/
int calculatePriceOfOrder(const Room room, TechnionFaculty escaperFaculty, int num_ppl);
/* return room fit meter by number of people and skill level(the lower the better)
* @param
* set_element - room to check
* num_ppl - number of people to compare to
* skill_level - skill level to compare to
* @return
* number - index of fit
*/
int filterByNumOfPplandDifficulty(const SetElement set_element, SetKey num_ppl, SetKey skill_level );
/* return room fit meter by nearest faculty (the lower the better)
* @param
* faculty - faculty to compare to
* junk - not used parameter
* @return
* number - index of fit
*/
int filterByNearFaculty(const SetElement set_element, SetKey faculty, SetKey junk );
/* return room fit meter by nearest id (the lower the better)
* @param
* faculty - faculty to compare to
* junk - not used parameter
* @return
* number - index of fit
*/
int filterByNearId(const SetElement set_element, SetKey id, SetKey junk );
#endif /* ROOM_H_ */