|
libbio
|
Classes | |
| struct | LinearMotifContentTypeId |
| struct | LinearMotifDispatch |
| struct | LinearMotifDispatch< T, true > |
| struct | MotifCandidate |
| struct | PointerContentRequest |
| struct | WrappedLinearMotifDispatch |
| struct | WrappedLinearMotifDispatch< T, true > |
Functions | |
| void | TryAddWaveCollectVisitor (const Bond &bond, void *ctx) |
| bool | TryAddWaveToAnyMotif (Pointer< physical::Wave > host, Pointer< physical::Wave > payload) |
| bool | TryShareWaveWithAnyMotif (Pointer< physical::Wave > host, Pointer< physical::Wave > payload) |
| template<typename MOTIF > | |
| bool | IsBondedMotifType (Pointer< const physical::Wave > bonded) |
| void | MotifCandidateCollectVisitor (const Bond &bond, void *ctx) |
| template<typename T > | |
| Pointer< UnorderedMotif< T > > | ResolveUnorderedMotif (Pointer< UnorderedStructureInterface > self) |
| template<typename T > | |
| Pointer< const UnorderedMotif< T > > | ResolveUnorderedMotif (Pointer< const UnorderedStructureInterface > self) |
| template<typename T > | |
| Pointer< LinearMotif< T > > | ResolveLinearMotif (Pointer< UnorderedStructureInterface > self) |
| template<typename T > | |
| Pointer< const LinearMotif< T > > | ResolveLinearMotif (Pointer< const UnorderedStructureInterface > self) |
| bool bio::chemical::structure::IsBondedMotifType | ( | Pointer< const physical::Wave > | bonded | ) |
|
inline |
| Pointer< const LinearMotif< T > > bio::chemical::structure::ResolveLinearMotif | ( | Pointer< const UnorderedStructureInterface > | self | ) |
| Pointer< LinearMotif< T > > bio::chemical::structure::ResolveLinearMotif | ( | Pointer< UnorderedStructureInterface > | self | ) |
| Pointer< const UnorderedMotif< T > > bio::chemical::structure::ResolveUnorderedMotif | ( | Pointer< const UnorderedStructureInterface > | self | ) |
| Pointer< UnorderedMotif< T > > bio::chemical::structure::ResolveUnorderedMotif | ( | Pointer< UnorderedStructureInterface > | self | ) |
Try to install a clone of payload into any motif on host that accepts it.
Walks host->AsAtom() bonds (via ForEachBond at v6) looking for AbstractMotif bonds. For each motif, clones the payload and asks the motif to accept the clone via AddWaveByContentType. The first motif whose ChemicalCast<CONTENT_TYPE>(clone) succeeds — i.e. the payload is the motif's CONTENT_TYPE or a subclass — adopts the clone and we return true. Clones rejected by all motifs are deleted before we return false.
Why "try-add-on-each" rather than "match-typeid-then-add": the host's motifs store the contentTypeId of their declared CONTENT_TYPE (e.g. Protein*), but payloads in the canonical flow are typically subclasses (e.g. CanonicalFlowTestProtein*) with their own distinct typeIds. Strict typeId equality misses these. Delegating to AddWaveByContentType lets each motif's ChemicalCast handle the inheritance walk.
Why "clone first, give the clone to the motif" rather than handing the original: LinearMotif::AddImplementation takes ownership of the added pointer (Linearize + SetShared(false)), so any other holder of the original payload would double-free at teardown. The canonical use is Gene → Translate → Insertion, where the Gene's DNA retains the source Protein template and the host receives a fresh copy. Cloning here keeps that contract intact without requiring upstream callers to clone themselves.
Used by genetic::Insertion::Seek's polymorphic-dispatch fast path (lib/bio/src/genetic/localization/Insertion.cpp). The non-template shape is what makes this useful: Insertion has a payload it knows only as Substance* statically; we delegate the type-matching to each motif.
| host | the Wave whose Atom bonds to search. |
| payload | the Wave to clone-and-insert. |
|
inline |
|
inline |
Try to install payload into any motif on host that accepts it, WITHOUT cloning and WITHOUT taking ownership.
Identical bond-walk + motif-accept logic as TryAddWaveToAnyMotif, but routes through AddSharedWaveByContentType — the motif holds the pointer by reference rather than adopting it. The original owner (typically a Gene's DNA::mProtein) remains responsible for the payload's lifetime.
A core wiring primitive (neural axon/dendrite synapse formation, gene expression via RNAPolymerase). The v9 Protein-sharing Expressor path that also used it was removed; this mechanism is independent of that feature. Plasmid authors who use this path don't need their Protein subclasses to be cloneable (no per-instance Class<T> + BIO_DISAMBIGUATE_ALL_CLASS_METHODS scaffolding) — see lib/bio/README.md's Plasmid Integration section for the two integration shapes and the lifetime contract.
IMPORTANT: shared semantics require the host's lifetime to be ≤ the payload's lifetime. The canonical use case is process-singleton plasmids that stay loaded for the process lifetime; hosts that outlive their Plasmid would dangle on these motif slots.
| host | the Wave whose Atom bonds to search. |
| payload | the Wave to share-add. |