Skip to content

Commit 4be46cb

Browse files
committed
engine: Add probe subcommand
This provides an easy mechanism to check a simulation configuration for available trigers, signals, etc.
1 parent 58382a6 commit 4be46cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3562
-1974
lines changed

engine/CMakeLists.txt

+32-2
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,36 @@ add_library(cloe-enginelib STATIC
106106
src/simulation.hpp
107107
src/simulation_context.cpp
108108
src/simulation_context.hpp
109+
src/simulation_actions.hpp
110+
src/simulation_events.hpp
111+
src/simulation_outcome.hpp
112+
src/simulation_result.hpp
113+
src/simulation_probe.hpp
114+
src/simulation_statistics.hpp
115+
src/simulation_sync.hpp
109116
src/simulation_progress.hpp
117+
src/simulation_machine.hpp
118+
src/simulation_state_abort.cpp
119+
src/simulation_state_connect.cpp
120+
src/simulation_state_disconnect.cpp
121+
src/simulation_state_fail.cpp
122+
src/simulation_state_keep_alive.cpp
123+
src/simulation_state_pause.cpp
124+
src/simulation_state_probe.cpp
125+
src/simulation_state_reset.cpp
126+
src/simulation_state_resume.cpp
127+
src/simulation_state_start.cpp
128+
src/simulation_state_step_begin.cpp
129+
src/simulation_state_step_controllers.cpp
130+
src/simulation_state_step_end.cpp
131+
src/simulation_state_step_simulators.cpp
132+
src/simulation_state_stop.cpp
133+
src/simulation_state_success.cpp
110134
src/utility/command.cpp
111135
src/utility/command.hpp
112136
src/utility/defer.hpp
113137
src/utility/progress.hpp
114138
src/utility/state_machine.hpp
115-
src/utility/time_event.hpp
116139
)
117140
add_library(cloe::enginelib ALIAS cloe-enginelib)
118141
set_target_properties(cloe-enginelib PROPERTIES
@@ -170,6 +193,11 @@ if(BUILD_TESTING)
170193
message(STATUS "Building test-enginelib executable.")
171194
add_executable(test-enginelib
172195
src/lua_stack_test.cpp
196+
src/lua_setup_test.cpp
197+
)
198+
target_compile_definitions(test-enginelib
199+
PRIVATE
200+
CLOE_LUA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/lua"
173201
)
174202
set_target_properties(test-enginelib PROPERTIES
175203
CXX_STANDARD 17
@@ -192,11 +220,13 @@ add_subdirectory(vendor/linenoise)
192220
add_executable(cloe-engine
193221
src/main.cpp
194222
src/main_commands.hpp
223+
src/main_commands.cpp
195224
src/main_check.cpp
196225
src/main_dump.cpp
226+
src/main_probe.cpp
197227
src/main_run.cpp
198-
src/main_usage.cpp
199228
src/main_shell.cpp
229+
src/main_usage.cpp
200230
src/main_version.cpp
201231
)
202232
set_target_properties(cloe-engine PROPERTIES

engine/lua/cloe-engine/init.lua

+18-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ local engine = {
4444

4545
--- Contains engine state for a simulation.
4646
state = {
47-
--- @type StackConf The current active stack configuration (volatile).
48-
config = {},
49-
5047
--- @type table<string, boolean> A table of feature flags.
5148
features = {
5249
["cloe-0.18.0"] = true,
@@ -74,6 +71,9 @@ local engine = {
7471
--- @type Stack Reference to simulation stack type.
7572
stack = nil,
7673

74+
--- @type boolean True if simulation has started.
75+
is_running = false,
76+
7777
--- @type string|nil Path to currently executing Lua script file.
7878
current_script_file = nil,
7979

@@ -144,6 +144,13 @@ function engine.is_available()
144144
return false
145145
end
146146

147+
--- Return whether the simulation has started.
148+
---
149+
--- @return boolean
150+
function engine.is_simulation_running()
151+
return engine.state.is_running
152+
end
153+
147154
--- Return path to Lua file that the engine is currently merging,
148155
--- or nil if no file is being loaded.
149156
---
@@ -167,6 +174,14 @@ function engine.get_stack()
167174
return unavailable("get_stack")
168175
end
169176

177+
--- Return the current simulation configuration.
178+
---
179+
--- This is essential a dump of the stack.
180+
--- @return StackConf
181+
function engine.get_config()
182+
return unavailable("get_config")
183+
end
184+
170185
--- Return the simulation scheduler (aka. Coordinator) global instance.
171186
---
172187
--- @return Coordinator

0 commit comments

Comments
 (0)