|
TuringSim
C++ framework to simulate abstract computing models
|
Base class for all memory observers. More...
#include <memory/memoryStructure.h>
Public Member Functions | |
| MemoryObserver () noexcept | |
| Build an observer that observes nothing. | |
| MemoryObserver (const Memory *memory) | |
| Build an observer that observes a given memory. More... | |
| MemoryObserver (const MemoryObserver &other) | |
| Build a new observer to the same memory. More... | |
| MemoryObserver (MemoryObserver &&other) | |
| Move constructor. More... | |
| MemoryObserver & | operator= (MemoryObserver &other) |
| Copy assignment operator. More... | |
| MemoryObserver & | operator= (MemoryObserver &&other) |
| Move assignment operator. More... | |
| ~MemoryObserver () | |
| Destruct an observer and release the memory structure. | |
| void | acquire (const Memory *toAcquire) |
| Observe a new memory structure. More... | |
| void | unsafe_release () |
| Releases the current observed memory, without checking if there is some. More... | |
| void | release () |
| Releases the current observed memory if there is one. Otherwise, does nothing. | |
| bool | empty () const noexcept |
Check if *this observes a memory. More... | |
Protected Attributes | |
| const Memory * | memory |
| The observed memory. More... | |
Base class for all memory observers.
| Memory | The type of the memory structure observed. |
| Observer | The type the observer. |
Observers of this class are known by the observed memory structure. Consequently, when it is deleted, it can release observers that watch it.
Definition at line 187 of file memoryStructure.h.
|
inline |
Build an observer that observes a given memory.
| [in] | memory | the memory to observe. |
Definition at line 195 of file memoryStructure.h.

|
inline |
Build a new observer to the same memory.
| [in] | other | the observer whose observed memory is the one we want to observe. |
After the copy, the memory structure has a supplementary observer.
Definition at line 204 of file memoryStructure.h.

|
inline |
Move constructor.
| [in,out] | other | the observer whose observed memory is the one we want to observe. |
After the move other does not observe anything, and the memory structure still has the same number of observers.
Definition at line 213 of file memoryStructure.h.

|
inline |
Observe a new memory structure.
| [in] | toAcquire | the memory structure to observe. |
If the memory is already observed, nothing is done. Otherwise, if *this observes a memory, it is released.
Definition at line 253 of file memoryStructure.h.


|
inlinenoexcept |
Check if *this observes a memory.
*this does not observe anything. Definition at line 284 of file memoryStructure.h.
|
inline |
Move assignment operator.
| [in] | other | The memory observer to copy |
*this. Definition at line 233 of file memoryStructure.h.

|
inline |
Copy assignment operator.
| [in] | other | The memory observer to copy |
*this. Definition at line 222 of file memoryStructure.h.

|
inline |
Releases the current observed memory, without checking if there is some.
Behavior is undefined if *this does not observe anything.
Definition at line 268 of file memoryStructure.h.

|
protected |
The observed memory.
The const pointer allows only const function member to be called, but mutable data members can be modified, to manage the set of observers, for instance.
Definition at line 294 of file memoryStructure.h.