All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.sciss.synth.proc.AuxContext.scala Maven / Gradle / Ivy

package de.sciss.synth.proc

import de.sciss.lucre.stm.{Disposable, Sys}

object AuxContext {
  sealed trait Update[S <: Sys[S], +A]
  final case class Added  [S <: Sys[S], A](id: S#ID, value: A) extends Update[S, A]
  final case class Removed[S <: Sys[S]   ](id: S#ID          ) extends Update[S, Nothing]

}
trait AuxContext[S <: Sys[S]] {
  def putAux[A](id: S#ID, value: A)(implicit tx: S#Tx): Unit

  def getAux[A](id: S#ID)(implicit tx: S#Tx): Option[A]

  /** Waits for the auxiliary object to appear. If the object
    * appears the function is applied, otherwise nothing happens.
    */
  def observeAux[A](id: S#ID)(fun: S#Tx => AuxContext.Update[S, A] => Unit)(implicit tx: S#Tx): Disposable[S#Tx]

  def removeAux(id: S#ID)(implicit tx: S#Tx): Unit
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy