CoreLinux++  0.4.32
Memory.hpp
1 #if !defined(__MEMORY_HPP)
2 #define __MEMORY_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(__SYNCHRONIZED_HPP)
29 #include <Synchronized.hpp>
30 #endif
31 
32 #if !defined(__SINGLETON_HPP)
33 #include <Singleton.hpp>
34 #endif
35 
36 #if !defined(__STORAGEEXCEPTION_HPP)
37 #include <StorageException.hpp>
38 #endif
39 
40 #if !defined(__MEMORYSTORAGE_HPP)
41 #include <MemoryStorage.hpp>
42 #endif
43 
44 #if !defined(__MAP_HPP)
45 #include <Map.hpp>
46 #endif
47 
48 
49 
50 namespace corelinux
51 {
52 
53  CORELINUX_MAP
54  (
55  MemoryStoragePtr, CharCptr, std::less<MemoryStoragePtr>, MemoryMap
56  );
57 
58 
59  DECLARE_CLASS( Memory );
60 
62 
63  DECLARE_TYPE( Singleton<Memory>, MemoryManager );
64 
100  class Memory : public Synchronized
101  {
102 
103  public:
104 
105  //
106  // Constructors and destructor
107  //
108 
110 
111  Memory( void ) throw( Assertion );
112 
114 
115  virtual ~Memory( void );
116 
117  //
118  // Operator overloads
119  //
120 
121  //
122  // Accessors
123  //
124 
125  //
126  // Mutators
127  //
128 
129  //
130  // Factory Methods
131  //
132 
142  static MemoryStoragePtr createStorage
143  (
144  Size aByteSize,
145  Int Rights = OWNER_ALL
146  ) throw( StorageException );
147 
158  static MemoryStoragePtr createStorage
159  (
160  MemoryIdentifierCref aIdentifier,
161  Size aByteSize,
163  Int Rights = OWNER_ALL,
164  AddressingConstraint addressing = READ_WRITE
165  );
166 
177  static MemoryStoragePtr createStorage
178  (
179  CharCptr aName,
180  Size aByteSize,
182  Int Rights = OWNER_ALL ,
183  AddressingConstraint addressing = READ_WRITE
184  );
185 
191  static void destroyStorage( MemoryStoragePtr );
192 
193  protected:
195 
196  Memory( MemoryCref ) throw( Assertion );
197 
199 
201 
203 
204  bool operator==( MemoryCref ) const;
205 
206  protected:
208 
210 
211  private:
212 
213  static MemoryMap theMemoryStorageMap;
214  };
215 }
216 
217 #endif // if !defined(__MEMORY_HPP)
218 
219 /*
220  Common rcs information do not modify
221  $Author: prudhomm $
222  $Revision: 1.5 $
223  $Date: 2000/08/31 22:52:20 $
224  $Locker: $
225 */
226 
static void destroyStorage(MemoryStoragePtr)
Destroy a previously allocated storage block.
Definition: Memory.cpp:446
static MemoryManager theMemoryManager
The singleton instance of Memory for synchronization.
Definition: Memory.hpp:209
Memory(void)
Default constructor.
Definition: Memory.cpp:64
Ensure a class only has one instance, and provide a global point of access to it. ...
Definition: Singleton.hpp:38
Forward reference the various common classes.
Definition: AbstractAllocator.hpp:32
CreateDisposition
Creation dispositions for various system utilities.
Definition: AccessRights.hpp:63
ScalarIdentifier provides a templated interface for declaring CoreLinux Identifiers for simple scalar...
Definition: ScalarIdentifiers.hpp:37
StorageException is the base exception type for Storage.
Definition: StorageException.hpp:39
Owner has read/write access.
Definition: AccessRights.hpp:43
AddressingConstraint
Addressings constraints.
Definition: AccessRights.hpp:82
static MemoryStoragePtr createStorage(Size aByteSize, Int Rights=OWNER_ALL)
Default create method, creates a private block of read write shared memory of size aByteSize...
Definition: Memory.cpp:162
read write access (no constraints)
Definition: AccessRights.hpp:86
Assertion is-a Exception created when an assertion fails.
Definition: Assertion.hpp:423
Synchronized is a mixin which allows class objects to enable monitor functionality.
Definition: Synchronized.hpp:41
Will create or open.
Definition: AccessRights.hpp:67
Memory is high speed transient storage managed by the operating system, for both itself and user proc...
Definition: Memory.hpp:100
bool operator==(MemoryCref) const
Equality always returns false.
Definition: Memory.cpp:154
MemoryRef operator=(MemoryCref)
Assignment operator prohibited.
Definition: Memory.cpp:146
virtual ~Memory(void)
Virtual Destructor.
Definition: Memory.cpp:91

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