module com {
module wiley {
module compbooks {
module brose {
module chapter8 {
module roomBooking {

    interface Meeting {
    
        // A meeting has two read-only attributes which describes
        // the purpose and the participants of that meeting.
    
        readonly attribute string purpose;
        readonly attribute string participants;

        oneway void destroy();
    };
    
    interface MeetingFactory {
    
        // A meeting factory creates meeting objects.
    
        Meeting createMeeting( in string purpose, in string participants);
    };
    
    interface Room {
    
        // A Room provides operations to view, make and cancel bookings.
        // Making a booking means associating a meeting with a time-slot
        // (for this particular room).
    
        // Meetings can be held between the usual business hours.
        // For the sake of simplity there are 8 slots at which meetings
        // can take place.
    
        enum Slot { am9, am10, am11, pm12, pm1, pm2, pm3, pm4 };

        // since IDL does not provide means to determine the cardinality
        // of an enum, a corresponding constant MaxSlots is defined.
    
        const short MaxSlots = 8;
    
        // Meetings associates all meetings (of a day) with time slots
        // for a room.
    
        typedef Meeting Meetings[ MaxSlots ];
    
        exception NoMeetingInThisSlot {};
        exception SlotAlreadyTaken {};
    
        // The attribute name names a room.
    
        readonly attribute string name;
    
        // view returns the bookings of a room.
        // For simplicity, the implementation handles only bookings
        // for one day.
    
        Meetings view ();
    
        void book( in Slot a_slot, in Meeting  a_meeting )
            raises(SlotAlreadyTaken);
    
        void cancelBooking( in Slot  a_slot )
            raises(NoMeetingInThisSlot);
    };
}; }; }; }; }; };
