Changeset 281
- Timestamp:
- Dec 10, 2002, 8:10:49 PM (18 years ago)
- Location:
- to-imperative/trunk/libp++
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
to-imperative/trunk/libp++/pxx_allocator.hh
r277 r281 30 30 { 31 31 32 #define ALLOCATOR_HAS_GET_REAL_SIZE 0x0001 33 #define ALLOCATOR_HAS_GET_BLOCK 0x0002 34 #define ALLOCATOR_HAS_GET_BLOCK_WITH_SIZE 0x0004 35 32 36 // 33 37 // Generic allocator interface … … 36 40 37 41 protected: 42 // 43 // Allocator features 44 unsigned features ; 45 // 38 46 NO_COPY_CTOR(Allocator) 39 47 NO_ASSIGN(Allocator) … … 43 51 // 44 52 // Constructor 45 Allocator ( ) {}53 Allocator (unsigned _features = 0) : features (_features) {} 46 54 // 47 55 // Virtual destructor … … 67 75 // The same as previous, but using block size 68 76 virtual void* get_block (void* _ptr, size_t _size) = 0 ; 77 // 78 // Get allocator features 79 unsigned get_features () const { return features; } 69 80 70 81 }; -
to-imperative/trunk/libp++/pxx_default_allocator.ih
r277 r281 90 90 inline void DefaultAllocator::set (Allocator& _allocator) 91 91 { 92 if (allocator == null) 92 if (allocator == null) { 93 93 allocator = &_allocator; 94 else if (allocator == &default_malloc_allocator) 94 features = _allocator.get_features(); 95 } else if (allocator == &default_malloc_allocator) 95 96 FATAL("Default malloc allocator already was used"); 96 97 else -
to-imperative/trunk/libp++/pxx_heap_allocator.cc
r272 r281 41 41 int _fd /* = -1 */ 42 42 ) : 43 Allocator ( 44 ALLOCATOR_HAS_GET_REAL_SIZE | 45 ALLOCATOR_HAS_GET_BLOCK | ALLOCATOR_HAS_GET_BLOCK_WITH_SIZE 46 ), 43 47 Heap (_init_size, _max_size, _start, _fd) 44 48 {
Note: See TracChangeset
for help on using the changeset viewer.