Blocks and flowgraph: added this time
This commit is contained in:
28
oxydsp-flowgraph/src/block.rs
Normal file
28
oxydsp-flowgraph/src/block.rs
Normal file
@ -0,0 +1,28 @@
|
||||
use crate::edge::BlockIOIndex;
|
||||
|
||||
pub enum BlockResult
|
||||
{
|
||||
Ok,
|
||||
Terminated,
|
||||
}
|
||||
|
||||
pub trait BlockIO
|
||||
{
|
||||
// Get all of the BlockIOIndices (block index + port) that
|
||||
// this blocks can send data to.
|
||||
fn get_successors(&self) -> Vec<BlockIOIndex>;
|
||||
|
||||
// Sets the index of the current blocks on the shared edges
|
||||
fn set_index(&self, block_index: usize);
|
||||
|
||||
// Number of input/output ports
|
||||
fn input_count(&self);
|
||||
fn output_count(&self);
|
||||
}
|
||||
|
||||
pub trait Block
|
||||
{
|
||||
fn work(&mut self) -> BlockResult;
|
||||
}
|
||||
|
||||
pub trait GraphableBlock: Block + BlockIO {}
|
||||
Reference in New Issue
Block a user