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

MazeBuilderFactory.hpp

00001 #if !defined(__MAZEBUILDERFACTORY_HPP) 00002 #define __MAZEBUILDERFACTORY_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(__ABSTRACTFACTORY_HPP) 00030 #include <AbstractFactory.hpp> 00031 #endif 00032 00033 #if !defined(__ALLOCATOR_HPP) 00034 #include <Allocator.hpp> 00035 #endif 00036 00037 #if !defined(__MAP_HPP) 00038 #include <Map.hpp> 00039 #endif 00040 00041 #if !defined(__NAMEIDENTIFIER_HPP) 00042 #include <NameIdentifier.hpp> 00043 #endif 00044 00045 // 00046 // We use a map for storing our allocators. We could have fire-walled this 00047 // as well. 00048 // 00049 00050 CORELINUX_MAP( 00051 NameIdentifier, 00052 CORELINUX(AllocatorPtr), 00053 less<NameIdentifier>, 00054 NamedAllocators 00055 ); 00056 00057 00058 DECLARE_CLASS( MapSite ); 00059 00069 DECLARE_CLASS( MazeBuilderFactory ); 00070 00071 class MazeBuilderFactory : protected CORELINUX(AbstractFactory<NameIdentifier>) 00072 { 00073 public: 00074 00075 // 00076 // Constructors and destructor 00077 // 00078 00080 00081 MazeBuilderFactory( void ); 00082 00084 00085 MazeBuilderFactory( MazeBuilderFactoryCref ); 00086 00088 00089 virtual ~MazeBuilderFactory( void ); 00090 00091 // 00092 // Operator overloads 00093 // 00094 00096 00097 MazeBuilderFactoryRef operator=( MazeBuilderFactoryCref ) 00098 throw(CORELINUX(Exception)); 00099 00101 00102 bool operator==( MazeBuilderFactoryCref ) const; 00103 00104 // 00105 // Accessors 00106 // 00107 00109 00110 CORELINUX(Count) getAllocatorCount( void ) const; 00111 00113 00114 CORELINUX(Count) getTotalAllocates( void ) const; 00115 00117 00118 CORELINUX(Count) getTotalDeallocates( void ) const; 00119 00121 00122 static NameIdentifierCref getRoomIdentifier( void ); 00123 00125 00126 static NameIdentifierCref getDoorIdentifier( void ); 00127 00129 00130 static NameIdentifierCref getWallIdentifier( void ); 00131 00132 // 00133 // Factory methods 00134 // 00135 00137 00138 virtual MapSitePtr createPart( NameIdentifierRef ) const 00139 throw(CORELINUX(AllocatorNotFoundException)); 00140 00142 00143 virtual void destroyPart( NameIdentifierRef, MapSitePtr ) const 00144 throw(CORELINUX(AllocatorNotFoundException)); 00145 00147 00148 virtual CORELINUX(AllocatorPtr) setAllocator 00149 ( 00150 NameIdentifierRef, 00151 CORELINUX(AllocatorPtr) 00152 ); 00153 00154 protected: 00155 00156 // 00157 // Accessors overriden from AbstractFactory 00158 // 00159 00161 00162 virtual CORELINUX(Count) getCreateCount( void ) const; 00163 00165 00166 virtual CORELINUX(Count) getDestroyCount( void ) const; 00167 00169 00170 virtual CORELINUX(AllocatorPtr) getAllocator( NameIdentifier ) const 00171 throw(CORELINUX(AllocatorNotFoundException)); 00172 00173 // 00174 // Mutators overriden from AbstractFactory 00175 // 00176 00178 00179 virtual void addAllocator( NameIdentifier, CORELINUX(AllocatorPtr) ) 00180 throw(CORELINUX(AllocatorAlreadyExistsException)); 00181 00184 00185 virtual CORELINUX(AllocatorPtr) removeAllocator( NameIdentifier ) 00186 throw(CORELINUX(AllocatorNotFoundException)); 00187 // 00188 // Overides Iterator factory methods from AbstractFactory 00189 // 00196 virtual CORELINUX(Iterator<corelinux::AllocatorPtr>)* createIterator( void ) const; 00197 00203 virtual void destroyIterator( CORELINUX(Iterator<corelinux::AllocatorPtr>)* ) const; 00204 00212 virtual corelinux::AssociativeIterator<NameIdentifier,corelinux::AllocatorPtr>* 00213 createAssociativeIterator( void ) const; 00214 00221 virtual void destroyAssociativeIterator 00222 ( 00223 corelinux::AssociativeIterator<NameIdentifier,corelinux::AllocatorPtr>* 00224 ) const; 00225 00226 00227 protected: 00228 00230 00231 void flushAllocators( void ); 00232 00233 private: 00234 00235 static NameIdentifier theRoomIdentifier; 00236 static NameIdentifier theDoorIdentifier; 00237 static NameIdentifier theWallIdentifier; 00238 00239 NamedAllocators theAllocators; 00240 00241 }; 00242 00243 #endif // if !defined(__MAZEBUILDERFACTORY_HPP) 00244 00245 /* 00246 Common rcs information do not modify 00247 $Author: prudhomm $ 00248 $Revision: 1.2 $ 00249 $Date: 2000/08/31 22:50:31 $ 00250 $Locker: $ 00251 */ 00252 00253

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