1 #if !defined(__MEMORYSTORAGE_HPP) 2 #define __MEMORYSTORAGE_HPP 24 #if !defined(__COMMON_HPP) 28 #if !defined(__TRANSIENTSTORAGE_HPP) 29 #include <TransientStorage.hpp> 32 #if !defined(__BOUNDSEXCEPTION_HPP) 33 #include <BoundsException.hpp> 38 DECLARE_CLASS( MemoryStorage );
96 if( Dword( ( BytePtr(theCurrentPointer) +
sizeof(T) ) -
97 BytePtr(theBasePointer)) > Dword(theSize) )
99 throw BoundsException( LOCATION );
106 return ((T *)theCurrentPointer)[0];
116 if( Dword( ( BytePtr(theCurrentPointer) +
sizeof(T) ) -
117 BytePtr(theBasePointer)) > Dword(theSize) )
126 return ((T *)theCurrentPointer);
136 if( Dword( ( BytePtr(theCurrentPointer) +
sizeof(T) ) -
137 BytePtr(theBasePointer)) > Dword(theSize) )
147 std::memmove( theCurrentPointer, &aT,
sizeof(T) );
167 template <
class Type,
class Xexec >
170 REQUIRE( aExec != NULLPTR );
174 Type *pType( (Type *)theBasePointer );
175 Int maxCount( theSize /
sizeof( Type ) );
177 for( Int x = 0; x < maxCount; ++x, ++pType )
191 template <
class Type,
class Xexec,
class Test >
195 REQUIRE( aExec != NULLPTR );
196 REQUIRE( aTest != NULLPTR );
200 Type *pType( (Type *)theBasePointer );
201 Int maxCount( theSize /
sizeof( Type ) );
203 for( Int x = 0; x < maxCount; ++x, ++pType )
205 if( (*aTest)(pType) ==
true )
254 VoidPtr theBasePointer;
258 VoidPtr theCurrentPointer;
263 #endif // if !defined(__MEMORYSTORAGE_HPP) T & operator=(T &aT)
Data assignment.
Definition: MemoryStorage.hpp:134
MemoryStorage is type of Storage characterized as transient and high speed.
Definition: MemoryStorage.hpp:47
TransientStorage type is an area of storage that will not be saved across system initializations.
Definition: TransientStorage.hpp:41
MemoryStorage(void)
Default is never called.
Definition: MemoryStorage.cpp:33
bool operator==(MemoryStorageCref) const
Compares identifier.
Definition: MemoryStorage.cpp:95
void forEach(Xexec aExec)
forEach invokes the callers method to perform whatever operation they want on the type reference in t...
Definition: MemoryStorage.hpp:168
BoundsException is a type of StorageException, characterized when access to a storage object is inval...
Definition: BoundsException.hpp:42
Forward reference the various common classes.
Definition: AbstractAllocator.hpp:32
ScalarIdentifier provides a templated interface for declaring CoreLinux Identifiers for simple scalar...
Definition: ScalarIdentifiers.hpp:37
MemoryStorageRef operator[](Int offset)
Subscript offset operator.
Definition: MemoryStorage.cpp:143
void operator-(Int)
Decrement current pointer.
Definition: MemoryStorage.cpp:126
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
void forEach(Xexec aExec, Test aTest)
forEach that invokes the callers method if the callers test method returns true
Definition: MemoryStorage.hpp:192
Memory is high speed transient storage managed by the operating system, for both itself and user proc...
Definition: Memory.hpp:100
void operator+(Int)
Increment current pointer.
Definition: MemoryStorage.cpp:109
VoidPtr getBasePointer(void)
Internal reference to base.
Definition: MemoryStorage.cpp:153
virtual ~MemoryStorage(void)
Virtual destructor.
Definition: MemoryStorage.cpp:78