/// Adds an operator/node to the topology and returns its internal index. If the node exists, it simply returns its index
///
/// # Arguments
///
/// `id`: The operator id
///
/// `name`: The name of the operator
///
/// `instances`: The total number of operator instances
Adds an operator/node to the topology and returns its internal index. If the node exists, it simply returns its index
Adds an operator / node to the topology and returns its internal index . If the node exists it simply returns its index
pub fn add_unique_node(&mut self, id: &str, name: &str, instances: u32) -> NodeIndex
    {
        let d = &mut self.dictionary;
        let lg = &mut self.logical_graph;
        let idx = d.entry(id.to_string())
                    .or_insert_with(||
                        {
                            let op1 = Operator::new(id,name,instances);
                            (lg.add_node(op1),instances)
                        }
                    );
        // Registered instances must match the provided number
        assert_eq!(instances,idx.1);
        match lg.node_weight(idx.0)
        { // Registered name must match the provided one
            Some(op_info) => assert_eq!(op_info.name,name.to_string()),
            None => panic!("Operator not found in topology.")
        }
        idx.0
    }
pub fn add_unique_node ( & mut self , id : & str , name : & str , instances : u32 ) -> NodeIndex { let d = & mut self . dictionary ; let lg = & mut self . logical_graph ; let idx = d . entry ( id . to_string ( ) ) . or_insert_with ( | | { let op1 = Operator :: new ( id , name , instances ) ; ( lg . add_node ( op1 ) , instances ) } ) ; // Registered instances must match the provided number assert_eq ! ( instances idx 1 ) ; match lg . node_weight ( idx . 0 ) { // Registered name must match the provided one Some ( op_info ) => assert_eq ! ( op_info name name to_string ( ) ) , None => panic ! ( " " ) } idx . 0 }
Adds an operator/node to the topology and returns its internal index.
Adds an operator / node to the topology and returns its internal index .
&mut self
id
&str
name
&str
instances
u32