MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ apply_or_stage()

MAYAFLUX_HOST_API Result< void > MayaFlux::Host::detail::apply_or_stage ( Stage stage,
std::string value )

Apply an item to the running session, or stage it until start_session.

Include paths and flags cannot change a session that has started and are refused then. Libraries are loaded once per path.

Definition at line 129 of file Session.cpp.

130 {
131 for (;;) {
132 Outcome outcome = Outcome::Staged;
133
134 g_state.update([&](State& state) {
135 if (state.instance) {
136 outcome = Outcome::Running;
137 return false;
138 }
139 if (state.starting) {
140 outcome = Outcome::Starting;
141 return false;
142 }
143 if (stage == Stage::Library && !state.libraries.insert(value).second) {
144 outcome = Outcome::Duplicate;
145 return false;
146 }
147 state.staged[index_of(stage)].push_back(value);
148 outcome = Outcome::Staged;
149 return true;
150 });
151
152 if (outcome == Outcome::Staged || outcome == Outcome::Duplicate) {
153 return {};
154 }
155 if (outcome == Outcome::Starting) {
156 return refuse("session is starting");
157 }
158
159 if (auto instance = running_instance()) {
160 return apply_now(*instance, stage, value);
161 }
162 }
163 }
void refuse(std::string_view message)
Definition Layers.hpp:74

References Library.

Referenced by MayaFlux::Host::add_compile_flag(), MayaFlux::Host::add_include_root(), and MayaFlux::Host::eval().

Here is the caller graph for this function: