void cpp_gen::visit(const mfast::sequence_field_instruction* inst, void*) { std::string name( cpp_name( inst ) ); std::size_t index = inst->field_index(); add_to_instruction_list(name); prefixes_.push_back(name); if (inst->length_instruction()) { std::string context = gen_op_context(inst->length_instruction()->name(), inst->length_instruction()->op_context()); // length out_ << "static uint32_field_instruction\n" << prefix_string() << name << "_length_instruction(\n" << " 0," << " " << get_operator_name(inst->length_instruction()) << ",\n" << " " << get_presence(inst->length_instruction()) << ",\n" << " " << inst->length_instruction()->id() << ", // id\n" << " \""<< inst->length_instruction()->name() << "\", // name\n" << " \""<< inst->length_instruction()->ns() << "\", // ns\n" << " "<< context << ", // opContext\n" << " int_value_storage<uint32_t>("; if (!inst->length_instruction()->initial_value().is_empty()) out_ << inst->length_instruction()->initial_value().get<uint32_t>() << "U"; out_ << ")); // initial_value\n\n"; } if ( !contains_only_templateRef(inst) ) { subinstructions_list_.resize(subinstructions_list_.size()+1); traverse(inst, "_element"); } std::string lengthInstruction; if (inst->length_instruction()) { std::stringstream strm; strm << "&" << prefix_string() << name << "_length_instruction"; lengthInstruction = strm.str(); } std::string subinstruction_arg = get_subinstructions(inst); out_ << "const static mfast::sequence_field_instruction\n" << prefix_string() << name << "_instruction(\n" << " "<< index << ",\n" << " " << get_presence(inst) << ",\n" << " " << inst->id() << ", // id\n" << " \"" << inst->name() << "\", // name\n" << " \"" << inst->ns() << "\", // ns\n" << " \"" << inst->dictionary() << "\", // dictionary\n" << subinstruction_arg << " "<< lengthInstruction << ", // length\n" << " \"" << inst->typeref_name() << "\", // typeRef name \n" << " \"" << inst->typeref_ns() << "\"); // typeRef ns \n\n"; }
void cpp_gen::visit(const mfast::group_field_instruction* inst, void*) { std::string name( cpp_name( inst ) ); std::size_t index = inst->field_index(); add_to_instruction_list(name); prefixes_.push_back(name); if ( !contains_only_templateRef(inst) ) { subinstructions_list_.resize(subinstructions_list_.size()+1); traverse(inst, ""); } std::string subinstruction_arg = get_subinstructions(inst); out_ << "const static mfast::group_field_instruction\n" << prefix_string() << name << "_instruction(\n" << " "<< index << ",\n" << " " << get_presence(inst) << ",\n" << " " << inst->id() << ", // id\n" << " \"" << inst->name() << "\", // name\n" << " \"" << inst->ns() << "\", // ns\n" << " \"" << inst->dictionary() << "\", // dictionary\n" << subinstruction_arg << " \"" << inst->typeref_name() << "\", // typeRef name \n" << " \"" << inst->typeref_ns() << "\"); // typeRef ns \n\n"; }
std::string cpp_gen::get_subinstructions(const mfast::group_field_instruction* inst) { std::stringstream subinstruction_arg; if ( !contains_only_templateRef(inst) ) { output_subinstructions(); subinstruction_arg << " "<< prefix_string() << "subinstructions,\n" << " "<< inst->subinstructions_count() << ", // num_fields\n"; prefixes_.pop_back(); } else { prefixes_.pop_back(); if (inst->ref_template()) { std::stringstream strm; strm << inst->ref_template()->cpp_ns() << "::" << inst->ref_template()->name(); std::string qulified_name = strm.str(); subinstruction_arg << " "<< qulified_name << "::instruction()->subinstructions(),\n" << " "<< qulified_name << "::instruction()->subinstructions_count(),\n"; } else { const char* presence_str = "presence_mandatory"; if (inst->field_type() == mfast::field_type_group) { presence_str = get_presence(inst); } // use templateref instruction singleton subinstruction_arg << " "<< "mfast::templateref_instruction::default_instructions( " << presence_str << "),\n" << " 1, // num_fields\n"; } } return subinstruction_arg.str(); }
void cpp_gen::gen_int_vector(const char* cpp_type, const mfast::vector_field_instruction_base* inst) { std::string name( cpp_name( inst ) ); std::size_t index = inst->field_index(); // std::string context = gen_op_context(inst->name(), inst->op_context()); out_ << "const static " << cpp_type << "_field_instruction\n" << prefix_string() << name << "_instruction(\n" << " " << index << ",\n" << " " << get_presence(inst) << ",\n" << " " << inst->id() << ", // id\n" << " \""<< inst->name() << "\", // name\n" << " \""<< inst->ns() << "\"); // ns\n"; add_to_instruction_list(name); }
gint main (gint argc, gchar *argv[]) { GMainLoop *loop; GDBusConnection *c; GDBusProxy *sys_proxy; GError *error; GVariant *parm; GVariant *result; loop = g_main_loop_new (NULL, FALSE); error = NULL; c = g_bus_get_sync (DBUS_TYPE, NULL, &error); error = NULL; sys_proxy = g_dbus_proxy_new_sync (c, G_DBUS_PROXY_FLAGS_NONE, NULL, /* GDBusInterfaceInfo* */ "org.openbmc.managers.System", /* name */ "/org/openbmc/managers/System", /* object path */ "org.openbmc.managers.System", /* interface name */ NULL, /* GCancellable */ &error); g_assert_no_error (error); int i = 0; int rc = 0; for (i=0;i<NUM_SLOTS;i++) { object_info obj_info; uint8_t present; do { rc = get_object(sys_proxy,&slots[i],&obj_info); if (rc) { break; } rc = get_presence(c,&slots[i],&present); if (rc) { break; } // TODO: send correct state update_fru_obj(c,&obj_info,present); } while(0); } g_object_unref(c); g_main_loop_unref (loop); return 0; }
void GstPropertiesModule::show_pad_properties() { auto pad = std::dynamic_pointer_cast<PadModel>(controller->get_selected_object()); if (!pad) { return; } PadPropertyModelColumns cols; auto model = Gtk::TreeStore::create(cols); Gtk::TreeView *tree = Gtk::manage(new Gtk::TreeView()); tree->append_column(_("Property Name"), cols.m_col_name); tree->append_column(_("Property Value"), cols.m_col_value); tree->set_model(model); #define APPEND_ROW(name, value) \ do { \ row = *(model->append()); \ row[cols.m_col_name] = name; \ row[cols.m_col_value] = value; \ } while (false); std::string peer_pad = pad->get_peer() ? ElementPathProcessor::get_object_path(pad->get_peer()) : std::string("NO PEER PAD"); Gtk::TreeModel::Row row; APPEND_ROW(_("Name"), pad->get_name()); if (pad->get_template()) { display_template_info(pad->get_template(), model, cols.m_col_name, cols.m_col_value); } APPEND_ROW(_("Presence"), get_presence_str(pad->get_presence())); APPEND_ROW(_("Direction"), get_direction_str(pad->get_direction())); APPEND_ROW(_("Peer pad"), peer_pad); if (pad->get_current_caps()) { APPEND_ROW(_("Current caps"), ""); display_caps(pad->get_current_caps(), model, cols.m_col_name, cols.m_col_value, row); } else { APPEND_ROW(_("Current caps"), _("unknown")); } if (pad->get_allowed_caps()) { APPEND_ROW(_("Allowed caps"), ""); display_caps(pad->get_allowed_caps(), model, cols.m_col_name, cols.m_col_value, row); } else { APPEND_ROW(_("Allowed caps"), _("unknown")); } #undef APPEND_ROW tree->show(); properties_box->pack_start(*tree, true, true, 0); }