CoreLinux++  0.4.32
AbstractFactory.hpp
1 #if !defined(__ABSTRACTFACTORY_HPP)
2 #define __ABSTRACTFACTORY_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(__ALLOCATOR_HPP)
29 #include <Allocator.hpp>
30 #endif
31 
32 #if !defined(__ALLOCATORNOTFOUNDEXCEPTION_HPP)
33 #include <AllocatorNotFoundException.hpp>
34 #endif
35 
36 #if !defined(__ALLOCATORALREADYEXISTSEXCEPTION_HPP)
37 #include <AllocatorAlreadyExistsException.hpp>
38 #endif
39 
40 #if !defined(__ASSOCIATIVEITERATOR_HPP)
41 #include <AssociativeIterator.hpp>
42 #endif
43 
44 #if !defined(__ITERATOR_HPP)
45 #include <Iterator.hpp>
46 #endif
47 
48 namespace corelinux
49 {
50 
59  template< class UniqueId >
61  {
62 
63  public:
64 
65  //
66  // Constructors and Destructor
67  //
68 
70 
72  :
74  {
75  ; // do nothing
76  }
77 
84  :
86  {
87 
88  }
89 
91 
92  virtual ~AbstractFactory( void )
93  {
94  ; // do nothing
95  }
96 
97  //
98  // Operator overloads
99  //
100 
108  {
109  return ( *this );
110  }
111 
118  bool operator==( const AbstractFactory & aRef ) const
119  {
120  return( this == &aRef );
121  }
122 
123  //
124  // Pure virtual accessors
125  //
126 
133  virtual Count getCreateCount( void ) const = 0;
134 
141  virtual Count getDestroyCount( void ) const = 0;
142 
143 
152  virtual AllocatorPtr getAllocator( UniqueId ) const
153  throw(AllocatorNotFoundException) = 0;
154 
155  //
156  // Pure virtual mutators
157  //
158 
165  virtual void addAllocator( UniqueId, AllocatorPtr )
167 
176  virtual AllocatorPtr removeAllocator( UniqueId )
177  throw(AllocatorNotFoundException) = 0;
178 
179  //
180  // Iterator factory methods
181  //
188  virtual Iterator<Allocator *> * createIterator( void ) const = 0;
189 
195  virtual void destroyIterator( Iterator<Allocator *> * ) const = 0;
196 
204  virtual AssociativeIterator<UniqueId,Allocator *> *
205  createAssociativeIterator( void ) const = 0;
206 
213  virtual void destroyAssociativeIterator
214  (
215  AssociativeIterator<UniqueId,Allocator *> *
216  ) const = 0;
217 
218  };
219 }
220 
221 #endif // if !defined(__ABSTRACTFACTORY_HPP)
222 
223 /*
224  Common rcs information do not modify
225  $Author: prudhomm $
226  $Revision: 1.1 $
227  $Date: 2000/04/23 20:43:13 $
228  $Locker: $
229 */
230 
bool operator==(const AbstractFactory &aRef) const
Equality operator.
Definition: AbstractFactory.hpp:118
AbstractFactory & operator=(const AbstractFactory &)
Assignment operator.
Definition: AbstractFactory.hpp:107
AbstractFactory(const AbstractFactory &)
Copy Constructor.
Definition: AbstractFactory.hpp:83
virtual AssociativeIterator< UniqueId, Allocator * > * createAssociativeIterator(void) const =0
Interface for creating an AssociativeIterator to iterate through the Identifiers and Allocators of an...
virtual Count getDestroyCount(void) const =0
Returns the number of total destroys for this factory.
virtual void destroyIterator(Iterator< Allocator * > *) const =0
Interface for returning a created Iterator.
virtual void destroyAssociativeIterator(AssociativeIterator< UniqueId, Allocator * > *) const =0
Interface for returning a created AssociativeIterator.
AllocatorNotFoundException is an exception that is usually thrown when a AbstractFactory attempts to ...
Definition: AllocatorNotFoundException.hpp:44
virtual AllocatorPtr getAllocator(UniqueId) const =0
Retrieve the allocator identified by argument from the implementation.
virtual AllocatorPtr removeAllocator(UniqueId)=0
Retrieve and remove the allocator identified by argument from the implementation. ...
virtual ~AbstractFactory(void)
Virtual Destructor.
Definition: AbstractFactory.hpp:92
virtual void addAllocator(UniqueId, AllocatorPtr)=0
Add a allocator to the factory implementation.
The AssociativeIterator that extends Iterator to include the interface for describing an associative ...
Definition: AssociativeIterator.hpp:44
Allocator is a Strategy class used by AbstractAllocator and AbstractFactory.Each Allocator instance t...
Definition: Allocator.hpp:43
virtual Iterator< Allocator * > * createIterator(void) const =0
Interface for creating an Iterator to iterate through the Allocators of an implementation.
AllocatorAlreadyExistsException is an exception that is usually thrown when a add of an Allocator col...
Definition: AllocatorAlreadyExistsException.hpp:44
virtual Count getCreateCount(void) const =0
Returns the number of total creates for this factory.
AbstractFactory(void)
Default constructor.
Definition: AbstractFactory.hpp:71
The Iterator provides a way to access the elements of an collection type sequentially without exposin...
Definition: Iterator.hpp:44
An CoreLinuxObject is a base class for the library.
Definition: CoreLinuxObject.hpp:39
AbstractFactory provides an interface for creating families of related or dependent objects without s...
Definition: AbstractFactory.hpp:60

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