1 ///////////////////////////////////////////////////////////
2 // Softwarebauelemente I, Aufgabe M6.5.
3 //
4 // author: Stephan Brumme
5 // last changes: January 07, 2001
6
7
8 #ifndef __MHOUSEADT_H__
9 #define __MHOUSEADT_H__
10
11 // we need the CEDL-types Ordinal, ...
12 #include "PrimitiveTypes.h"
13
14 // import MDate
15 #include "MDate.h"
16 // import MRoom
17 #include "MRoom.h"
18
19
20 namespace MHouseADT
21 {
22 // first the abstract data type
23 typedef void* UHouseADT;
24
25
26 // open namespaces MRoom and MDate
27 using namespace MRoom;
28 using namespace MDate;
29
30 // max. number of rooms in a HouseADT
31 const Ordinal ROOMS = 20;
32
33 // array of pointers containing the rooms
34 typedef TRoom TArrayOfRooms[ROOMS];
35
36 // constructs a HouseADT
37 void NewHouseADT(UHouseADT* HouseADT);
38
39 // destructs a HouseADT
40 void DeleteHouseADT(UHouseADT* HouseADT);
41
42 // initializes the UHouseADT structure
43 void Init(UHouseADT HouseADT);
44
45 // compares two exemplars
46 // returns "true" if attributes of both are equal; "false" otherwise
47 Boolean EqualValue(UHouseADT HouseADT1, UHouseADT HouseADT2);
48
49 // copies the attributes of HouseADT2
50 // returns "true" if successful, "false" if no memory allocated
51 Boolean Copy(UHouseADT HouseADT1, UHouseADT HouseADT2);
52
53 // retrieve date of foundation
54 TDate GetDateOfFoundation(UHouseADT HouseADT);
55
56 // get number of rooms
57 Ordinal Card(UHouseADT HouseADT);
58
59 // add a new room to a HouseADT
60 Boolean Insert(UHouseADT HouseADT, const TRoom& room);
61
62 // returns the first room of a HouseADT
63 Boolean GetFirst(UHouseADT HouseADT, TRoom& room);
64
65 // returns the last room of a HouseADT
66 Boolean GetNext(UHouseADT HouseADT, TRoom& room);
67
68 // looks for a given room and sets cursor, if possible
69 Boolean Find(UHouseADT HouseADT, const TRoom& room);
70
71 // returns the room the cursors points to
72 Boolean GetCurrent(UHouseADT HouseADT, TRoom& room);
73
74 // deletes the room the cursor points to
75 Boolean Scratch(UHouseADT HouseADT);
76
77 // displays the attributes
78 void Show(UHouseADT HouseADT);
79 };
80
81 #endif
82