00001
#if !defined(__MAZEFACTORY_HPP)
00002
#define __MAZEFACTORY_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
#if !defined(__DOOR_HPP)
00046
#include <Door.hpp>
00047
#endif
00048
00049
#if !defined(__ROOM_HPP)
00050
#include <Room.hpp>
00051
#endif
00052
00053
#if !defined(__WALL_HPP)
00054
#include <Wall.hpp>
00055
#endif
00056
00057
00058
00059
00060
00061
00062
00063 CORELINUX_MAP(
00064 NameIdentifier,
00065 CORELINUX(
AllocatorPtr),
00066 less<NameIdentifier>,
00067 NamedAllocators
00068 );
00069
00070
00080 DECLARE_CLASS( MazeFactory );
00081
00082
class MazeFactory :
protected CORELINUX(AbstractFactory<NameIdentifier>)
00083 {
00084
public:
00085
00086
00087
00088
00089
00091
00092 MazeFactory(
void );
00093
00095
00096 MazeFactory( MazeFactoryCref );
00097
00099
00100
virtual ~MazeFactory(
void );
00101
00102
00103
00104
00105
00107
00108 MazeFactoryRef
operator=( MazeFactoryCref )
00109 throw(CORELINUX(Exception));
00110
00112
00113
bool operator==( MazeFactoryCref ) const;
00114
00115
00116
00117
00118
00120
00121 CORELINUX(Count) getAllocatorCount(
void ) const;
00122
00124
00125 CORELINUX(Count) getTotalAllocates(
void ) const;
00126
00128
00129 CORELINUX(Count) getTotalDeallocates(
void ) const;
00130
00131
00132
00133
00134
00136
00137 virtual
RoomPtr createRoom( RoomNumberCref ) const
00138 throw(CORELINUX(AllocatorNotFoundException));
00139
00141
00142 virtual
WallPtr createWall(
void ) const
00143 throw(CORELINUX(AllocatorNotFoundException));
00144
00146
00147 virtual
DoorPtr createDoor(
RoomPtr, RoomPtr ) const
00148 throw(CORELINUX(AllocatorNotFoundException));
00149
00151
00152 virtual
void destroyRoom( RoomPtr ) const
00153 throw(CORELINUX(AllocatorNotFoundException));
00154
00156
00157 virtual
void destroyWall(
WallPtr ) const
00158 throw(CORELINUX(AllocatorNotFoundException));
00159
00161
00162 virtual
void destroyDoor(
DoorPtr ) const
00163 throw(CORELINUX(AllocatorNotFoundException));
00164
00165
00166 protected:
00167
00168
00169
00170
00171
00173
00174 virtual CORELINUX(Count) getCreateCount(
void ) const;
00175
00177
00178 virtual CORELINUX(Count) getDestroyCount(
void ) const;
00179
00181
00182 virtual CORELINUX(
AllocatorPtr) getAllocator( NameIdentifier ) const
00183 throw(CORELINUX(AllocatorNotFoundException));
00184
00185
00186
00187
00188
00190
00191 virtual
void addAllocator( NameIdentifier, CORELINUX(
AllocatorPtr) )
00192 throw(CORELINUX(AllocatorAlreadyExistsException));
00193
00196
00197 virtual CORELINUX(
AllocatorPtr) removeAllocator( NameIdentifier )
00198 throw(CORELINUX(AllocatorNotFoundException));
00199
00200
00201
00208 virtual CORELINUX(Iterator<corelinux::
AllocatorPtr>)* createIterator(
void ) const;
00209
00215 virtual
void destroyIterator( CORELINUX(Iterator<corelinux::
AllocatorPtr>)* ) const;
00216
00224 virtual corelinux::AssociativeIterator<NameIdentifier,corelinux::
AllocatorPtr>*
00225 createAssociativeIterator(
void ) const;
00226
00233 virtual
void destroyAssociativeIterator
00234 (
00235 corelinux::AssociativeIterator<NameIdentifier,corelinux::
AllocatorPtr>*
00236 ) const;
00237
00238
00239 protected:
00240
00242
00243
void flushAllocators(
void );
00244
00245 private:
00246
00247 NamedAllocators theAllocators;
00248 };
00249
00250 #endif
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260