src/framework/operations.hpp
// TODO: convert if-else to switch
convert if-else to switch
convert if - else to switch
Op json_to_op(const json_t &js) {
  std::string name;
  JSON::get_value(name, "name", js);
  if (name == "barrier")
    return json_to_op_barrier(js);
  if (name == "measure")
    return json_to_op_measure(js);
  if (name == "reset")
    return json_to_op_reset(js);
  if (name == "initialize")
    return json_to_op_initialize(js);
  if (name == "unitary")
    return json_to_op_unitary(js);
  if (name == "superop")
    return json_to_op_superop(js);
  if (name == "snapshot")
    return json_to_op_snapshot(js);
  if (name == "bfunc")
    return json_to_op_bfunc(js);
  if (name == "noise_switch")
    return json_to_op_noise_switch(js);
  if (name == "multiplexer")
    return json_to_op_multiplexer(js);
  if (name == "kraus")
    return json_to_op_kraus(js);
  if (name == "roerror")
    return json_to_op_roerror(js);
  return json_to_op_gate(js);
}
Op json_to_op ( const json_t & js ) { std :: string name ; JSON :: get_value ( name , " " , js ) ; if ( name == " " ) return json_to_op_barrier ( js ) ; if ( name == " " ) return json_to_op_measure ( js ) ; if ( name == " " ) return json_to_op_reset ( js ) ; if ( name == " " ) return json_to_op_initialize ( js ) ; if ( name == " " ) return json_to_op_unitary ( js ) ; if ( name == " " ) return json_to_op_superop ( js ) ; if ( name == " " ) return json_to_op_snapshot ( js ) ; if ( name == " " ) return json_to_op_bfunc ( js ) ; if ( name == " " ) return json_to_op_noise_switch ( js ) ; if ( name == " " ) return json_to_op_multiplexer ( js ) ; if ( name == " " ) return json_to_op_kraus ( js ) ; if ( name == " " ) return json_to_op_roerror ( js ) ; return json_to_op_gate ( js ) ; }
TODO: convert if-else to switch
TODO : convert if - else to switch
// load operation identifier // Barrier // Measure & Reset // Arbitrary matrix gates // Snapshot // Bit functions // Noise functions // Default assume gate