CoreLinux++  0.4.32
Allocator.hpp
1 #if !defined(__ALLOCATOR_HPP)
2 #define __ALLOCATOR_HPP
3 
4 /*
5  CoreLinux++
6  Copyright (C) 1999,2000 CoreLinux Consortium
7 
8  The CoreLinux++ Library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12 
13  The CoreLinux++ Library Library is distributed in the hope that it will
14  be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public
19  License along with the GNU C Library; see the file COPYING.LIB. If not,
20  write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  Boston, MA 02111-1307, USA.
22 */
23 
24 #if !defined(__COMMON_HPP)
25 #include <Common.hpp>
26 #endif
27 
28 #if !defined(__STRATEGY_HPP)
29 #include <Strategy.hpp>
30 #endif
31 
32 namespace corelinux
33 {
34  DECLARE_CLASS( Allocator );
35 
43  class Allocator : public Strategy
44  {
45  public:
46 
47  //
48  // Constructors and destructor
49  //
50 
52 
53  Allocator( void );
54 
61 
63 
64  virtual ~Allocator( void );
65 
66  //
67  // Operator overloads
68  //
69 
77 
84  bool operator==( AllocatorCref ) const;
85 
86  //
87  // Accessors
88  //
89 
96  virtual CountCref getAllocateCount( void ) const;
97 
104  virtual CountCref getDeallocateCount( void ) const;
105 
106  //
107  // Mutators
108  //
109 
111 
112  virtual void incrementAllocates( void );
113 
115 
116  virtual void decrementAllocates( void );
117 
119 
120  virtual void incrementDeallocates( void );
121 
123 
124  virtual void decrementDeallocates( void );
125 
126  protected:
127 
128 
129  private:
130 
132 
133  Count theAllocates;
134 
136 
137  Count theDeallocates;
138 
139  };
140 
141 
142 }
143 
144 
145 #endif // if !defined(__ALLOCATOR_HPP)
146 
147 /*
148  Common rcs information do not modify
149  $Author: frankc $
150  $Revision: 1.2 $
151  $Date: 2000/05/13 12:32:21 $
152  $Locker: $
153 */
154 
155 
Allocator & operator=(AllocatorCref)
Assingment operator overload.
Definition: Allocator.cpp:72
virtual ~Allocator(void)
Virtual destructor.
Definition: Allocator.cpp:63
virtual void incrementDeallocates(void)
Increment the deallocates.
Definition: Allocator.cpp:122
virtual void incrementAllocates(void)
Increment the allocates.
Definition: Allocator.cpp:117
virtual void decrementAllocates(void)
Decrement the allocates.
Definition: Allocator.cpp:127
Allocator is a Strategy class used by AbstractAllocator and AbstractFactory.Each Allocator instance t...
Definition: Allocator.hpp:43
virtual CountCref getAllocateCount(void) const
Retrieves the number of allocations by this Allocator.
Definition: Allocator.cpp:99
Strategy is a base class for describing families of alogrithms.
Definition: Strategy.hpp:39
virtual void decrementDeallocates(void)
Decrement the deallocates.
Definition: Allocator.cpp:132
bool operator==(AllocatorCref) const
Equality operator overload.
Definition: Allocator.cpp:90
virtual CountCref getDeallocateCount(void) const
Retrieves the number of deallocations by this Allocator.
Definition: Allocator.cpp:108
Allocator(void)
Default constructor.
Definition: Allocator.cpp:37

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