00001
#if !defined(__MAZEBUILDERFACTORY_HPP)
00002
#define __MAZEBUILDERFACTORY_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
00046
00047
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
00077
00078
00080
00081 MazeBuilderFactory(
void );
00082
00084
00085 MazeBuilderFactory( MazeBuilderFactoryCref );
00086
00088
00089
virtual ~MazeBuilderFactory(
void );
00090
00091
00092
00093
00094
00096
00097 MazeBuilderFactoryRef
operator=( MazeBuilderFactoryCref )
00098 throw(CORELINUX(Exception));
00099
00101
00102
bool operator==( MazeBuilderFactoryCref ) const;
00103
00104
00105
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
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
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
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
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
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253