TuringSim
C++ framework to simulate abstract computing models
Public Member Functions | List of all members
TuringSim::Symbol::SimpleSymbolPattern< T > Class Template Reference

Class to encode symbol pattern made of only one symbol. More...

#include <symbol/simpleSymbolPattern.h>

Inheritance diagram for TuringSim::Symbol::SimpleSymbolPattern< T >:
Inheritance graph
[legend]
Collaboration diagram for TuringSim::Symbol::SimpleSymbolPattern< T >:
Collaboration graph
[legend]

Public Member Functions

 SimpleSymbolPattern (const T &acceptedLetter)
 Constructor. More...
 
virtual bool match (const T &letter) const noexcept override
 Test if a symbol matches the symbol. More...
 
const T & getLetter () const
 Get the accepted letter, for optimized containers. More...
 
bool operator< (const SimpleSymbolPattern &other) const
 Strict total order. More...
 
- Public Member Functions inherited from TuringSim::Symbol::SymbolPattern< T, void >
 SymbolPattern ()=default
 The default constructor.
 
 SymbolPattern (const SymbolPattern &)=default
 The default copy constructor.
 
 SymbolPattern (SymbolPattern &&)=default
 The default move constructor.
 
SymbolPatternoperator= (const SymbolPattern &)=default
 The default copy assignment operator. More...
 
SymbolPatternoperator= (SymbolPattern &&)=default
 The default move assignment operator. More...
 
virtual ~SymbolPattern ()=default
 The default virtual destructor.
 
virtual bool match (const SymbolType &symbol, const Context &context) const noexcept=0
 Test whether a symbol match the pattern, given a context. More...
 

Additional Inherited Members

- Public Types inherited from TuringSim::Symbol::SymbolPattern< T, void >
typedef T SymbolType
 The type of symbols.
 
typedef void Context
 The type of context.
 

Detailed Description

template<typename T>
class TuringSim::Symbol::SimpleSymbolPattern< T >

Class to encode symbol pattern made of only one symbol.

Template Parameters
Tthe type of symbols.

This is really the simplest pattern you can think of.

Definition at line 13 of file simpleSymbolPattern.h.

Constructor & Destructor Documentation

◆ SimpleSymbolPattern()

template<typename T >
TuringSim::Symbol::SimpleSymbolPattern< T >::SimpleSymbolPattern ( const T &  acceptedLetter)
inline

Constructor.

Parameters
[in]acceptedLetterThe letter which have to be the pattern.

The content of the reference is copied.

Complexity \(\mathcal{O}(\text{copy}_\texttt{T})\)

Definition at line 22 of file simpleSymbolPattern.h.

Member Function Documentation

◆ getLetter()

template<typename T >
const T& TuringSim::Symbol::SimpleSymbolPattern< T >::getLetter ( ) const
inline

Get the accepted letter, for optimized containers.

Returns
a const reference to the accepted letter

Definition at line 41 of file simpleSymbolPattern.h.

Here is the caller graph for this function:

◆ match()

template<typename T >
virtual bool TuringSim::Symbol::SimpleSymbolPattern< T >::match ( const T &  letter) const
inlineoverridevirtualnoexcept

Test if a symbol matches the symbol.

Parameters
[in]letterThs symbol to test.
Returns
whether letter is exactly the accepted letter.

The letter letter matches the pattern iff it is equal to the symbol of the pattern.

Complexity \(\mathcal{O}(\texttt{==}_\texttt{T})\)

Definition at line 34 of file simpleSymbolPattern.h.

Here is the caller graph for this function:

◆ operator<()

template<typename T >
bool TuringSim::Symbol::SimpleSymbolPattern< T >::operator< ( const SimpleSymbolPattern< T > &  other) const
inline

Strict total order.

Parameters
[in]otherThe other value to compare.
Returns
whether *this is ordered before other.

Definition at line 49 of file simpleSymbolPattern.h.


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