Skip to content
Lszaboo edited this page Nov 9, 2025 · 2 revisions

Plans

The Dependent, Observed, Observer, classes require special construction because theese classes can have invalid states. The Plan group of classes help with defining pre-made build methods, which help with this. To use this automatic building system, we have to assign Dependents, Observed, Observers to Plans.

Automatic Plan building

Define Plan2Observer, so that the system knows which Observer to assign to a Dependent created from a Plan.

Define Plan2Dependent, so that the system knows what Dependent to create from what Plan.

Building Dependents

Building of normal Dependents from Plans happens like this:

function buildFromPlan!(plan::PlanDNA,graph::DependentGraphDNA)
    dependent = Plan2Dependent(plan)
    
    add!!(graph,dependent)
    _Plan_(plan)._dependent = dependent

    return dependent
end

So the Dependent is created, then assigned to a Dependency Graph.

Building Observer - Observed pairs

Building of Observer - Observed pairs from Plans happens like this:

function buildFromPlan!(plan::ObservedPlanDNA,graph::DependentGraphDNA,builder::ObserverBuilderDNA)
    observer = Plan2Observer(builder,plan)
    observed = Plan2Dependent(plan) 

    add!!(observer,observed)
    add!!(graph,observed)
    _Plan_(plan)._dependent = observed

    return (observer,observed)
end

As we can see, first an Observed is created, or asked for depending on what an ObserverBuilder gives us. Then an Observed is created. After That the Observed is assigned to the Observer, then to the Dependency graph.

Note that we have to have an ObserverBuilder class, which manages what (new) Observer should get which Observed created from that ObservedPlan.

Wiki navigation sidebar

Legend:

  • ✅: Up-to-date
  • 🏗️: Needs some work
  • ❌: Unusable
  1. 🏗️ Home
  2. 🏗️ Developer Guide
    1. Composition Subclassing
    2. Core Graph
    3. 🏗️ Dependents
    4. 🏗️ Observer and Observed
    5. 🏗️ Plans
    6. 🏗️ Rendered Dependents
    7. Macro Constructors

Clone this wiki locally