/////////////////////////////////////////////////////////// // Softwarebauelemente I, Aufgabe M6.2. // // author: Stephan Brumme // last changes: December 29, 2000 #ifndef __MHOUSE_H__ #define __MHOUSE_H__ // we need the CEDL-types Ordinal, ... #include "PrimitiveTypes.h" // import MDate #include "MDate.h" // import MRoom #include "MRoom.h" namespace MHouse { // open namespaces MRoom and MDate using namespace MRoom; using namespace MDate; // max. number of rooms in a house const Ordinal ROOMS = 20; // array of pointers containing the housems typedef TRoom TArrayOfRooms[ROOMS]; // data struct THouse for a single house typedef struct { TDate DateOfFoundation; Ordinal Count; Ordinal Cursor; TArrayOfRooms PSet; } THouse; // initializes the THouse structure void Init(THouse &house); // compares two exemplars // returns "true" if attributes of both are equal; "false" otherwise Boolean EqualValue(const THouse& house1, const THouse& house2); // copies the attributes of house2 // returns "true" if successful, "false" if no memory allocated Boolean Copy(THouse& house1, const THouse& house2); // retrieve date of foundation TDate GetDateOfFoundation(const THouse& house); // get number of rooms Ordinal Card(const THouse& house); // add a new room to a house Boolean Insert(THouse& house, const TRoom& room); // returns the first room of a house Boolean GetFirst(THouse& house, TRoom& room); // returns the last room of a house Boolean GetNext(THouse& house, TRoom& room); // looks for a given room and sets cursor, if possible Boolean Find(THouse& house, const TRoom& room); // returns the room the cursors points to Boolean GetCurrent(const THouse& house, TRoom& room); // deletes the room the cursor points to Boolean Scratch(THouse& house); // displays the attributes void Show(THouse house); }; #endif