Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

MazeBuilder.hpp

00001 #if   !defined(__MAZEBUILDER_HPP)
00002 #define  __MAZEBUILDER_HPP
00003 
00004 /*
00005   CoreLinux++ 
00006   Copyright (C) 2000 CoreLinux Consortium
00007   
00008    The CoreLinux++ Library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Library General Public License as
00010    published by the Free Software Foundation; either version 2 of the
00011    License, or (at your option) any later version.
00012 
00013    The CoreLinux++ Library Library is distributed in the hope that it will 
00014    be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Library General Public License for more details.
00017 
00018    You should have received a copy of the GNU Library General Public
00019    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00020    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00021    Boston, MA 02111-1307, USA.  
00022 */   
00023 
00024 
00025 #if   !defined(__COMMON_HPP)
00026 #include <Common.hpp>
00027 #endif
00028 
00029 #if   !defined(__BUILDER_HPP)
00030 #include <Builder.hpp>
00031 #endif
00032 
00033 #if   !defined(__MAP_HPP)
00034 #include <Map.hpp>
00035 #endif
00036 
00037 #if   !defined(__PAIR_HPP)
00038 #include <Pair.hpp>
00039 #endif
00040 
00041 #if   !defined(__NAMEIDENTIFIER_HPP)
00042 #include <NameIdentifier.hpp>
00043 #endif
00044 
00045 #if   !defined(__MAZE_HPP)
00046 #include <Maze.hpp>
00047 #endif
00048 
00049 #if   !defined(__ROOM_HPP)
00050 #include <Room.hpp>
00051 #endif
00052 
00053 
00054 //
00055 // We track the rooms here for construction as well
00056 // as a room to room door map
00057 //
00058 
00059 CORELINUX_PAIR( DoorPair, RoomNumber, RoomNumber );
00060 CORELINUX_MULTIMAP(  Direction,  DoorPair,  less<Direction> ,  SideMap );
00061 
00062 //
00063 // Forward class declarations
00064 //
00065 
00066 DECLARE_CLASS( MazeBuilderFactory );
00067 DECLARE_CLASS( MazeBuilder );
00068 
00078 class MazeBuilder : public corelinux::Builder<Maze,NameIdentifier>
00079 {
00080 public:
00081 
00082    //
00083    // Constructors and destructor
00084    //
00085 
00087 
00088                         MazeBuilder( MazeBuilderFactoryPtr );
00089 
00091 
00092                         MazeBuilder( MazeBuilderCref );
00093 
00095 
00096    virtual              ~MazeBuilder( void );
00097 
00098    //
00099    // Operator overload
00100    //
00101 
00103 
00104             bool  operator==( MazeBuilderCref aRef ) const;
00105 
00106 protected:
00107 
00108    //
00109    // Constructors
00110    //
00111 
00113 
00114                         MazeBuilder( void ) throw( CORELINUX(Assertion) );
00115 
00116    //
00117    // Operator overload
00118    //
00119 
00121 
00122             MazeBuilderRef operator=( MazeBuilderCref ) 
00123                               throw( CORELINUX(Assertion) );
00124 
00125    //
00126    // Accessors
00127    //
00128 
00130 
00131    virtual  SideMapCref  getSideMap( void ) const;
00132 
00133    //
00134    // Mutators
00135    //
00137 
00138    virtual  void        constructSideMap( void );
00139 
00141 
00142    virtual  void  createRooms( MazePtr ) const;
00143 
00146 
00147    virtual  void  connectRoomsWithDoors( MazePtr ) const;
00148 
00150 
00151    virtual  void  disconnectAndDestroyDoors( MazePtr ) const;
00152 
00153    //
00154    // Factory methods
00155    //
00156 
00158 
00159    virtual  MazePtr createProduct( void ) const;
00160 
00162 
00163    virtual  void  destroyProduct( MazePtr ) const ;
00164 
00165 private:
00166 
00167             SideMap  theSideMap;
00168 
00169 };
00170 
00171 #endif // if   !defined(__MAZEBUILDER_HPP)
00172 
00173 /*
00174    Common rcs information do not modify
00175    $Author: prudhomm $
00176    $Revision: 1.4 $
00177    $Date: 2000/08/31 22:50:31 $
00178    $Locker:  $
00179 */
00180 

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium