A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
model-node-creator.h
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 "attribute-iterator.h"
21 #include <gtk/gtk.h>
22 
23 namespace ns3
24 {
25 
26 enum
27 {
28  COL_NODE = 0, COL_LAST
29 };
30 
31 struct ModelNode
32 {
33  enum
34  {
35  // store object + attribute name
36  NODE_ATTRIBUTE,
37  // store object + attribute name
38  NODE_POINTER,
39  // store object + attribute name
40  NODE_VECTOR,
41  // store index + value (object)
42  NODE_VECTOR_ITEM,
43  // store object
44  NODE_OBJECT
45  } type;
46  std::string name;
47  Ptr<Object> object;
48  uint32_t index;
49 };
55 {
56 public:
57  ModelCreator ();
58 
59  void Build (GtkTreeStore *treestore);
60 private:
61  virtual void DoVisitAttribute (Ptr<Object> object, std::string name);
62  virtual void DoStartVisitObject (Ptr<Object> object);
63  virtual void DoEndVisitObject (void);
64  virtual void DoStartVisitPointerAttribute (Ptr<Object> object, std::string name, Ptr<Object> value);
65  virtual void DoEndVisitPointerAttribute (void);
66  virtual void DoStartVisitArrayAttribute (Ptr<Object> object, std::string name,
67  const ObjectPtrContainerValue &vector);
68  virtual void DoEndVisitArrayAttribute (void);
69  virtual void DoStartVisitArrayItem (const ObjectPtrContainerValue &vector,
70  uint32_t index, Ptr<Object> item);
71  virtual void DoEndVisitArrayItem (void);
72  void Add (ModelNode *node);
73  void Remove (void);
74 
75  GtkTreeStore *m_treestore;
76  std::vector<GtkTreeIter *> m_iters;
77 };
78 }
contain a set of ns3::Object pointers.