|
TuringSim
C++ framework to simulate abstract computing models
|
3 #include <utils/messageException.h>
4 #include <utils/printer.h>
14 template <
typename TransitionType>
29 typename TransitionType::StateType_ preState,
30 typename TransitionType::StorageType_ storage,
31 typename TransitionType::ApplyHelperType& applyHelper
33 MessageException(message),
36 applyHelper(applyHelper)
41 using Utils::Debug::operator<<;
43 ss << this->msg << std::endl;
44 ss <<
" transition: " << transition << std::endl;
45 ss <<
" preState: " << preState << std::endl;
46 ss <<
" storage: " << storage << std::endl;
47 ss <<
" applyHelper: " << applyHelper << std::endl;
52 typename TransitionType::StorageType_
storage;
64 typename StorageType_,
65 typename ApplyHelperType_
virtual StateType apply(const StateType &state, StorageType &storage, ApplyHelperType &&helper, bool &running) const =0
Apply a previously matching transition and return the new state.
ConfigurationDoesNotMatchException()=delete
ConfigurationDoesNotMatchException must be build with interesting data.
TransitionType::StorageType_ storage
the storage before transition application.
ApplyHelperType_ ApplyHelperType
The type of apply helpers.
TransitionType::ApplyHelperType & applyHelper
the apply helper provided to apply.
Transition()=default
The default constructor.
Namespace for transitions.
The Base class for all custom exceptions.
StateType_ StateType
The type of states.
Base class for transitions.
virtual ~Transition()=default
The default virtual destructor.
TransitionType transition
the transition we apply.
Transition & operator=(Transition &&)=default
The default move assignment operator.
Transition(const Transition &)=default
The default copy constructor.
TransitionType::StateType_ preState
the state before transition application.
Transition(Transition &&)=default
The default move constructor.
virtual std::optional< ApplyHelperType > match(const StateType &state, const StorageType &storage) const =0
Test whether the transition matches a configuration. Returned optional is empty iff the transition do...
virtual std::string makeFullMessage() const override
Build the full error message. It should be overridden by derived class that adds data to the exceptio...
Transition & operator=(const Transition &)=default
The default copy assignment operator.
StorageType_ StorageType
The type of storage.
Exception thrown when we try to apply a transition to a configuration which does not match.