StateVar(3U)
π StateVar β the state variable subject base class π
okay so bestie, welcome to StateVar(3U), straight out of the InterViews Reference Manual β¨ this one's a little abstract (literally), but it's the backbone of how Unidraw does state, so let's get into it π«Ά
β¨ NAME β¨
StateVar β state variable subject base class π
πΈ SYNOPSIS πΈ
#include <Unidraw/statevar.h>
π¦ DESCRIPTION π¦
okay so StateVar is the base class for state variable subjects. State variables are the standard way to represent and access state that can be modified by the user or through dataflow π«
Here's the vibe: state variable subjects store the state, and state variable views give you a graphical interface for examining and potentially modifying the state in their subject π so the subject holds the facts, the view is the main character that shows them off.
The StateVar class defines the protocol for state variable subjects. And here's the important part, no cap: it's an abstract class, so you literally cannot instantiate it. Not me trying to new StateVar and getting humbled π it's giving "blueprint only."
π PUBLIC OPERATIONS π
Connector* GetBinding()β returns the connector that the state variable is bound to, which is what makes dataflow work π₯ Data flows through connected connectors with bound state variables: the library automatically assigns one bound state variable's state to another's. The direction of that assignment depends on the participating connectors. Wanna know how to bind state variables to connectors and how to specify the direction of flow? SeeConnector(3U)for the details, iykyk.virtual void Attach(StateVarView*)virtual void Detach(StateVarView*)βAttachassociates the subject with a view, represented by an instance of aStateVarViewsubclass πDetachdissociates a previously attached view. Heads up though: these operations do not ensure that the argument is an appropriate view of the subject. They're trusting like that πvirtual void Notify()βNotifyiterates through the views, calling each one'sUpdateoperation to tell the view that the subject has potentially changed π£Notifyis usually called by the subject's state-modifying operations. It's basically the group chat ping of the class.virtual StateVar& operator = (StateVar&)β the assignment operation should be redefined to carry out subclass-specific assignment semantics βοΈ Typically this operator calls the parent classes' assignment operator and then does some additional assignments of its own. This operator is used during dataflow to transfer state variable values. slay.virtual StateVar* Copy()β returns a copy of the state variable π Subclasses should redefine this operation to return an instance of their type. no shortcuts, bestie.virtual void Read(istream&)virtual void Write(ostream&)β read and write the state variable's contents to a stream, to support catalog operations πReadandWritetypically call first the corresponding operations defined by their parent class, and then they read or write their class-specific state. Note: you must ensure that the objects are read in the same order they are written. order matters fr fr, don't play with that πvirtual ClassId GetClassId()virtual boolean IsA(ClassId)βGetClassIdreturns the unique class identifier for theStateVarsubclass, whileIsAreturns whether the instance is of a class or subclass corresponding to the given identifier πIsAtypically checks the given identifier against the instance's own (as defined by itsGetClassIdoperation) and, failing that, calls its parent classes'IsAoperation. And listen: all subclasses must redefineGetClassIdandIsAto ensure that their identifiers are unique and that instances are written and read properly. non-negotiable π
π PROTECTED OPERATIONS π
StateVar()β the constructor is protected to prevent instantiation π« it's giving "you shall not pass," but make it C++.
π SEE ALSO π
Catalog(3U), Connector(3U), Creator(3U), StateVarView(3U), classes(3U), istream(3C++), ostream(3C++)
reminder bestie: abstract class, so no instantiating. use a subclass or this whole thing stays a vibe and not an object π
and that's the whole page, periodt π this was StateVar(3U) from the Unidraw manual, version dated 6 August 1990 β iconic behavior from 1990 ngl, go off π«Άβ¨
π¦ where this page comes from
- debian bookworm: ivtools-dev 2.0.11d.a1-1+b4
- debian trixie: ivtools-dev 2.0.11d.a1-3+b4
- ubuntu jammy: ivtools-dev 2.0.11d.a1-1build1
- ubuntu noble: ivtools-dev 2.0.11d.a1-3build1
- ubuntu questing: ivtools-dev 2.0.11d.a1-3build7
- ubuntu resolute: ivtools-dev 2.0.11d.a1-3build9
- ubuntu stonking: ivtools-dev 2.1.1+git.2025.07.26.a1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms