-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
47 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package scalapipe.dsl | ||
|
||
import scalapipe._ | ||
|
||
object Cycle { | ||
def apply(t: Type) = new Cycle(t) | ||
} | ||
|
||
class Cycle(val t: Type) { | ||
|
||
private var stream: Stream = null | ||
|
||
private val kernel = new Kernel { | ||
val in = input(t) | ||
val out = output(t) | ||
out = in | ||
} | ||
|
||
private var instance: KernelInstance = null | ||
|
||
private[dsl] def output(sp: ScalaPipe): Stream = { | ||
instance = sp.createInstance(kernel) | ||
instance.apply()() | ||
} | ||
|
||
def apply(s: Stream) { | ||
if (instance == null) { | ||
Error.raise("unconnected cycle") | ||
} else { | ||
instance.setInput(null, s) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters