Well, I've come to a conclusion . . .
[aesalon.git] / src / platform / Memory.h
blobf44d5234997c432797f32b23d0b01a84e0612c2e
1 #ifndef AESALON_PLATFORM_MEMORY_H
2 #define AESALON_PLATFORM_MEMORY_H
4 #include <string>
5 #include <set>
7 #include "MemoryAddress.h"
8 #include "MemoryBlock.h"
9 #include "Event.h"
10 #include "misc/SmartPointer.h"
12 namespace Aesalon {
13 namespace Platform {
15 /** Stores the memory associated with a program. */
16 class Memory {
17 protected:
18 typedef std::set<Misc::SmartPointer<MemoryBlock> > block_set_t;
19 private:
20 block_set_t block_set;
22 void add_block(Misc::SmartPointer<MemoryBlock> new_block) {
23 block_set.insert(new_block);
25 void remove_block(Misc::SmartPointer<MemoryBlock> block);
26 public:
27 /** Generic constructor. */
28 Memory() {}
29 /** Virtual destructor. */
30 virtual ~Memory() {}
32 /** Returns the block at the specified MemoryAddress.
33 @param address The address to look for.
34 @return The @a MemoryBlock at @a address, or NULL if not found.
36 Misc::SmartPointer<MemoryBlock> get_block(MemoryAddress address) const;
38 /** Handle an event as a "diff", and apply it to the current memory representation.
39 @param event The event to handle.
41 void handle_event(Misc::SmartPointer<Event> event);
44 } // namespace Platform
45 } // namespace Aesalon
47 #endif