|
TuringSim
C++ framework to simulate abstract computing models
|
Base class for all memory modifiers. More...
#include <memory/memoryStructure.h>
Public Member Functions | |
| MemoryModifier () | |
| Default constructor that binds no memory structure. | |
| MemoryModifier (Memory *m) | |
| Constructor that binds to a memory structure. More... | |
| MemoryModifier (const MemoryModifier &other)=delete | |
| Copy constructor is deleted because a memory structure should have only one modifier. | |
| MemoryModifier (MemoryModifier &&other) | |
| Move constructor. More... | |
| MemoryModifier & | operator= (MemoryModifier &)=delete |
| Copy assignment operator is deleted because a memory structure should have only one modifier. | |
| MemoryModifier & | operator= (MemoryModifier &&other) |
| Move assignment operator. More... | |
| ~MemoryModifier () | |
| Destruct a modifier and release the memory structure. | |
| void | acquire (Memory *toAcquire) |
| Bind a new memory structure. More... | |
| void | force_acquire (Memory *toAcquire) |
| Bind 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 bounded memory if there is one. Otherwise, does nothing. | |
| bool | empty () const noexcept |
Check if *this is bounded to a memory. More... | |
Protected Attributes | |
| Memory * | memory |
| The observed memory. More... | |
Base class for all memory modifiers.
| Memory | The type of the bounded memory structure. |
| Modifier | The type the modifier. |
Modifiers of this class are known by the memory structure it is bounded to. Consequently, when it is deleted, it can release its modifier. Moreover, this mechanism ensures that at most on modifier is bounded to a given memory structure.
Definition at line 307 of file memoryStructure.h.
|
inline |
Constructor that binds to a memory structure.
| m | the memory structure to modify. |
Definition at line 315 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 328 of file memoryStructure.h.

|
inline |
Bind a new memory structure.
| [in,out] | toAcquire | the memory structure to bind. |
| ExistingModifierException | if toAcquire is not already bounded by *this but already has a modifier. |
If the memory is already bounded, nothing is done. Otherwise, if toAcquire already has another modifier, an exception is thrown. Otherwise, the currently bounded memory structure, if any, is released, and the new is bounded instead.
Definition at line 366 of file memoryStructure.h.


|
inlinenoexcept |
Check if *this is bounded to a memory.
*this is not bounded to a memory. Definition at line 420 of file memoryStructure.h.
|
inline |
Bind a new memory structure.
| [in,out] | toAcquire | the memory structure to bind. |
If the memory is already bounded, nothing is done. Otherwise, if toAcquire already has another modifier, it is released. The currently bounded memory structure, if any, is released. The new memory structure is then acquired.
Definition at line 386 of file memoryStructure.h.

|
inline |
Move assignment operator.
| [in,out] | other | The memory observer to copy |
*this. Definition at line 342 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 404 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 optional modifiers, for instance.
Definition at line 430 of file memoryStructure.h.