.TH "serif::utils::dependencies" 3 "Version v0.0.1a" "SERiF" \" -*- nroff -*- .ad l .nh .SH NAME serif::utils::dependencies .SH SYNOPSIS .br .PP .SS "Namespaces" .in +1c .ti -1c .RI "namespace \fBdetail\fP" .br .ti -1c .RI "namespace \fBkeys\fP" .br .in -1c .SS "Classes" .in +1c .ti -1c .RI "struct \fBAllNodesObserver\fP" .br .RI "One registration can inspect every result without building a graph-sized observer tuple\&. " .ti -1c .RI "struct \fBBinding\fP" .br .ti -1c .RI "struct \fBBindings\fP" .br .ti -1c .RI "struct \fBBoundType\fP" .br .ti -1c .RI "class \fBComputation\fP" .br .ti -1c .RI "class \fBComputationCache\fP" .br .RI "Execute a computational graph on demand, publishing immutable results only after the entire request succeeds\&. " .ti -1c .RI "class \fBComputationGraph\fP" .br .ti -1c .RI "class \fBDependencyContext\fP" .br .ti -1c .RI "class \fBDependencyContextView\fP" .br .ti -1c .RI "class \fBDependencyContextView< ParentT, KeyList< KeyTs\&.\&.\&. > >\fP" .br .ti -1c .RI "struct \fBEdgeObserver\fP" .br .ti -1c .RI "class \fBGraphTiming\fP" .br .RI "Collect independent graph bindings without mixing timers into numerical restart history\&. " .ti -1c .RI "struct \fBGraphTimingFactory\fP" .br .RI "Bind one generic timing observer after the model's complete graph type is known\&. " .ti -1c .RI "struct \fBGraphTimingRun\fP" .br .RI "One graph binding's declaration-ordered catalog, including nodes which never execute\&. " .ti -1c .RI "struct \fBHasBinding\fP" .br .ti -1c .RI "struct \fBKeyList\fP" .br .RI "An ordered collection of role keys, independent of their associated value types\&. " .ti -1c .RI "struct \fBKeyListBindings\fP" .br .ti -1c .RI "struct \fBKeyListBindings< BindingsT, KeyList< KeyTs\&.\&.\&. > >\fP" .br .ti -1c .RI "struct \fBNodeObserver\fP" .br .ti -1c .RI "struct \fBNodeTiming\fP" .br .RI "Wall time for attempted node work, independently of later cache or Newton acceptance\&. " .ti -1c .RI "struct \fBNoGraphObservers\fP" .br .RI "Default high-level binding adds no observation storage, timers, or callback work\&. " .ti -1c .RI "class \fBObservers\fP" .br .RI "Own registrations; execution state lasts for one invocation and is never part of the numerical cache\&. " .ti -1c .RI "struct \fBPreparationFailure\fP" .br .ti -1c .RI "struct \fBPreparationReport\fP" .br .ti -1c .RI "class \fBProjectedSnapshot\fP" .br .ti -1c .RI "struct \fBResolveKeys\fP" .br .ti -1c .RI "struct \fBResolveKeys< BindingsT, KeyList< KeyTs\&.\&.\&. > >\fP" .br .ti -1c .RI "class \fBResource\fP" .br .ti -1c .RI "struct \fBSteadyNodeClock\fP" .br .RI "Read monotonic elapsed wall time without changing physical computations\&. " .ti -1c .RI "struct \fBValueSnapshot\fP" .br .RI "Default tracking owns an exact value copy; noncopyable resources supply another policy\&. " .in -1c .SS "Concepts" .in +1c .ti -1c .RI "concept \fBIsBinding\fP" .br .ti -1c .RI "concept \fBIsBindings\fP" .br .ti -1c .RI "concept \fBBindingsWithBinding\fP" .br .ti -1c .RI "concept \fBIsComputation\fP" .br .ti -1c .RI "concept \fBCompatibleComputations\fP" .br .RI "A computational graph needs unique producers, valid input ownership, and no cycles\&. " .ti -1c .RI "concept \fBIsComputationGraph\fP" .br .ti -1c .RI "concept \fBIsDependencyContext\fP" .br .ti -1c .RI "concept \fBCanPrepare\fP" .br .ti -1c .RI "concept \fBComputationGraphFor\fP" .br .ti -1c .RI "concept \fBIsKeyList\fP" .br .ti -1c .RI "concept \fBSatisfiesKeyList\fP" .br .ti -1c .RI "concept \fBContainsKey\fP" .br .RI "Test exact key membership, rejecting malformed and duplicate-key lists\&. " .ti -1c .RI "concept \fBNodeObserverCallbacks\fP" .br .RI "Completion must be safe during stack unwinding and receives the state created by the before hook\&. " .ti -1c .RI "concept \fBKeyedNodeObserverCallbacks\fP" .br .RI "An all-node callback receives the compiled result identity before creating its invocation state\&. " .ti -1c .RI "concept \fBObserversFor\fP" .br .RI "Reject unknown nodes, nonexistent edges, and callbacks that cannot observe the graph's immutable values\&. " .ti -1c .RI "concept \fBIsResource\fP" .br .ti -1c .RI "concept \fBSnapshotPolicyFor\fP" .br .ti -1c .RI "concept \fBNodeTimingClock\fP" .br .RI "Restrict injected clocks to ordinary arithmetic chrono values safe in a closing callback\&. " .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "template using \fBbound_type_t\fP = \fBBoundType\fP::target_type" .br .ti -1c .RI "template using \fBInputList\fP = \fBKeyList\fP" .br .RI "\fBComputation\fP arguments are supplied in this key order\&. " .ti -1c .RI "template using \fBRequestedResults\fP = \fBKeyList\fP" .br .RI "Preparing these results also prepares their required intermediate computations\&. " .ti -1c .RI "template using \fBResolvedTargets\fP = \fBResolveKeys\fP>::type" .br .ti -1c .RI "template using \fBCombinedKeyList\fP = \fBdetail::MergeKeyLists\fP<\fBKeyList\fP<>, std::remove_cvref_t\&.\&.\&.>::type" .br .RI "Combine requirements in first-appearance order, retaining distinct keys with shared targets\&. " .in -1c .SS "Enumerations" .in +1c .ti -1c .RI "enum class \fBNodeOutcome\fP { \fBcompleted\fP, \fBrejected\fP, \fBexception\fP }" .br .RI "Describe a node invocation, independently of whether the whole graph request is later accepted\&. " .ti -1c .RI "enum class \fBPreparationMode\fP { \fBreuse_unchanged\fP, \fBrebuild\fP }" .br .ti -1c .RI "enum class \fBPreparationStatus\fP { \fBnot_required\fP, \fBreused\fP, \fBcomputed\fP }" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "template .br requires std::constructible_from, FunctionT>auto \fBmake_computation\fP (FunctionT &&function)" .br .RI "Attach an output key and ordered input keys to a lambda, function, or other callable\&. " .ti -1c .RI "template .br requires std::constructible_from, FunctionT>auto \fBmake_owning_computation\fP (FunctionT &&function)" .br .RI "Supply immutable shared handles to computed prerequisites so results can retain them without copying\&. " .ti -1c .RI "template> .br requires CanPrepare && ObserversFor && std::constructible_from, GraphT> && std::constructible_from, ObserversT>auto \fBmake_computation_cache\fP (GraphT &&graph, const ContextT &, ObserversT &&observers=ObserversT{})" .br .RI "Fix the graph's source types without retaining the supplied context or evaluating any computations\&. " .ti -1c .RI "template .br requires CompatibleComputations && (std::constructible_from, Computations> && \&.\&.\&.) && CanPrepare<\fBComputationGraph\fP\&.\&.\&.>, ContextT, ErrorT>auto \fBmake_computation_cache\fP (const ContextT &context, Computations &&\&.\&.\&. computations)" .br .RI "Build a checked graph and an empty cache directly from named computations\&. " .ti -1c .RI "template .br requires CompatibleComputations && (std::constructible_from, Computations> && \&.\&.\&.)auto \fBmake_computation_graph\fP (Computations &&\&.\&.\&. computations)" .br .RI "Reject duplicate producers and cyclic computational graphs at the declaration site\&. " .ti -1c .RI "template .br requires (IsResource && \&.\&.\&.) && \fBmisc::traits::all_unique_types_v\fP::Key\&.\&.\&.>auto \fBmake_dependency_context\fP (Resources &&\&.\&.\&. resources)" .br .RI "Build a context whose schema follows directly from its resource keys and types\&. " .ti -1c .RI "template .br requires (\fBdetail::combinable_resources\fP(\fBmisc::concepts::ConcatT\fP{}))auto \fBcombine_dependency_contexts\fP (const Contexts &\&.\&.\&. contexts)" .br .RI "Copy disjoint resources and their tracking policies into one context; borrowed objects retain their original lifetime\&. " .ti -1c .RI "template .br requires ContainsKeyconsteval std::size_t \fBkey_index\fP ()" .br .RI "Locate a declared key in its ordered list; absent keys are rejected at compile time\&. " .ti -1c .RI "template .br requires NodeObserverCallbacks, std::decay_t> && std::constructible_from, BeforeT> && std::constructible_from, AfterT>auto \fBobserve_node\fP (BeforeT &&before, AfterT &&after)" .br .RI "Bind before/after callbacks to a result key; callback captures determine any external storage lifetime\&. " .ti -1c .RI "template .br requires std::constructible_from, BeforeT> && std::constructible_from, AfterT>auto \fBobserve_nodes\fP (BeforeT &&before, AfterT &&after)" .br .RI "Observe all executed nodes; cache construction checks the callback contract for every result key\&. " .ti -1c .RI "template .br requires std::constructible_from, FunctionT>auto \fBobserve_edge\fP (FunctionT &&function)" .br .RI "Bind a read-only callback to one input of one consumer; graph construction validates the edge and value type\&. " .ti -1c .RI "template .br requires (\fBdetail::is_observer_v\fP> && \&.\&.\&.) && (std::constructible_from, Registrations> && \&.\&.\&.)auto \fBmake_observers\fP (Registrations &&\&.\&.\&. observers)" .br .RI "Collect any number of registrations, including several observers of the same node or edge\&. " .ti -1c .RI "template auto \fBown\fP (ValueT &&value, PolicyT policy={})" .br .RI "Store a value in the context; rvalues transfer ownership and lvalues are copied\&. " .ti -1c .RI "template auto \fBborrow\fP (ValueT &value, PolicyT policy={})" .br .RI "Bind an existing object whose lifetime must cover every use of the context\&. " .ti -1c .RI "template auto \fBborrow\fP (const ValueT &&, PolicyT={})=delete" .br .RI "Borrowed storage must never refer to a temporary, including a const temporary\&. " .ti -1c .RI "template auto \fBtrack_by\fP (FunctionT &&function)" .br .RI "Select the state that determines whether a source needs recomputation\&. " .ti -1c .RI "template .br requires SnapshotPolicyForconst void * \fBsource_identity\fP (const PolicyT &policy, const ValueT &value)" .br .RI "Views may identify their underlying resource; ordinary sources retain object identity\&. " .ti -1c .RI "template auto \fBtime_graph_nodes\fP (\fBGraphTiming\fP &timing, Clock clock={})" .br .RI "Opt into node timings; a custom clock supports deterministic accounting tests without sleeps\&. " .in -1c .SS "Variables" .in +1c .ti -1c .RI "template constexpr bool \fBis_bindings_v\fP = false" .br .ti -1c .RI "template constexpr bool \fBis_bindings_v< Bindings< BindingTs\&.\&.\&. > >\fP = \fBmisc::traits::all_unique_types_v\fP" .br .ti -1c .RI "template constexpr bool \fBhas_binding_v\fP = \fBHasBinding\fP::value" .br .ti -1c .RI "template constexpr bool \fBis_computation_v\fP = false" .br .ti -1c .RI "template constexpr bool \fBis_computation_v< Computation< KeyT, InputsT, FunctionT, OwnsInputs > >\fP = true" .br .ti -1c .RI "template constexpr bool \fBis_computation_graph_v\fP = false" .br .ti -1c .RI "template constexpr bool \fBis_computation_graph_v< ComputationGraph< Computations\&.\&.\&. > >\fP = true" .br .ti -1c .RI "template constexpr bool \fBis_dependency_context_v\fP = false" .br .ti -1c .RI "template constexpr bool \fBis_dependency_context_v< DependencyContext< Resources\&.\&.\&. > >\fP = true" .br .ti -1c .RI "template constexpr bool \fBis_dependency_context_v< DependencyContextView< ParentT, KeysT > >\fP = true" .br .ti -1c .RI "template constexpr bool \fBis_key_list_v\fP = false" .br .ti -1c .RI "template constexpr bool \fBis_key_list_v< KeyList< KeyTs\&.\&.\&. > >\fP = \fBmisc::traits::all_unique_types_v\fP" .br .ti -1c .RI "template constexpr std::size_t \fBkey_count_v\fP = \fBdetail::KeyListSize\fP>::value" .br .RI "Count distinct declared keys without constructing their associated values\&. " .ti -1c .RI "std::unordered_map< \fBPreparationStatus\fP, std::string_view > \fBpreparation_status_name_map\fP = \fBmeta::enum_to_enum_string_map\fP<\fBPreparationStatus\fP>()" .br .ti -1c .RI "std::unordered_map< \fBPreparationMode\fP, std::string_view > \fBpreparation_mode_name_map\fP = \fBmeta::enum_to_enum_string_map\fP<\fBPreparationMode\fP>()" .br .ti -1c .RI "template constexpr bool \fBis_resource_v\fP = false" .br .ti -1c .RI "template constexpr bool \fBis_resource_v< Resource< KeyT, StorageT, PolicyT > >\fP = true" .br .in -1c .SH "Detailed Description" .PP \fIComputational Graphs\fP .PP Demonstration code for how to use the SERiF computational graph system The broad idea here is that there are many calculations which depend on each other but which may not necessarily always need to be recomputed just because another part of the model has changed\&. We model this as a combination of an acyclic computational graph, defined at compile time, and a runtime cache of values\&. The general workflow is that a developer defines the "context" of the computational graph, think of this as all of the inputs to the graph, or maybe more specifically, anything that could change due to some external event (e\&.g\&. a time step, a newton step, etc\&.\&.\&.) This context is probably the most CS intensive part of this code as the developer needs to think about lifetimes and ownership\&. .PP \fBContext\fP Contexts are made with the make_dependency_context function, this accepts a variadic pack of bindings between a type and a runtime value\&. You can generate these yourself using the binding functions and types; however, we provide two convenience wrappers which generally developers should consider using\&. .IP "\(bu" 2 borrow: Used to bind a type to a reference to a value\&. This is useful for values which are owned by the caller and which the caller will manage the lifetime of (takes an lvalue)\&. .IP "\(bu" 2 own: Used to bind a type to a value which is owned by the context (copies an lvalue or moves an rvalue) Each of these functions accepts a type as a template parameter and a runtime value as an argument\&. The type is used as an ID, this is key to understand, if we write .PP .nf using namespace serif::utils::dependencies; double x{1\&.0}; auto context = make_dependency_context(borrow(x)); .fi .PP .PP .PP we are not saying that x is of type \fBkeys::Input\fP, this is clearly not the case\&. Rather, we are registering in the computational graph a binding between the type \fBkeys::Input\fP and the runtime value x\&. Think of this as naming the various inputs to the graph\&. .PP \fBComputations\fP After defining a context we can define a computation, each computation defines a node, while its ordered input keys define the incoming edges\&. Consider the following example (assuming the context from above): .PP .PP .nf auto func = make_computation>( [](const double _x) \-> double { return _x * _x; } ); .fi .PP .PP what we have defined here is a node which takes a single input tagged \fBkeys::Input\fP and produces an output tagged as \fBkeys::Output\fP\&. The input key declares an edge from that source to this node\&. Other nodes can use \fBkeys::Output\fP as an input, and a successfully prepared result can be read with get or retained with share\&. These connections allow us to form a larger graph\&. Consider now the following code .PP .PP .nf using namespace serif::utils::dependencies; struct tags { struct X{}; struct Y{}; struct Output1{}; struct Output2{}; }; double x{1\&.0}; double y{2\&.0}; auto context = make_dependency_context(borrow(x), borrow(y)); auto func1 = make_computation>( [](const double _x) \-> double { return _x * _x; } ); auto func2 = make_computation>( [](const double _x, const double _y) \-> double { return _x + _y; } ); .fi .PP .PP we have now defined two computations, the first takes a single input, whichever input is tagged as tags::X and produces an output tagged as tags::Output1\&. The second computation takes two inputs, the first is the output of the first computation (lookup by the tag) and the second is whichever input is tagged as tags::Y, and produces an output tagged as tags::Output2\&. Note that the order of arguments to the lambda must be the same as the order of the tags in the \fBInputList\fP, the dependencies module will automatically order arguments based on the \fBInputList\fP\&. There is type checking to ensure that the types match, but if you have two inputs of the same type that are flipped there is no way for the system to inspect that and warn you\&. Further, depending on your compiler and flags there may be implicit casting between convertable types (e\&.g\&. int <-> double)\&. .PP \fBTodo\fP .RS 4 We may want to remove the ability to have implicit casting between types, this is a bit of a footgun and may lead to subtle bugs\&. .RE .PP .PP \fBNote\fP .RS 4 This is primary goal of this system, split computations into small pieces with the ability to cache intermediate results and reuse as many of those intermediate results as we can can prove is safe to do\&. The whole reason this system is so complex is that very purpose\&. There is a fundamental problem with high dimensional stellar models, they are always going to be slow, therefore we need to accept some degree of complexity in order to make them tractable\&. .RE .PP \fB\fBComputation\fP Cache\fP Once we have the computations we need to connect them together, generally use the helper function make_computation_cache which takes a context and a variadic pack of computations\&. There are \fIa lot\fP of compile time checks which run to ensure that the graph is valid, the context describes what is needed to compute the graph, and that each computation is valid\&. Generally if a static analysis error or compile error pops up here it probably means there is a mistake in the definition of the context or the computations\&. I've tried to make these errors as clear as possible; however, there is only so much that you can do with the C++ compiler\&. I recommend first checking, probably with a drawn-out diagram, that all the tags are correct and what you expect\&. .PP A developer can also choose to use the make_computation_graph function to explicitly name a graph\&. This is useful when naming or reusing a collection of computations (make_computation_cache calls make_computation_graph and then fixes the source types from the supplied context without retaining the context)\&. Now consider the following code assuming the context and computations from above: .PP .PP .nf auto graph_cache = make_computation_cache(context, func1, func2); .fi .PP .PP At this point we have a cache which we can access various parts of; however, no computations have been run yet\&. To run a computation we must call try_prepare\&. .PP try_prepare returns std::expected: ordinary rejection is a value, and no candidate results or snapshots are published on failure\&. Exceptions from a callable or snapshot policy propagate with the same cache protection\&. Previously retained results remain valid, but get and share require a successful current preparation\&. Always check the report before reading results\&. .PP try_prepare takes the context and evaluates the requested nodes and their prerequisites, reusing unchanged results\&. By default every result is requested, so the first call evaluates the entire graph\&. \fBRequestedResults\fP can restrict evaluation to a branch\&. .PP .PP .nf auto report = graph_cache\&.try_prepare(context); if (!report) { return; // Handle report\&.error() before reading the cache\&. } double func1_result = graph_cache\&.template get(); double func2_result = graph_cache\&.template get(); auto func1_status = report\->template status(); auto func2_status = report\->template status(); std::string_view func1_status_string = preparation_status_name_map[func1_status]; // note this is an inline map defined in serif::utils::dependencies std::string_view func2_status_string = preparation_status_name_map[func2_status]; std::println("Func1 Result: {}, Func2 Result: {}, Func1 Status: {}, Func2 Status: {}", func1_result, func2_result, func1_status_string, func2_status_string); .fi .PP .PP Now what we could do is change only one part of the input context and call try_prepare again\&. Lets say we change only y, such that only func2 is stale\&. .PP .PP .nf y = 3\&.0; report = graph_cache\&.try_prepare(context); if (!report) { return; // Handle report\&.error() before reading the cache\&. } double func1_result = graph_cache\&.template get(); double func2_result = graph_cache\&.template get(); auto func1_status = report\->template status(); auto func2_status = report\->template status(); std::string_view func1_status_string = preparation_status_name_map[func1_status]; // note this is an inline map defined in serif::utils::dependencies std::string_view func2_status_string = preparation_status_name_map[func2_status]; std::println("Func1 Result: {}, Func2 Result: {}, Func1 Status: {}, Func2 Status: {}", func1_result, func2_result, func1_status_string, func2_status_string); .fi .PP .SH "Typedef Documentation" .PP .SS "template using \fBserif::utils::dependencies::bound_type_t\fP = \fBBoundType\fP::target_type" .SS "template using \fBserif::utils::dependencies::CombinedKeyList\fP = \fBdetail::MergeKeyLists\fP<\fBKeyList\fP<>, std::remove_cvref_t\&.\&.\&.>::type" .PP Combine requirements in first-appearance order, retaining distinct keys with shared targets\&. .SS "template using \fBserif::utils::dependencies::InputList\fP = \fBKeyList\fP" .PP \fBComputation\fP arguments are supplied in this key order\&. .SS "template using \fBserif::utils::dependencies::RequestedResults\fP = \fBKeyList\fP" .PP Preparing these results also prepares their required intermediate computations\&. .SS "template using \fBserif::utils::dependencies::ResolvedTargets\fP = \fBResolveKeys\fP>::type" .SH "Enumeration Type Documentation" .PP .SS "enum class \fBserif::utils::dependencies::NodeOutcome\fP\fR [strong]\fP" .PP Describe a node invocation, independently of whether the whole graph request is later accepted\&. .PP \fBEnumerator\fP .in +1c .TP \f(BIcompleted \fP .TP \f(BIrejected \fP .TP \f(BIexception \fP .SS "enum class \fBserif::utils::dependencies::PreparationMode\fP\fR [strong]\fP" .PP \fBEnumerator\fP .in +1c .TP \f(BIreuse_unchanged \fP .TP \f(BIrebuild \fP .SS "enum class \fBserif::utils::dependencies::PreparationStatus\fP\fR [strong]\fP" .PP \fBEnumerator\fP .in +1c .TP \f(BInot_required \fP .TP \f(BIreused \fP .TP \f(BIcomputed \fP .SH "Function Documentation" .PP .SS "template auto serif::utils::dependencies::borrow (const ValueT && , PolicyT = \fR{}\fP)\fR [delete]\fP" .PP Borrowed storage must never refer to a temporary, including a const temporary\&. .SS "template auto serif::utils::dependencies::borrow (ValueT & value, PolicyT policy = \fR{}\fP)\fR [nodiscard]\fP" .PP Bind an existing object whose lifetime must cover every use of the context\&. .SS "template .br requires (\fBdetail::combinable_resources\fP(\fBmisc::concepts::ConcatT\fP{}))auto serif::utils::dependencies::combine_dependency_contexts (const Contexts &\&.\&.\&. contexts)\fR [nodiscard]\fP" .PP Copy disjoint resources and their tracking policies into one context; borrowed objects retain their original lifetime\&. .SS "template .br requires ContainsKeystd::size_t serif::utils::dependencies::key_index ()\fR [nodiscard]\fP, \fR [consteval]\fP" .PP Locate a declared key in its ordered list; absent keys are rejected at compile time\&. .SS "template .br requires std::constructible_from, FunctionT>auto serif::utils::dependencies::make_computation (FunctionT && function)\fR [nodiscard]\fP" .PP Attach an output key and ordered input keys to a lambda, function, or other callable\&. .SS "template .br requires CompatibleComputations && (std::constructible_from, Computations> && \&.\&.\&.) && CanPrepare<\fBComputationGraph\fP\&.\&.\&.>, ContextT, ErrorT>auto serif::utils::dependencies::make_computation_cache (const ContextT & context, Computations &&\&.\&.\&. computations)\fR [nodiscard]\fP" .PP Build a checked graph and an empty cache directly from named computations\&. .SS "template> .br requires CanPrepare && ObserversFor && std::constructible_from, GraphT> && std::constructible_from, ObserversT>auto serif::utils::dependencies::make_computation_cache (GraphT && graph, const ContextT & , ObserversT && observers = \fRObserversT{}\fP)\fR [nodiscard]\fP" .PP Fix the graph's source types without retaining the supplied context or evaluating any computations\&. .SS "template .br requires CompatibleComputations && (std::constructible_from, Computations> && \&.\&.\&.)auto serif::utils::dependencies::make_computation_graph (Computations &&\&.\&.\&. computations)\fR [nodiscard]\fP" .PP Reject duplicate producers and cyclic computational graphs at the declaration site\&. .SS "template .br requires (IsResource && \&.\&.\&.) && \fBmisc::traits::all_unique_types_v\fP::Key\&.\&.\&.>auto serif::utils::dependencies::make_dependency_context (Resources &&\&.\&.\&. resources)\fR [nodiscard]\fP" .PP Build a context whose schema follows directly from its resource keys and types\&. .SS "template .br requires (\fBdetail::is_observer_v\fP> && \&.\&.\&.) && (std::constructible_from, Registrations> && \&.\&.\&.)auto serif::utils::dependencies::make_observers (Registrations &&\&.\&.\&. observers)\fR [nodiscard]\fP" .PP Collect any number of registrations, including several observers of the same node or edge\&. .SS "template .br requires std::constructible_from, FunctionT>auto serif::utils::dependencies::make_owning_computation (FunctionT && function)\fR [nodiscard]\fP" .PP Supply immutable shared handles to computed prerequisites so results can retain them without copying\&. .PP \fBNote\fP .RS 4 Every input must be produced by this graph\&. Context sources remain borrowed and cannot be retained this way\&. Resources borrowed inside a prerequisite must still outlive their use; the handle owns only the computed result\&. .RE .PP .SS "template .br requires std::constructible_from, FunctionT>auto serif::utils::dependencies::observe_edge (FunctionT && function)\fR [nodiscard]\fP" .PP Bind a read-only callback to one input of one consumer; graph construction validates the edge and value type\&. .SS "template .br requires NodeObserverCallbacks, std::decay_t> && std::constructible_from, BeforeT> && std::constructible_from, AfterT>auto serif::utils::dependencies::observe_node (BeforeT && before, AfterT && after)\fR [nodiscard]\fP" .PP Bind before/after callbacks to a result key; callback captures determine any external storage lifetime\&. .SS "template .br requires std::constructible_from, BeforeT> && std::constructible_from, AfterT>auto serif::utils::dependencies::observe_nodes (BeforeT && before, AfterT && after)\fR [nodiscard]\fP" .PP Observe all executed nodes; cache construction checks the callback contract for every result key\&. .SS "template auto serif::utils::dependencies::own (ValueT && value, PolicyT policy = \fR{}\fP)\fR [nodiscard]\fP" .PP Store a value in the context; rvalues transfer ownership and lvalues are copied\&. .SS "template .br requires SnapshotPolicyForconst void * serif::utils::dependencies::source_identity (const PolicyT & policy, const ValueT & value)\fR [nodiscard]\fP" .PP Views may identify their underlying resource; ordinary sources retain object identity\&. .SS "template auto serif::utils::dependencies::time_graph_nodes (\fBGraphTiming\fP & timing, Clock clock = \fR{}\fP)\fR [nodiscard]\fP" .PP Opt into node timings; a custom clock supports deterministic accounting tests without sleeps\&. .SS "template auto serif::utils::dependencies::track_by (FunctionT && function)\fR [nodiscard]\fP" .PP Select the state that determines whether a source needs recomputation\&. .SH "Variable Documentation" .PP .SS "template bool serif::utils::dependencies::has_binding_v = \fBHasBinding\fP::value\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool serif::utils::dependencies::is_bindings_v = false\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool \fBserif::utils::dependencies::is_bindings_v\fP< \fBBindings\fP< BindingTs\&.\&.\&. > > = \fBmisc::traits::all_unique_types_v\fP\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool serif::utils::dependencies::is_computation_graph_v = false\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool \fBserif::utils::dependencies::is_computation_graph_v\fP< \fBComputationGraph\fP< Computations\&.\&.\&. > > = true\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool serif::utils::dependencies::is_computation_v = false\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool \fBserif::utils::dependencies::is_computation_v\fP< \fBComputation\fP< KeyT, InputsT, FunctionT, OwnsInputs > > = true\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool serif::utils::dependencies::is_dependency_context_v = false\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool \fBserif::utils::dependencies::is_dependency_context_v\fP< \fBDependencyContext\fP< Resources\&.\&.\&. > > = true\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool \fBserif::utils::dependencies::is_dependency_context_v\fP< \fBDependencyContextView\fP< ParentT, KeysT > > = true\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool serif::utils::dependencies::is_key_list_v = false\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool \fBserif::utils::dependencies::is_key_list_v\fP< \fBKeyList\fP< KeyTs\&.\&.\&. > > = \fBmisc::traits::all_unique_types_v\fP\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool serif::utils::dependencies::is_resource_v = false\fR [inline]\fP, \fR [constexpr]\fP" .SS "template bool \fBserif::utils::dependencies::is_resource_v\fP< \fBResource\fP< KeyT, StorageT, PolicyT > > = true\fR [inline]\fP, \fR [constexpr]\fP" .SS "template std::size_t serif::utils::dependencies::key_count_v = \fBdetail::KeyListSize\fP>::value\fR [inline]\fP, \fR [constexpr]\fP" .PP Count distinct declared keys without constructing their associated values\&. .SS "std::unordered_map<\fBPreparationMode\fP, std::string_view> serif::utils::dependencies::preparation_mode_name_map = \fBmeta::enum_to_enum_string_map\fP<\fBPreparationMode\fP>()\fR [inline]\fP" .SS "std::unordered_map<\fBPreparationStatus\fP, std::string_view> serif::utils::dependencies::preparation_status_name_map = \fBmeta::enum_to_enum_string_map\fP<\fBPreparationStatus\fP>()\fR [inline]\fP" .SH "Author" .PP Generated automatically by Doxygen for SERiF from the source code\&.