btftoolchain
core.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "common.h"
4 
5 namespace btf
6 {
7 
13 class Core
14 {
15  public:
16 
20  enum class States
21  {
23  idle,
24 
26  execution,
27 
29  unknown
30  };
31 
35  enum class Events
36  {
38  idle,
39 
41  execute,
42 
45 
47  unknown
48  };
49 
53  Core(States state = States::unknown);
54 
61 
67  static std::string eventToString(Events ev);
68 
74  static Events stringToEvent(const std::string& str);
75 
80  bool isIdle() const;
81 
86  bool isStateUnknown() const;
87 
88  private:
90  States state_;
91 };
92 } // namespace btf
Class for the core (C) events.
Definition: core.h:14
States
Possible types of core states.
Definition: core.h:21
@ unknown
Default state.
@ idle
The core is currently idle.
@ execution
The core is currently executing a process instance.
bool isIdle() const
Checks, if the current core is in the state idle.
Definition: core.cpp:84
static Events stringToEvent(const std::string &str)
Converts a string into the enum Events.
Definition: core.cpp:64
Events
Possible types of core events.
Definition: core.h:36
@ unknown
Default state.
@ execute
The execute event indicates that the core is going into the execution state.
@ idle
The idle event indicates that the core is going into the idle state.
ErrorCodes doStateTransition(Events core_event)
Transitions the current state depending on the event.
Definition: core.cpp:9
Core(States state=States::unknown)
Constructor of the class Core.
Definition: core.cpp:5
bool isStateUnknown() const
Checks, if the current core is in the state unknown.
Definition: core.cpp:89
static std::string eventToString(Events ev)
Converts the enum Events into string.
Definition: core.cpp:49
Definition: btf.h:43
ErrorCodes
Error Codes for the btf library.
Definition: common.h:13