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 // first the abstract data type
22 typedef void* UHouseADT;
23
24
25 // open namespaces MRoom and MDate
26 using namespace MRoom;
27 using namespace MDate;
28
29 // max. number of rooms in a HouseADT
30 const Ordinal ROOMS = 20;
31
32 // array of pointers containing the rooms
33 typedef TRoom TArrayOfRooms[ROOMS];
34
35 // constructs a HouseADT
36 void NewHouseADT(UHouseADT* HouseADT);
37
38 // destructs a HouseADT
39 void DeleteHouseADT(UHouseADT* HouseADT);
40
41 // initializes the UHouseADT structure
42 void Init(UHouseADT HouseADT);
43
44 // compares two exemplars
45 // returns "true" if attributes of both are equal; "false" otherwise
46 Boolean EqualValue(UHouseADT HouseADT1, UHouseADT HouseADT2);
47
48 // copies the attributes of HouseADT2
49 // returns "true" if successful, "false" if no memory allocated
50 Boolean Copy(UHouseADT HouseADT1, UHouseADT HouseADT2);
51
52 // retrieve date of foundation
53 TDate GetDateOfFoundation(UHouseADT HouseADT);
54
55 // get number of rooms
56 Ordinal Card(UHouseADT HouseADT);
57
58 // add a new room to a HouseADT
59 Boolean Insert(UHouseADT HouseADT, const TRoom& room);
60
61 // returns the first room of a HouseADT
62 Boolean GetFirst(UHouseADT HouseADT, TRoom& room);
63
64 // returns the last room of a HouseADT
65 Boolean GetNext(UHouseADT HouseADT, TRoom& room);
66
67 // looks for a given room and sets cursor, if possible
68 Boolean Find(UHouseADT HouseADT, const TRoom& room);
69
70 // returns the room the cursors points to
71 Boolean GetCurrent(UHouseADT HouseADT, TRoom& room);
72
73 // deletes the room the cursor points to
74 Boolean Scratch(UHouseADT HouseADT);
75
76 // displays the attributes
77 void Show(UHouseADT HouseADT);
78 };
79
80 #endif
81