Blocks and flowgraph: added this time
This commit is contained in:
28
oxydsp-flowgraph/src/graph.rs
Normal file
28
oxydsp-flowgraph/src/graph.rs
Normal file
@ -0,0 +1,28 @@
|
||||
use crate::block::GraphableBlock;
|
||||
|
||||
pub struct FlowGraph
|
||||
{
|
||||
blocks: Vec<Box<dyn GraphableBlock + Send + 'static>>,
|
||||
}
|
||||
|
||||
impl FlowGraph
|
||||
{
|
||||
pub fn new() -> Self
|
||||
{
|
||||
FlowGraph { blocks: vec![] }
|
||||
}
|
||||
|
||||
pub fn add_block<T: GraphableBlock + Send + 'static>(&mut self, block: T)
|
||||
{
|
||||
block.set_index(self.blocks.len());
|
||||
self.blocks.push(Box::new(block));
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for FlowGraph
|
||||
{
|
||||
fn default() -> Self
|
||||
{
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user