A Discrete-Event Network Simulator
API
display-functions.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * Authors: Faker Moatamri <faker.moatamri@sophia.inria.fr>
17  * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 
20 #include "display-functions.h"
21 #include "raw-text-config.h"
22 #include "ns3/config.h"
23 #include "ns3/string.h"
24 #include "ns3/pointer.h"
25 
26 namespace ns3 {
27 /*
28  * This function includes the name of the attribute or the editable value
29  * in the second column
30  */
31 void
32 cell_data_function_col_1 (GtkTreeViewColumn *col, GtkCellRenderer *renderer,
33  GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
34 {
35  ModelNode *node = 0;
36  gtk_tree_model_get (model, iter, COL_NODE, &node, -1);
37  if (!node)
38  {
39  return;
40  }
41  if (node->type == ModelNode::NODE_ATTRIBUTE)
42  {
43  StringValue str;
44  node->object->GetAttribute (node->name, str);
45  g_object_set (renderer, "text", str.Get ().c_str (), (char*) 0);
46  g_object_set (renderer, "editable", TRUE, (char*) 0);
47  }
48  else
49  {
50  g_object_set (renderer, "text", "", (char*) 0);
51  g_object_set (renderer, "editable", FALSE, (char*) 0);
52  }
53 }
54 /*
55  * This function includes the name of the object, pointer, vector or vector item
56  * in the first column
57  */
58 void
59 cell_data_function_col_0 (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model,
60  GtkTreeIter *iter, gpointer user_data)
61 {
62  ModelNode *node = 0;
63  gtk_tree_model_get (model, iter, COL_NODE, &node, -1);
64  g_object_set (renderer, "editable", FALSE, (char*) 0);
65  if (!node)
66  {
67  return;
68  }
69 
70  switch (node->type)
71  {
73  g_object_set (renderer, "text", node->object->GetInstanceTypeId ().GetName ().c_str (), (char*) 0);
74  break;
76  g_object_set (renderer, "text", node->name.c_str (), (char*) 0);
77  break;
79  g_object_set (renderer, "text", node->name.c_str (), (char*) 0);
80  break;
82  {
83  std::stringstream oss;
84  oss << node->index;
85  g_object_set (renderer, "text", oss.str ().c_str (), (char*) 0);
86  }
87  break;
89  g_object_set (renderer, "text", node->name.c_str (), (char*) 0);
90  break;
91  }
92 }
93 
94 /*
95  * This is the callback called when the value of an attribute is changed
96  */
97 void
98 cell_edited_callback (GtkCellRendererText *cell, gchar *path_string,
99  gchar *new_text, gpointer user_data)
100 {
101  GtkTreeModel *model = GTK_TREE_MODEL (user_data);
102  GtkTreeIter iter;
103  gtk_tree_model_get_iter_from_string (model, &iter, path_string);
104  ModelNode *node = 0;
105  gtk_tree_model_get (model, &iter, COL_NODE, &node, -1);
106  if (!node)
107  {
108  return;
109  }
111  node->object->SetAttribute (node->name, StringValue (new_text));
112 }
113 
114 /*
115  * This function gets the column number 0 or 1 from the mouse
116  * click
117  */
118 int
119 get_col_number_from_tree_view_column (GtkTreeViewColumn *col)
120 {
121  GList *cols;
122  int num;
123  g_return_val_if_fail (col != 0, -1);
124  g_return_val_if_fail (gtk_tree_view_column_get_tree_view(col) != 0, -1);
125  cols = gtk_tree_view_get_columns (GTK_TREE_VIEW (gtk_tree_view_column_get_tree_view(col)));
126  num = g_list_index (cols, (gpointer) col);
127  g_list_free (cols);
128  return num;
129 }
130 
131 /*
132  * This function displays the tooltip for an object, pointer, vector
133  * item or an attribute
134  */
135 gboolean
136 cell_tooltip_callback (GtkWidget *widget, gint x, gint y, gboolean keyboard_tip,
137  GtkTooltip *tooltip, gpointer user_data)
138 {
139  GtkTreeModel *model;
140  GtkTreeIter iter;
141  GtkTreeViewColumn * column;
142  if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (widget), &x, &y,
143  keyboard_tip, &model, 0, &iter))
144  {
145  return FALSE;
146  }
147  if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), x, y, 0, &column, 0, 0))
148  {
149  return FALSE;
150  }
151  int col = get_col_number_from_tree_view_column (column);
152 
153  ModelNode *node = 0;
154  gtk_tree_model_get (model, &iter, COL_NODE, &node, -1);
155  if (!node)
156  {
157  return FALSE;
158  }
159 
160  switch (node->type)
161  {
163  if (col == 0)
164  {
165  std::string tip = "This object is of type "
166  + node->object->GetInstanceTypeId ().GetName ();
167  gtk_tooltip_set_text (tooltip, tip.c_str ());
168  return TRUE;
169  }
170  break;
172  if (col == 0)
173  {
174  PointerValue ptr;
175  node->object->GetAttribute (node->name, ptr);
176  std::string tip = "This object is of type "
177  + ptr.GetObject ()->GetInstanceTypeId ().GetName ();
178  gtk_tooltip_set_text (tooltip, tip.c_str ());
179  return TRUE;
180  }
181  break;
183  break;
185  if (col == 0)
186  {
187  std::string tip = "This object is of type "
188  + node->object->GetInstanceTypeId ().GetName ();
189  gtk_tooltip_set_text (tooltip, tip.c_str ());
190  return TRUE;
191  }
192  break;
194  {
195  uint32_t attrIndex = 0;
196  TypeId tid;
197  for (tid = node->object->GetInstanceTypeId (); tid.HasParent (); tid
198  = tid.GetParent ())
199  {
200  for (uint32_t i = 0; i < tid.GetAttributeN (); ++i)
201  {
202  if (tid.GetAttribute (i).name == node->name)
203  {
204  attrIndex = i;
205  goto out;
206  }
207  }
208  }
209  out: if (col == 0)
210  {
211  std::string tip = tid.GetAttribute (attrIndex).help;
212  gtk_tooltip_set_text (tooltip, tip.c_str ());
213  }
214  else
215  {
216  struct TypeId::AttributeInformation info = tid.GetAttribute (attrIndex);
217  Ptr<const AttributeChecker> checker = info.checker;
218  std::string tip;
219  tip = "This attribute is of type " + checker->GetValueTypeName ();
220  if (checker->HasUnderlyingTypeInformation ())
221  {
222  tip += " " + checker->GetUnderlyingTypeInformation ();
223  }
224  gtk_tooltip_set_text (tooltip, tip.c_str ());
225  }
226  return TRUE;
227  }
228  break;
229  }
230  return FALSE;
231 }
232 
233 /*
234  * This is the main view opening the widget, getting tooltips and drawing the
235  * tree of attributes...
236  */
237 GtkWidget *
238 create_view (GtkTreeStore *model)
239 {
240  GtkTreeViewColumn *col;
241  GtkCellRenderer *renderer;
242  GtkWidget *view;
243 
244  view = gtk_tree_view_new ();
245  g_object_set (view, "has-tooltip", TRUE, (char*) 0);
246  g_signal_connect (view, "query-tooltip", (GCallback) cell_tooltip_callback, 0);
247 
248  gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_BOTH);
249  // gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
250 
251  col = gtk_tree_view_column_new ();
252  gtk_tree_view_column_set_title (col, "Object Attributes");
253  gtk_tree_view_append_column (GTK_TREE_VIEW (view), col);
254  renderer = gtk_cell_renderer_text_new ();
255  gtk_tree_view_column_pack_start (col, renderer, TRUE);
256  gtk_tree_view_column_set_cell_data_func (col, renderer, cell_data_function_col_0, 0, 0);
257  g_object_set (renderer, "editable", FALSE, (char*) 0);
258 
259  col = gtk_tree_view_column_new ();
260  gtk_tree_view_column_set_title (col, "Attribute Value");
261  gtk_tree_view_append_column (GTK_TREE_VIEW (view), col);
262  renderer = gtk_cell_renderer_text_new ();
263  g_signal_connect (renderer, "edited", (GCallback) cell_edited_callback, model);
264  gtk_tree_view_column_pack_start (col, renderer, TRUE);
265  gtk_tree_view_column_set_cell_data_func (col, renderer, cell_data_function_col_1, 0, 0);
266 
267  gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (model));
268 
269  g_object_unref (model); /* destroy model automatically with view */
270 
271  return view;
272 }
273 
274 /*
275  * Exit the window when exit button is pressed
276  */
277 void
278 exit_clicked_callback (GtkButton *button, gpointer user_data)
279 {
280  gtk_main_quit ();
281  gtk_widget_hide (GTK_WIDGET (user_data));
282 }
283 
284 /*
285  * Exit the application
286  */
287 gboolean
288 delete_event_callback (GtkWidget *widget, GdkEvent *event, gpointer user_data)
289 {
290  gtk_main_quit ();
291  gtk_widget_hide (GTK_WIDGET (user_data));
292  return TRUE;
293 }
294 
295 /*
296  * Delete the tree model contents
297  */
298 gboolean
299 clean_model_callback (GtkTreeModel *model, GtkTreePath *path,
300  GtkTreeIter *iter, gpointer data)
301 {
302  ModelNode *node = 0;
303  gtk_tree_model_get (GTK_TREE_MODEL (model), iter, COL_NODE, &node, -1);
304  if (node)
305  {
306  delete node;
307  }
308  gtk_tree_store_set (GTK_TREE_STORE (model), iter, COL_NODE, (ModelNode*) 0,
309  -1);
310  return FALSE;
311 }
312 
313 // display functions used by default configurator
314 /*
315  * This function writes data in the second column, this data is going to be editable
316  * if it is a NODE_ATTRIBUTE
317  */
318 void
319 cell_data_function_col_1_config_default (GtkTreeViewColumn *col, GtkCellRenderer *renderer,
320  GtkTreeModel *model, GtkTreeIter *iter,
321  gpointer user_data)
322 {
323  ModelTypeid *node = 0;
324  gtk_tree_model_get (model, iter, COL_TYPEID, &node, -1);
325  if (!node)
326  {
327  return;
328  }
329  if (node->type == ModelTypeid::NODE_ATTRIBUTE)
330  {
331  g_object_set (renderer, "text", node->defaultValue.c_str (), (char*) 0);
332  g_object_set (renderer, "editable", TRUE, (char*) 0);
333  }
334  else
335  {
336  g_object_set (renderer, "text", "", (char*) 0);
337  g_object_set (renderer, "editable", FALSE, (char*) 0);
338  }
339 }
340 /*
341  * This function writes the attribute or typeid name in the column 0
342  */
343 void
344 cell_data_function_col_0_config_default (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model,
345  GtkTreeIter *iter, gpointer user_data)
346 {
347  ModelTypeid *node = 0;
348  gtk_tree_model_get (model, iter, COL_NODE, &node, -1);
349  g_object_set (renderer, "editable", FALSE, (char*) 0);
350  if (!node)
351  {
352  return;
353  }
354 
355  switch (node->type)
356  {
358  g_object_set (renderer, "text", node->tid.GetName ().c_str (), (char*) 0);
359  break;
361  g_object_set (renderer, "text", node->name.c_str (), (char*) 0);
362  break;
363  }
364 }
365 
366 
367 /*
368  * This functions is called whenever there is a change in the value of an attribute
369  * If the input value is ok, it will be updated in the default value and in the
370  * gui, otherwise, it won't be updated in both.
371  */
372 void
373 cell_edited_callback_config_default (GtkCellRendererText *cell, gchar *path_string,
374  gchar *new_text, gpointer user_data)
375 {
376  GtkTreeModel *model = GTK_TREE_MODEL (user_data);
377  GtkTreeIter iter;
378  gtk_tree_model_get_iter_from_string (model, &iter, path_string);
379  ModelTypeid *node = 0;
380  gtk_tree_model_get (model, &iter, COL_NODE, &node, -1);
381  if (!node)
382  {
383  return;
384  }
387  {
388  node->defaultValue = new_text;
389  }
390 }
391 
392 /*
393  * This function is used to display a tooltip whenever the user puts the mouse
394  * over a type ID or an attribute. It will give the type and the possible values of
395  * an attribute value and the type of the object for an attribute object or a
396  * typeID object
397  *
398  * \param widget is the display object
399  * \param x is the x position
400  * \param y is the y position
401  * \param keyboard_tip
402  * \param tooltip is the tooltip information to be displayed
403  * \param user_data
404  * \return false if the tooltip is not displayed
405  */
406 gboolean
407 cell_tooltip_callback_config_default (GtkWidget *widget, gint x, gint y,
408  gboolean keyboard_tip, GtkTooltip *tooltip, gpointer user_data)
409 {
410  GtkTreeModel *model;
411  GtkTreeIter iter;
412  GtkTreeViewColumn * column;
413  if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (widget), &x, &y,
414  keyboard_tip, &model, 0, &iter))
415  {
416  return FALSE;
417  }
418  if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), x, y, 0, &column, 0, 0))
419  {
420  return FALSE;
421  }
422  int col = get_col_number_from_tree_view_column (column);
423 
424  ModelTypeid *node = 0;
425  gtk_tree_model_get (model, &iter, COL_NODE, &node, -1);
426  if (!node)
427  {
428  return FALSE;
429  }
430 
431  switch (node->type)
432  {
434  if (col == 0)
435  {
436  std::string tip = "This object is of type " + node->tid.GetName ();
437  gtk_tooltip_set_text (tooltip, tip.c_str ());
438  return TRUE;
439  }
440  break;
442  {
443  uint32_t attrIndex = node->index;
444  if (col == 0)
445  {
446  std::string tip = node->tid.GetAttribute (attrIndex).help;
447  gtk_tooltip_set_text (tooltip, tip.c_str ());
448  }
449  else
450  {
451  Ptr<const AttributeChecker> checker = node->tid.GetAttribute (attrIndex).checker;
452  std::string tip;
453  tip = "This attribute is of type " + checker->GetValueTypeName ();
454  if (checker->HasUnderlyingTypeInformation ())
455  {
456  tip += " " + checker->GetUnderlyingTypeInformation ();
457  }
458  gtk_tooltip_set_text (tooltip, tip.c_str ());
459  }
460  return TRUE;
461  }
462  break;
463  }
464  return FALSE;
465 }
466 
467 /*
468  * This is the action done when the user presses on the save button.
469  * It will save the config to a file.
470  *
471  * \param button (unused)
472  * \param user_data
473  */
474 void
475 save_clicked_default (GtkButton *button, gpointer user_data)
476 {
477  GtkWindow *parent_window = GTK_WINDOW (user_data);
478 
479  GtkFileChooserNative *native;
480  GtkFileChooser *chooser;
481  GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE;
482  gint res;
483 
484  native = gtk_file_chooser_native_new ("Save File",
485  parent_window,
486  action,
487  "_Save",
488  "_Cancel");
489  chooser = GTK_FILE_CHOOSER (native);
490 
491  gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
492 
493  gtk_file_chooser_set_current_name (chooser, ("config-defaults.txt"));
494 
495  res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (native));
496  if (res == GTK_RESPONSE_ACCEPT)
497  {
498  char *filename;
499 
500  filename = gtk_file_chooser_get_filename (chooser);
501  RawTextConfigSave config;
502  config.SetFilename (filename);
503  config.Default ();
504  g_free (filename);
505  }
506 
507  g_object_unref (native);
508 }
509 
510 /*
511  * If the user presses the button load, it will load the config file into memory.
512  *
513  * \param button (unused)
514  * \param user_data
515  */
516 void
517 load_clicked_default (GtkButton *button, gpointer user_data)
518 {
519  GtkWindow *parent_window = GTK_WINDOW (user_data);
520  GtkFileChooserNative *native;
521  GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
522  gint res;
523 
524  native = gtk_file_chooser_native_new ("Open File",
525  parent_window,
526  action,
527  "_Open",
528  "_Cancel");
529 
530  res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (native));
531  if (res == GTK_RESPONSE_ACCEPT)
532  {
533  char *filename;
534  GtkFileChooser *chooser = GTK_FILE_CHOOSER (native);
535  filename = gtk_file_chooser_get_filename (chooser);
536  RawTextConfigLoad config;
537  config.SetFilename (filename);
538  config.Default ();
539  g_free (filename);
540  }
541 
542  g_object_unref (native);
543 }
544 
545 /*
546  * This is the action done when the user presses on the save button.
547  * It will save the config to a file.
548  *
549  * \param button (unused)
550  * \param user_data
551  */
552 void
553 save_clicked_attribute (GtkButton *button, gpointer user_data)
554 {
555  GtkWindow *parent_window = GTK_WINDOW (user_data);
556 
557  GtkFileChooserNative *native;
558  GtkFileChooser *chooser;
559  GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE;
560  gint res;
561 
562  native = gtk_file_chooser_native_new ("Save File",
563  parent_window,
564  action,
565  "_Save",
566  "_Cancel");
567  chooser = GTK_FILE_CHOOSER (native);
568 
569  gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
570 
571  gtk_file_chooser_set_current_name (chooser, ("config-attributes.txt"));
572 
573  res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (native));
574  if (res == GTK_RESPONSE_ACCEPT)
575  {
576  char *filename;
577 
578  filename = gtk_file_chooser_get_filename (chooser);
579  RawTextConfigSave config;
580  config.SetFilename (filename);
581  config.Attributes ();
582  g_free (filename);
583  }
584 
585  g_object_unref (native);
586 }
587 
588 /*
589  * If the user presses the button load, it will load the config file into memory.
590  *
591  * \param button (unused)
592  * \param user_data
593  */
594 void
595 load_clicked_attribute (GtkButton *button, gpointer user_data)
596 {
597  GtkWindow *parent_window = GTK_WINDOW (user_data);
598  GtkFileChooserNative *native;
599  GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
600  gint res;
601 
602  native = gtk_file_chooser_native_new ("Open File",
603  parent_window,
604  action,
605  "_Open",
606  "_Cancel");
607 
608  res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (native));
609  if (res == GTK_RESPONSE_ACCEPT)
610  {
611  char *filename;
612  GtkFileChooser *chooser = GTK_FILE_CHOOSER (native);
613  filename = gtk_file_chooser_get_filename (chooser);
614  RawTextConfigLoad config;
615  config.SetFilename (filename);
616  config.Attributes ();
617  g_free (filename);
618  }
619 
620  g_object_unref (native);
621 }
622 
623 /*
624  * This is the main view opening the widget, getting tooltips and drawing the
625  * tree of attributes
626  */
627 GtkWidget *
628 create_view_config_default (GtkTreeStore *model)
629 {
630  GtkTreeViewColumn *col;
631  GtkCellRenderer *renderer;
632  GtkWidget *view;
633 
634  view = gtk_tree_view_new ();
635  g_object_set (view, "has-tooltip", TRUE, (char*) 0);
636  g_signal_connect (view, "query-tooltip", (GCallback) cell_tooltip_callback_config_default, 0);
637 
638  gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_BOTH);
639  // gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
640 
641  col = gtk_tree_view_column_new ();
642  gtk_tree_view_column_set_title (col, "Object Attributes");
643  gtk_tree_view_append_column (GTK_TREE_VIEW (view), col);
644  renderer = gtk_cell_renderer_text_new ();
645  gtk_tree_view_column_pack_start (col, renderer, TRUE);
646  gtk_tree_view_column_set_cell_data_func (col, renderer, cell_data_function_col_0_config_default, 0, 0);
647  g_object_set (renderer, "editable", FALSE, (char*) 0);
648 
649  col = gtk_tree_view_column_new ();
650  gtk_tree_view_column_set_title (col, "Attribute Value");
651  gtk_tree_view_append_column (GTK_TREE_VIEW (view), col);
652  renderer = gtk_cell_renderer_text_new ();
653  g_signal_connect (renderer, "edited", (GCallback) cell_edited_callback_config_default, model);
654  gtk_tree_view_column_pack_start (col, renderer, TRUE);
655  gtk_tree_view_column_set_cell_data_func (col, renderer, cell_data_function_col_1_config_default, 0, 0);
656 
657  gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (model));
658 
659  g_object_unref (model); /* destroy model automatically with view */
660 
661  return view;
662 }
663 
664 /*
665  * Delete the tree model contents
666  */
667 gboolean
668 clean_model_callback_config_default (GtkTreeModel *model, GtkTreePath *path,
669  GtkTreeIter *iter, gpointer data)
670 {
671  ModelTypeid *node = 0;
672  gtk_tree_model_get (GTK_TREE_MODEL (model), iter, COL_TYPEID, &node, -1);
673  if (node)
674  {
675  delete node;
676  }
677  gtk_tree_store_set (GTK_TREE_STORE (model), iter, COL_TYPEID, (ModelTypeid*) 0, -1);
678  return FALSE;
679 }
680 
681 
682 } //end ns3 namespace
683 
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:256
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:294
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: object.cc:79
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Ptr< Object > GetObject(void) const
Get the Object referenced by the PointerValue.
Definition: pointer.cc:55
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
A class to enable loading of configuration store from a raw text file.
virtual void Default(void)
Load or save the default values.
virtual void SetFilename(std::string filename)
Set the file name.
virtual void Attributes(void)
Load or save the attributes values.
A class to enable saving of configuration store in a raw text file.
virtual void Attributes(void)
Load or save the attributes values.
virtual void SetFilename(std::string filename)
Set the file name.
virtual void Default(void)
Load or save the default values.
Hold variables of type string.
Definition: string.h:41
std::string Get(void) const
Definition: string.cc:31
a unique identifier for an interface.
Definition: type-id.h:59
std::size_t GetAttributeN(void) const
Get the number of attributes.
Definition: type-id.cc:1076
bool HasParent(void) const
Check if this TypeId has a parent.
Definition: type-id.cc:950
std::string GetAttributeFullName(std::size_t i) const
Get the Attribute name by index.
Definition: type-id.cc:1089
struct TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
Definition: type-id.cc:1083
TypeId GetParent(void) const
Get the parent of this TypeId.
Definition: type-id.cc:943
std::string GetName(void) const
Get the name.
Definition: type-id.cc:976
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
Definition: config.cc:857
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void cell_data_function_col_1_config_default(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
This function writes data in the second column, this data is going to be editable if it is a NODE_ATT...
gboolean cell_tooltip_callback(GtkWidget *widget, gint x, gint y, gboolean keyboard_tip, GtkTooltip *tooltip, gpointer user_data)
This function displays the tooltip for an object, pointer, vector item or an attribute.
gboolean clean_model_callback(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Delete the tree model contents.
void cell_data_function_col_0_config_default(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
This function writes the attribute or typeid name in the column 0.
void cell_data_function_col_1(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
This function includes the name of the attribute or the editable value in the second column.
void cell_edited_callback(GtkCellRendererText *cell, gchar *path_string, gchar *new_text, gpointer user_data)
This is the callback called when the value of an attribute is changed.
void save_clicked_attribute(GtkButton *button, gpointer user_data)
This is the action done when the user presses on the save button for the Attributes.
gboolean cell_tooltip_callback_config_default(GtkWidget *widget, gint x, gint y, gboolean keyboard_tip, GtkTooltip *tooltip, gpointer user_data)
This function is used to display a tooltip whenever the user puts the mouse over a type ID or an attr...
gboolean delete_event_callback(GtkWidget *widget, GdkEvent *event, gpointer user_data)
Exit the application.
void exit_clicked_callback(GtkButton *button, gpointer user_data)
Exit the window when exit button is pressed.
GtkWidget * create_view_config_default(GtkTreeStore *model)
This is the main view opening the widget, getting tooltips and drawing the tree of attributes.
gboolean clean_model_callback_config_default(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Delete the tree model contents.
int get_col_number_from_tree_view_column(GtkTreeViewColumn *col)
This function gets the column number 0 or 1 from the mouse click.
GtkWidget * create_view(GtkTreeStore *model)
This is the main view opening the widget, getting tooltips and drawing the tree of attributes....
void cell_data_function_col_0(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
This function includes the name of the object, pointer, vector or vector item in the first column.
void cell_edited_callback_config_default(GtkCellRendererText *cell, gchar *path_string, gchar *new_text, gpointer user_data)
This functions is called whenever there is a change in the value of an attribute If the input value i...
void save_clicked_default(GtkButton *button, gpointer user_data)
This is the action done when the user presses on the save button for the Default attributes.
void load_clicked_default(GtkButton *button, gpointer user_data)
If the user presses the button load, it will load the config file into memory for the Default attribu...
void load_clicked_attribute(GtkButton *button, gpointer user_data)
If the user presses the button load, it will load the config file into memory for the Attributes.
list x
Random number samples.
uint8_t data[writeSize]
A class used in the implementation of the GtkConfigStore.
enum ns3::ModelNode::@2 type
node type
Ptr< Object > object
the object
uint32_t index
index
std::string name
node name
A class used in the implementation of the GtkConfigStore.
uint32_t index
stores the index of the attribute in list of attributes for a given TypeId
TypeId tid
The TypeId object and if it is an attribute, it's the TypeId object of the attribute.
enum ns3::ModelTypeid::@4 type
node type
std::string defaultValue
TypeId default value.
std::string name
TypeId name.
Attribute implementation.
Definition: type-id.h:78
std::string name
Attribute name.
Definition: type-id.h:80
Ptr< const AttributeChecker > checker
Checker object.
Definition: type-id.h:92
std::string help
Attribute help string.
Definition: type-id.h:82