Skip to content

Commit

Permalink
engine: Add probe subcommand
Browse files Browse the repository at this point in the history
This provides an easy mechanism to check a simulation configuration
for available trigers, signals, etc.
  • Loading branch information
cassava committed Jun 26, 2024
1 parent a4c0943 commit 2eab6ef
Show file tree
Hide file tree
Showing 55 changed files with 3,519 additions and 1,972 deletions.
34 changes: 32 additions & 2 deletions engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,36 @@ add_library(cloe-enginelib STATIC
src/simulation.hpp
src/simulation_context.cpp
src/simulation_context.hpp
src/simulation_actions.hpp
src/simulation_events.hpp
src/simulation_outcome.hpp
src/simulation_result.hpp
src/simulation_probe.hpp
src/simulation_statistics.hpp
src/simulation_sync.hpp
src/simulation_progress.hpp
src/simulation_machine.hpp
src/simulation_state_abort.cpp
src/simulation_state_connect.cpp
src/simulation_state_disconnect.cpp
src/simulation_state_fail.cpp
src/simulation_state_keep_alive.cpp
src/simulation_state_pause.cpp
src/simulation_state_probe.cpp
src/simulation_state_reset.cpp
src/simulation_state_resume.cpp
src/simulation_state_start.cpp
src/simulation_state_step_begin.cpp
src/simulation_state_step_controllers.cpp
src/simulation_state_step_end.cpp
src/simulation_state_step_simulators.cpp
src/simulation_state_stop.cpp
src/simulation_state_success.cpp
src/utility/command.cpp
src/utility/command.hpp
src/utility/defer.hpp
src/utility/progress.hpp
src/utility/state_machine.hpp
src/utility/time_event.hpp
)
add_library(cloe::enginelib ALIAS cloe-enginelib)
set_target_properties(cloe-enginelib PROPERTIES
Expand Down Expand Up @@ -170,6 +193,11 @@ if(BUILD_TESTING)
message(STATUS "Building test-enginelib executable.")
add_executable(test-enginelib
src/lua_stack_test.cpp
src/lua_setup_test.cpp
)
target_compile_definitions(test-enginelib
PRIVATE
CLOE_LUA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/lua"
)
set_target_properties(test-enginelib PROPERTIES
CXX_STANDARD 17
Expand All @@ -192,11 +220,13 @@ add_subdirectory(vendor/linenoise)
add_executable(cloe-engine
src/main.cpp
src/main_commands.hpp
src/main_commands.cpp
src/main_check.cpp
src/main_dump.cpp
src/main_probe.cpp
src/main_run.cpp
src/main_usage.cpp
src/main_shell.cpp
src/main_usage.cpp
src/main_version.cpp
)
set_target_properties(cloe-engine PROPERTIES
Expand Down
21 changes: 18 additions & 3 deletions engine/lua/cloe-engine/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ local engine = {

--- Contains engine state for a simulation.
state = {
--- @type StackConf The current active stack configuration (volatile).
config = {},

--- @type table<string, boolean> A table of feature flags.
features = {
["cloe-0.18.0"] = true,
Expand Down Expand Up @@ -74,6 +71,9 @@ local engine = {
--- @type Stack Reference to simulation stack type.
stack = nil,

--- @type boolean True if simulation has started.
is_running = false,

--- @type string|nil Path to currently executing Lua script file.
current_script_file = nil,

Expand Down Expand Up @@ -144,6 +144,13 @@ function engine.is_available()
return false
end

--- Return whether the simulation has started.
---
--- @return boolean
function engine.is_simulation_running()
return engine.state.is_running
end

--- Return path to Lua file that the engine is currently merging,
--- or nil if no file is being loaded.
---
Expand All @@ -167,6 +174,14 @@ function engine.get_stack()
return unavailable("get_stack")
end

--- Return the current simulation configuration.
---
--- This is essential a dump of the stack.
--- @return StackConf
function engine.get_config()
return unavailable("get_config")
end

--- Return the simulation scheduler (aka. Coordinator) global instance.
---
--- @return Coordinator
Expand Down
Loading

0 comments on commit 2eab6ef

Please sign in to comment.