/////////////////////////////////////////////////////////// // Softwarebauelemente I, Aufgabe M6.5. // // author: Stephan Brumme // last changes: January 07, 2001 #ifndef __MHOUSEADT_H__ #define __MHOUSEADT_H__ // we need the CEDL-types Ordinal, ... #include "PrimitiveTypes.h" // import MDate #include "MDate.h" // import MRoom #include "MRoom.h" namespace MHouseADT { // first the abstract data type typedef void* UHouseADT; // open namespaces MRoom and MDate using namespace MRoom; using namespace MDate; // max. number of rooms in a HouseADT const Ordinal ROOMS = 20; // array of pointers containing the rooms typedef TRoom TArrayOfRooms[ROOMS]; // constructs a HouseADT void NewHouseADT(UHouseADT* HouseADT); // destructs a HouseADT void DeleteHouseADT(UHouseADT* HouseADT); // initializes the UHouseADT structure void Init(UHouseADT HouseADT); // compares two exemplars // returns "true" if attributes of both are equal; "false" otherwise Boolean EqualValue(UHouseADT HouseADT1, UHouseADT HouseADT2); // copies the attributes of HouseADT2 // returns "true" if successful, "false" if no memory allocated Boolean Copy(UHouseADT HouseADT1, UHouseADT HouseADT2); // retrieve date of foundation TDate GetDateOfFoundation(UHouseADT HouseADT); // get number of rooms Ordinal Card(UHouseADT HouseADT); // add a new room to a HouseADT Boolean Insert(UHouseADT HouseADT, const TRoom& room); // returns the first room of a HouseADT Boolean GetFirst(UHouseADT HouseADT, TRoom& room); // returns the last room of a HouseADT Boolean GetNext(UHouseADT HouseADT, TRoom& room); // looks for a given room and sets cursor, if possible Boolean Find(UHouseADT HouseADT, const TRoom& room); // returns the room the cursors points to Boolean GetCurrent(UHouseADT HouseADT, TRoom& room); // deletes the room the cursor points to Boolean Scratch(UHouseADT HouseADT); // displays the attributes void Show(UHouseADT HouseADT); }; #endif