TuringSim
C++ framework to simulate abstract computing models
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
TuringSim::Memory::MemoryStructure< T, D, O, M > Class Template Reference

Base class for all memory structures. More...

#include <memory/memoryStructure.h>

Public Types

typedef O Observer
 The type of observers.
 
typedef M Modifier
 The type of modifiers.
 
typedef T SymbolType
 The alphabet type. More...
 

Public Member Functions

 ~MemoryStructure ()
 Release current observers and modifier.
 
const std::set< Observer * > & getObservers () const noexcept
 Gets the set of observers. More...
 
const std::optional< Modifier * > & getModifier () const noexcept
 Gets the optional modifier. More...
 

Public Attributes

friend Observer
 Observer class.
 
friend Modifier
 Modifier class.
 

Friends

class MemoryObserver< D, O >
 
class MemoryModifier< D, M >
 

Detailed Description

template<typename T, typename D, typename O, typename M>
class TuringSim::Memory::MemoryStructure< T, D, O, M >

Base class for all memory structures.

Template Parameters
Tthe type of symbols.
Dthe type of the memory structure.
Othe type of the memory observer.
Mthe type of the memory modifier.

Track the set of observers which have access to the memory structure, and the optional modifier. It ensures, along with MemoryObserver and MemoryModifier, that there is at most one modifier on each memory structure. This restriction holds because concurrent modifications may change the memory structure to an illegal state. Concurrent read/write are still allowed and may result in incoherent read, but the memory structure will stay in a legal state.

Definition at line 117 of file memoryStructure.h.

Member Typedef Documentation

◆ SymbolType

template<typename T , typename D , typename O , typename M >
typedef T TuringSim::Memory::MemoryStructure< T, D, O, M >::SymbolType

The alphabet type.

Provide a common name to access the alphabet type from a memory structure.

Definition at line 135 of file memoryStructure.h.

Member Function Documentation

◆ getModifier()

template<typename T , typename D , typename O , typename M >
const std::optional<Modifier*>& TuringSim::Memory::MemoryStructure< T, D, O, M >::getModifier ( ) const
inlinenoexcept

Gets the optional modifier.

Returns
An optional pointer to the modifier.

Definition at line 158 of file memoryStructure.h.

◆ getObservers()

template<typename T , typename D , typename O , typename M >
const std::set<Observer*>& TuringSim::Memory::MemoryStructure< T, D, O, M >::getObservers ( ) const
inlinenoexcept

Gets the set of observers.

Returns
A set of pointers to observers.

Definition at line 151 of file memoryStructure.h.


The documentation for this class was generated from the following file: