コード例 #1
0
int main (void)
{
    hid_t file_id;
    int status;
    detector_data *data;
    model *mod = NULL;
    double *data_stream = NULL;
    unsigned int *qual = NULL;

    /* open file -- ignore failure on this step */
    status = RD_open_file(TESTDATAFILE, &file_id);
    if (status) return TEST_EXIT_SKIP;

    /* initialize data struct */
    status = RD_init_data(file_id, 0, -1, &data);
    if (status) return TEST_EXIT_SKIP;

    /* get data */
    status = RD_get_data(file_id, data);
    if (status) return TEST_EXIT_SKIP;

    /* close file */
    status = RD_close_file(file_id);
    if (status) return TEST_EXIT_SKIP;

    /* setup flt model */
    status = setup_model(MODEL_TYPE_FLT, &mod, data, FILT_NPAD, FILT_SCALE);
    if (status) return TEST_EXIT_SKIP;

    /* initialize flt model */
    status = init_model(mod, data);
    if (status) return TEST_EXIT_SKIP;

    /* run flt model */
    data_stream = malloc(mod->ndet*mod->nsamp*sizeof(*data_stream));
    memcpy(data_stream, data->signal,
           mod->ndet*mod->nsamp*sizeof(*data_stream));

    qual = malloc(mod->ndet*mod->nsamp*sizeof(*qual));
    memcpy(qual, data->qual, mod->ndet*mod->nsamp*sizeof(*qual));

    status = model_flt_calc(0, 1, mod, data_stream, qual);
    if (status) return EXIT_FAILURE;

    free(data_stream);
    free(qual);

    /* free flt model */
    status = free_model(mod);
    if (status) return TEST_EXIT_SKIP;

    /* free data */
    status = RD_free_data(data);
    if (status) return TEST_EXIT_SKIP;

    /* success! */
    return EXIT_SUCCESS;
}
コード例 #2
0
ファイル: test_time.c プロジェクト: csdms-contrib/cem
static void test_bmi_time_units(void) {
  BMI_Model *model = setup_model();
  int status;
  char units[2048];

  status = model->get_time_units(model->self, units);
  g_assert_cmpint(status, ==, BMI_SUCCESS);
  g_assert_cmpstr(units, ==, "d");
}
コード例 #3
0
ファイル: test_time.c プロジェクト: csdms-contrib/cem
static void test_bmi_time_step(void) {
  BMI_Model *model = setup_model();
  int status;
  double time_step;

  status = model->get_time_step(model->self, &time_step);
  g_assert_cmpint(status, ==, BMI_SUCCESS);
  g_assert_cmpfloat(time_step, ==, 1.);
}
コード例 #4
0
ファイル: test_time.c プロジェクト: csdms-contrib/cem
static void test_bmi_start_time(void) {
  BMI_Model *model = setup_model();
  int status;
  double time;

  status = model->get_start_time(model->self, &time);
  g_assert_cmpint(status, ==, BMI_SUCCESS);
  g_assert_cmpfloat(time, ==, 0.);
}
コード例 #5
0
ファイル: test_grid.c プロジェクト: csdms-contrib/cem
static void test_bmi_grid_type(void) {
  BMI_Model *model = setup_model();
  int status;
  char type[2048];

  status = model->get_grid_type(model->self, -1, type);
  g_assert_cmpint(status, ==, BMI_FAILURE);

  status = model->get_grid_type(model->self, 2, type);
  g_assert_cmpint(status, ==, BMI_SUCCESS);
  g_assert_cmpstr(type, ==, "uniform_rectilinear");
}
コード例 #6
0
ファイル: test_grid.c プロジェクト: csdms-contrib/cem
static void test_bmi_grid_size(void) {
  BMI_Model *model = setup_model();
  int status;
  int size;

  status = model->get_grid_size(model->self, -1, &size);
  g_assert_cmpint(status, ==, BMI_FAILURE);

  status = model->get_grid_size(model->self, 2, &size);
  g_assert_cmpint(status, ==, BMI_SUCCESS);
  g_assert_cmpint(size, ==, 10000);
}
コード例 #7
0
ファイル: test_grid.c プロジェクト: csdms-contrib/cem
static void test_bmi_grid_rank(void) {
  BMI_Model *model = setup_model();
  int status;
  int rank;

  status = model->get_grid_rank(model->self, -1, &rank);
  g_assert_cmpint(status, ==, BMI_FAILURE);

  status = model->get_grid_rank(model->self, 2, &rank);
  g_assert_cmpint(status, ==, BMI_SUCCESS);
  g_assert_cmpint(rank, ==, 2);
}
コード例 #8
0
ファイル: test_grid.c プロジェクト: csdms-contrib/cem
static void test_bmi_grid_origin(void) {
  BMI_Model *model = setup_model();
  int status;
  double origin[2] = {-1., -1.};

  status = model->get_grid_origin(model->self, -1, origin);
  g_assert_cmpint(status, ==, BMI_FAILURE);

  status = model->get_grid_origin(model->self, 2, origin);
  g_assert_cmpint(status, ==, BMI_SUCCESS);
  g_assert_cmpfloat(origin[0], ==, 0.);
  g_assert_cmpfloat(origin[1], ==, 0.);
}
コード例 #9
0
ファイル: test_grid.c プロジェクト: csdms-contrib/cem
static void test_bmi_grid_spacing(void) {
  BMI_Model *model = setup_model();
  int status;
  double spacing[2] = {-1., -1.};

  status = model->get_grid_spacing(model->self, -1, spacing);
  g_assert_cmpint(status, ==, BMI_FAILURE);

  status = model->get_grid_spacing(model->self, 2, spacing);
  g_assert_cmpint(status, ==, BMI_SUCCESS);
  g_assert_cmpfloat(spacing[0], ==, 100.);
  g_assert_cmpfloat(spacing[1], ==, 100.);
}
コード例 #10
0
ファイル: test_grid.c プロジェクト: csdms-contrib/cem
static void test_bmi_grid_shape(void) {
  BMI_Model *model = setup_model();
  int status;
  int shape[2] = {-1, -1};

  status = model->get_grid_shape(model->self, -1, shape);
  g_assert_cmpint(status, ==, BMI_FAILURE);

  status = model->get_grid_shape(model->self, 2, shape);
  g_assert_cmpint(status, ==, BMI_SUCCESS);
  g_assert_cmpint(shape[0], ==, 50);
  g_assert_cmpint(shape[1], ==, 200);
}
コード例 #11
0
ファイル: test-tree-column.c プロジェクト: GNOME/libegg
int
main (int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *vbox;
  GtkWidget *scrolled_window;
 
  GtkTreeModel *model;
  GtkTreeViewColumn *column;
  GtkCellRenderer *cell;
 
  gtk_init (&argc, &argv);
 
  model = (GtkTreeModel *) gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
  setup_model (model);
  tree_view = gtk_tree_view_new_with_model (model);
 
  cell = gtk_cell_renderer_text_new ();
  column = gtk_tree_view_column_new_with_attributes ("Column 1", cell,
                                                     "text", COL1_STRING,
                                                     NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
  column = gtk_tree_view_column_new_with_attributes ("Column 2", cell,
                                                     "text", COL2_STRING,
                                                     NULL);

  gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
  column = gtk_tree_view_column_new_with_attributes ("Column 3", cell,
                                                     "text", COL2_STRING,
                                                     NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), 300, 500);
  vbox = gtk_vbox_new (FALSE, 12);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
  gtk_container_add (GTK_CONTAINER (window), vbox);
                                                                                                           
  scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);

  gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
  gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
  gtk_widget_show_all (egg_column_chooser_dialog_new (GTK_TREE_VIEW(tree_view)));

  gtk_widget_show_all (window);
  gtk_main ();

  return 0;
}
コード例 #12
0
int main (void)
{
  hid_t file_id;
  int status;
  detector_data *data;
  model *mod;
  UNUSED unsigned long memused;

  /* open file -- ignore failure on this step */
  status = RD_open_file(TESTDATAFILE, &file_id);
  if (status) return TEST_EXIT_SKIP;

  /* initialize data struct */
  status = RD_init_data(file_id, 0, -1, &data);
  if (status) return TEST_EXIT_SKIP;

  /* get data */
  status = RD_get_data(file_id, data);
  if (status) return TEST_EXIT_SKIP;

  /* close file */
  status = RD_close_file(file_id);
  if (status) return TEST_EXIT_SKIP;

  /* setup model */
  status = setup_model(MODEL_TYPE_AST, &mod, data);
  if (status) return TEST_EXIT_SKIP;

  /* get memory */
  memused = getmem_model(mod);

  /* free ast model */
  status = free_model(mod);
  if (status) return EXIT_FAILURE;

  /* free data */
  status = RD_free_data(data);
  if (status) return TEST_EXIT_SKIP;

  /* success! */
  return EXIT_SUCCESS;
}
コード例 #13
0
ファイル: main.cpp プロジェクト: geonyoro/GeoVideoDownloader
int main(int argc, char *argv[])
{
	auto app = Gtk::Application::create(argc, argv, "com.possumcode.geodownloader");
	Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file("gui2.glade");

	SignalHandler sh = SignalHandler(); 

	//get widgets
	builder->get_widget("entry_segment_size", entry_Segment_Size);
	builder->get_widget("entry_no_segments", entry_no_segments);
	builder->get_widget("entry_no_concurrent_dl", entry_no_concurrent_dl);
	builder->get_widget("entry_filename", entry_filename);
	builder->get_widget("combobox_size", combobox_size);
	builder->get_widget("treeview1", treeview1);
	builder->get_widget("window1", window);
	builder->get_widget("windowAdd", windowAdd);
	builder->get_widget("button_add_dl", button_add_dl);
	builder->get_widget("button_new_dl", button_new_dl);
	builder->get_widget("button_pause_resume", button_pause_resume);
	builder->get_widget("button_remove", button_remove);
	builder->get_widget("button_dselect_all", button_dselect_all);
	builder->get_widget("button_set_filename", button_set_filename);
	builder->get_widget("checkbutton_continue", checkbutton_continue);
	builder->get_widget("textview_url", textview_url);

	Glib::RefPtr<Gtk::ListStore> liststore1 = Glib::RefPtr<Gtk::ListStore>::cast_static(builder->get_object("liststore1"));
	Glib::RefPtr<Gtk::ListStore> liststore2 = Glib::RefPtr<Gtk::ListStore>::cast_static(builder->get_object("liststore2"));

	entry_Segment_Size->signal_focus_out_event().connect(sigc::mem_fun(sh, &SignalHandler::on_entry_segment_size_focus_out));
	entry_no_concurrent_dl->signal_focus_out_event().connect(sigc::mem_fun(sh, &SignalHandler::on_entry_no_concurrent_dl_focus_out));
	entry_no_segments->signal_focus_out_event().connect(sigc::mem_fun(sh, &SignalHandler::on_entry_no_segments_focus_out));
	button_add_dl->signal_clicked().connect(sigc::mem_fun(sh, &SignalHandler::on_button_add_dl_clicked));
	button_new_dl->signal_clicked().connect(sigc::mem_fun(sh, &SignalHandler::on_button_new_dl_clicked));
	button_set_filename->signal_clicked().connect(sigc::mem_fun(sh, &SignalHandler::on_button_set_filename_clicked));

	set_initial_values();
	setup_model();

	return app->run(*window);
}
コード例 #14
0
static void
gnome_control_center_init (GnomeControlCenter *self)
{
  GError *err = NULL;
  GnomeControlCenterPrivate *priv;
  GdkScreen *screen;

  priv = self->priv = CONTROL_CENTER_PRIVATE (self);

#ifdef HAVE_CHEESE
  if (gtk_clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
    {
      g_critical ("Clutter-GTK init failed");
      return;
    }
#endif /* HAVE_CHEESE */

  priv->monitor_num = -1;
  self->priv->small_screen = SMALL_SCREEN_UNSET;

  /* load the user interface */
  priv->builder = gtk_builder_new ();

  if (!gtk_builder_add_from_file (priv->builder, UIDIR "/shell.ui", &err))
    {
      g_critical ("Could not build interface: %s", err->message);
      g_error_free (err);

      return;
    }

  /* connect various signals */
  priv->window = W (priv->builder, "main-window");
  gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (priv->window), TRUE);
  screen = gtk_widget_get_screen (priv->window);
  g_signal_connect (screen, "monitors-changed", G_CALLBACK (monitors_changed_cb), self);
  g_signal_connect (priv->window, "configure-event", G_CALLBACK (main_window_configure_cb), self);
  g_signal_connect (priv->window, "notify::application", G_CALLBACK (application_set_cb), self);
  g_signal_connect_swapped (priv->window, "delete-event", G_CALLBACK (g_object_unref), self);
  g_signal_connect_after (priv->window, "key_press_event",
                          G_CALLBACK (window_key_press_event), self);

  priv->notebook = W (priv->builder, "notebook");

  /* Main scrolled window */
  priv->scrolled_window = W (priv->builder, "scrolledwindow1");

  gtk_widget_set_size_request (priv->scrolled_window, FIXED_WIDTH, -1);
  priv->main_vbox = W (priv->builder, "main-vbox");
  g_signal_connect (priv->notebook, "notify::page",
                    G_CALLBACK (notebook_page_notify_cb), priv);

  g_signal_connect (gtk_builder_get_object (priv->builder, "home-button"),
                    "clicked", G_CALLBACK (home_button_clicked_cb), self);

  /* keep a list of custom widgets to unload on panel change */
  priv->custom_widgets = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);

  /* load the available settings panels */
  setup_model (self);

  /* load the panels that are implemented as plugins */
  load_panel_plugins (self);

  /* setup search functionality */
  setup_search (self);

  setup_lock (self);

  /* store default window title and name */
  priv->default_window_title = g_strdup (gtk_window_get_title (GTK_WINDOW (priv->window)));
  priv->default_window_icon = g_strdup (gtk_window_get_icon_name (GTK_WINDOW (priv->window)));

  notebook_page_notify_cb (GTK_NOTEBOOK (priv->notebook), NULL, priv);
}