|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Everything one run needs, so the recursive walk can be free functions over one struct. More...
Public Member Functions | |
| bool | stopped () const |
| double | elapsed () const |
| bool | pastDeadline () const |
| bool | sleep (double seconds) |
| Wait seconds, or until stopped / the deadline, whichever comes first. | |
| std::string | describeCondition (int32_t idx) |
| The condition's operands as text, e.g. | |
| bool | eval (int32_t idx, double &out) |
| Flow | execBlock (int32_t begin, int32_t end) |
| Flow | exec (int32_t idx) |
Static Public Member Functions | |
| static const char * | opText (Op op) |
| Comparison operators, for the condition text in the log. | |
Public Attributes | |
| const ScriptProgram & | prog |
| const DynamicState & | ds |
| const ScriptEnv & | env |
| std::atomic< bool > & | stop |
| std::mutex & | mtx |
| std::condition_variable & | cv |
| ScriptRunner::Clock::time_point | started_at |
| ScriptRunner::Clock::time_point | deadline |
| std::map< std::string, double > | vars |
| uint64_t | iterations = 0 |
| uint64_t | loop_passes = 0 |
| Completed passes of the outermost loop, and the last condition rendered — both exist so the end-of-run line can say how far it got and what the deciding numbers were. | |
| std::string | last_condition |
| std::string | error |
| Set when something went wrong; names it for the log. | |
Everything one run needs, so the recursive walk can be free functions over one struct.
Definition at line 127 of file ScriptRunner.cpp.
|
inline |
The condition's operands as text, e.g.
"117.7 < 82.1".
A probe, not part of evaluation: it re-evaluates the two sides and RESTORES error, so a failing read here can never invent a run-ending error that the real evaluation did not hit. Safe to repeat because expressions in this language have no side effects — pressure() is a guarded map read of the latest sample, and there is no assignment inside an expression. Returns empty for anything that is not a comparison, and the caller then simply omits the parenthetical.
Definition at line 205 of file ScriptRunner.cpp.
References a, b, error, eval(), fsw::script::Expr::kind, fsw::script::Expr::lhs, ok, fsw::script::Expr::op, opText(), prog, and fsw::script::Expr::rhs.
Referenced by exec().
|
inline |
Definition at line 171 of file ScriptRunner.cpp.
References started_at.
|
inline |
Definition at line 227 of file ScriptRunner.cpp.
References a, b, ds, elapsed(), env, error, eval(), fsw::script::Expr::kind, fsw::script::Expr::lhs, fsw::script::Expr::number, fsw::script::Expr::op, prog, fsw::script::Expr::rhs, fsw::script::Expr::slug, fsw::script::Expr::var, and vars.
Referenced by describeCondition(), eval(), and exec().
|
inline |
Definition at line 372 of file ScriptRunner.cpp.
References fsw::script::Stmt::body_begin, fsw::script::Stmt::body_end, sequencer::anonymous_namespace{ScriptRunner.cpp}::Continue, describeCondition(), ds, fsw::script::Stmt::else_begin, fsw::script::Stmt::else_end, env, error, eval(), execBlock(), fsw::script::Stmt::expr, iterations, fsw::script::Stmt::kind, sequencer::anonymous_namespace{ScriptRunner.cpp}::kMaxIterations, last_condition, loop_passes, StateMachine::name(), pastDeadline(), prog, sleep(), fsw::script::Stmt::slug, stopped(), target, sequencer::anonymous_namespace{ScriptRunner.cpp}::Terminated, sequencer::UNKNOWN, fsw::script::Stmt::var, and vars.
Referenced by execBlock().
|
inline |
Definition at line 357 of file ScriptRunner.cpp.
References begin(), sequencer::anonymous_namespace{ScriptRunner.cpp}::Continue, end(), error, exec(), pastDeadline(), prog, stopped(), and sequencer::anonymous_namespace{ScriptRunner.cpp}::Terminated.
Referenced by exec().
|
inlinestatic |
Comparison operators, for the condition text in the log.
Non-comparisons return null.
Definition at line 148 of file ScriptRunner.cpp.
Referenced by describeCondition().
|
inline |
Definition at line 175 of file ScriptRunner.cpp.
References deadline.
Referenced by exec(), execBlock(), and sleep().
|
inline |
Wait seconds, or until stopped / the deadline, whichever comes first.
Definition at line 181 of file ScriptRunner.cpp.
References cv, deadline, sequencer::anonymous_namespace{ScriptRunner.cpp}::kMinDelaySeconds, lk, mtx, pastDeadline(), stop, and until().
Referenced by exec().
|
inline |
Definition at line 167 of file ScriptRunner.cpp.
References stop.
Referenced by exec(), and execBlock().
| std::condition_variable& sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::cv |
Definition at line 133 of file ScriptRunner.cpp.
Referenced by feedtwin.props.state.ThermoState::gamma(), and sleep().
| ScriptRunner::Clock::time_point sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::deadline |
Definition at line 135 of file ScriptRunner.cpp.
Referenced by pastDeadline(), and sleep().
| const DynamicState& sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::ds |
Definition at line 129 of file ScriptRunner.cpp.
| const ScriptEnv& sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::env |
Definition at line 130 of file ScriptRunner.cpp.
| std::string sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::error |
Set when something went wrong; names it for the log.
Definition at line 145 of file ScriptRunner.cpp.
Referenced by test_ota_flash.FakeBoard::bind(), describeCondition(), eval(), exec(), execBlock(), test_ota_flash.FakeBoard::run(), and backend.routers.layerx.Job::view().
| uint64_t sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::iterations = 0 |
Definition at line 138 of file ScriptRunner.cpp.
Referenced by exec().
| std::string sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::last_condition |
Definition at line 143 of file ScriptRunner.cpp.
Referenced by exec().
| uint64_t sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::loop_passes = 0 |
Completed passes of the outermost loop, and the last condition rendered — both exist so the end-of-run line can say how far it got and what the deciding numbers were.
Without them a timeout and a loop that never ran are the same single word in the journal.
Definition at line 142 of file ScriptRunner.cpp.
Referenced by exec().
| std::mutex& sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::mtx |
Definition at line 132 of file ScriptRunner.cpp.
Referenced by sleep().
| const ScriptProgram& sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::prog |
Definition at line 128 of file ScriptRunner.cpp.
Referenced by describeCondition(), eval(), exec(), and execBlock().
| ScriptRunner::Clock::time_point sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::started_at |
Definition at line 134 of file ScriptRunner.cpp.
Referenced by elapsed().
| std::atomic<bool>& sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::stop |
Definition at line 131 of file ScriptRunner.cpp.
| std::map<std::string, double> sequencer::anonymous_namespace{ScriptRunner.cpp}::Interp::vars |
Definition at line 137 of file ScriptRunner.cpp.