(
id: &str,
src: &mut interlayer::Connection,
connections: &mut HashMap<String, interlayer::Connection>,
nodes: &mut HashMap<String, interlayer::Node>,
)
| 91 | } |
| 92 | |
| 93 | pub fn bcast( |
| 94 | id: &str, |
| 95 | src: &mut interlayer::Connection, |
| 96 | connections: &mut HashMap<String, interlayer::Connection>, |
| 97 | nodes: &mut HashMap<String, interlayer::Node>, |
| 98 | ) { |
| 99 | if src.rx.len() > 1 { |
| 100 | let node_name = format!("__{}xBcast__", id); |
| 101 | let bcast_p = |port_name: &str| interlayer::Port { |
| 102 | node_type: vec!["Bcast".to_owned()], |
| 103 | node_name: node_name.clone(), |
| 104 | port_type: interlayer::PortTy::Unit, |
| 105 | port_name: port_name.to_owned(), |
| 106 | port_tag: None, |
| 107 | }; |
| 108 | |
| 109 | let rx = std::mem::replace(&mut src.rx, vec![bcast_p("inp")]); |
| 110 | |
| 111 | for (i, p) in rx.into_iter().enumerate() { |
| 112 | let name = format!("__{}xBcastxOut{}__", id, i); |
| 113 | connections.insert( |
| 114 | name, |
| 115 | interlayer::Connection { |
| 116 | cap: src.cap, |
| 117 | rx: vec![p], |
| 118 | tx: vec![bcast_p("[out]")], |
| 119 | }, |
| 120 | ); |
| 121 | } |
| 122 | |
| 123 | nodes.insert( |
| 124 | node_name.clone(), |
| 125 | interlayer::Node { |
| 126 | entity: interlayer::Entity { |
| 127 | name: node_name, |
| 128 | ty: vec!["Bcast".to_owned()], |
| 129 | args: Default::default(), |
| 130 | }, |
| 131 | cloned: Some(1), |
| 132 | res: vec![], |
| 133 | is_dyn: false, |
| 134 | inputs: vec!["inp".to_owned()], |
| 135 | outputs: vec!["[out]".to_owned()], |
| 136 | is_shared: false, |
| 137 | }, |
| 138 | ); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | pub fn dyn_inp_trans( |
| 143 | src: &mut presentation::NamedConn, |
no test coverage detected