The MAUVE Toolchain
AbstractState.hpp
1 /*
2  * Copyright 2017 ONERA
3  *
4  * This file is part of the MAUVE Runtime project.
5  *
6  * MAUVE Runtime is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License version 3 as
8  * published by the Free Software Foundation.
9  *
10  * MAUVE Runtime is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with MAUVE. If not, see <https://www.gnu.org/licenses/lgpl-3.0>.
17  */
18 #ifndef MAUVE_RUNTIME_ABSTRACT_STATE_HPP
19 #define MAUVE_RUNTIME_ABSTRACT_STATE_HPP
20 
21 #include <iostream>
22 #include <string>
23 
24 #include "common.hpp"
25 
26 namespace mauve {
27  namespace runtime {
28 
29  class AbstractFiniteStateMachine;
30 
34  class AbstractState {
35  public:
37 
39  std::string const name;
40 
41  AbstractState() = delete;
42  AbstractState(AbstractState const & other) = delete;
43  AbstractState & operator=(AbstractState const & other) = delete;
44 
46  virtual bool is_execution() const = 0;
48  virtual bool is_synchronization() const = 0;
49 
54  virtual time_ns_t get_clock() const = 0;
55 
60  virtual bool set_clock(time_ns_t clock) = 0;
61 
63  virtual std::size_t get_next_size() const = 0;
64 
66  virtual AbstractState* get_next_state(int index) const = 0;
67 
69  virtual std::string to_string() const = 0;
70 
71  protected:
72  AbstractState(AbstractFiniteStateMachine* container, std::string const & name);
73  virtual ~AbstractState() noexcept;
74 
75  const AbstractFiniteStateMachine* container;
76  };
77 
78  std::ostream & operator<<(std::ostream & out, AbstractState const & state);
79 
80 }} /* namespace mauve */
81 
82 #endif
virtual bool is_synchronization() const =0
Check if the state is a Synchronization state.
virtual std::size_t get_next_size() const =0
Return the number of transitions.
virtual time_ns_t get_clock() const =0
Get the clock value of the SynchroState "name".
A Finite State Machine describes the component behavior.
Definition: AbstractFiniteStateMachine.hpp:34
virtual bool set_clock(time_ns_t clock)=0
Change the clock value of the SynchroState "name".
virtual bool is_execution() const =0
Check if the state is an Execution state.
The MAUVE namespace.
Definition: tracing.hpp:24
Abstract State class.
Definition: AbstractState.hpp:34
virtual std::string to_string() const =0
Return the state as a string.
virtual AbstractState * get_next_state(int index) const =0
Return the next state according to the index.
std::string const name
State name.
Definition: AbstractState.hpp:39