A Discrete-Event Network Simulator
API
model-node-creator.h
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 "attribute-iterator.h"
21 #include <gtk/gtk.h>
22 
23 namespace ns3
24 {
25 
26 enum
27 {
29 };
30 
35 struct ModelNode
36 {
42  enum
43  {
44  // store object + attribute name
46  // store object + attribute name
48  // store object + attribute name
50  // store index + value (object)
52  // store object
54  } type;
55  std::string name;
57  uint32_t index;
58 };
65 {
66 public:
67  ModelCreator ();
68 
73  void Build (GtkTreeStore *treestore);
74 private:
75  virtual void DoVisitAttribute (Ptr<Object> object, std::string name);
76  virtual void DoStartVisitObject (Ptr<Object> object);
77  virtual void DoEndVisitObject (void);
78  virtual void DoStartVisitPointerAttribute (Ptr<Object> object, std::string name, Ptr<Object> value);
79  virtual void DoEndVisitPointerAttribute (void);
80  virtual void DoStartVisitArrayAttribute (Ptr<Object> object, std::string name,
81  const ObjectPtrContainerValue &vector);
82  virtual void DoEndVisitArrayAttribute (void);
83  virtual void DoStartVisitArrayItem (const ObjectPtrContainerValue &vector,
84  uint32_t index, Ptr<Object> item);
85  virtual void DoEndVisitArrayItem (void);
90  void Add (ModelNode *node);
92  void Remove (void);
93 
94  GtkTreeStore *m_treestore;
95  std::vector<GtkTreeIter *> m_iters;
96 };
97 }
void Remove(void)
Remove current tree item.
std::string name
node name
uint32_t index
index
virtual void DoStartVisitArrayAttribute(Ptr< Object > object, std::string name, const ObjectPtrContainerValue &vector)
Visit the attribute of type ns3::ObjectVectorValue, with the provided name, found on the object point...
GtkTreeStore * m_treestore
attribute tree
enum ns3::ModelNode::@1 type
node type
virtual void DoEndVisitPointerAttribute(void)
End the visit to the attribute of type ns3::PointerValue.
ModelCreator class.
void Build(GtkTreeStore *treestore)
Allocate attribute tree.
void Add(ModelNode *node)
Add item to attribute tree.
virtual void DoStartVisitArrayItem(const ObjectPtrContainerValue &vector, uint32_t index, Ptr< Object > item)
Start to visit the object found in the input array at the provided index.
virtual void DoEndVisitObject(void)
This method is called to end the process of visiting the currently visited object.
virtual void DoEndVisitArrayItem(void)
End the visit to the array item.
Ptr< Object > object
the object
Every class exported by the ns3 library is enclosed in the ns3 namespace.
A class used in the implementation of the GtkConfigStore.
Iterator to iterate on the values of attributes of an ns3::Object.
Container for a set of ns3::Object pointers.
virtual void DoStartVisitPointerAttribute(Ptr< Object > object, std::string name, Ptr< Object > value)
Visit the attribute of type ns3::PointerValue, with the provided name, found on the object pointed to...
virtual void DoStartVisitObject(Ptr< Object > object)
This method is called to start the process of visiting the input object.
virtual void DoVisitAttribute(Ptr< Object > object, std::string name)
This method visits and performs a config-store action (such as saving to a text file) on the attribut...
std::vector< GtkTreeIter * > m_iters
attribute tree item
virtual void DoEndVisitArrayAttribute(void)
End the visit to the attribute of type ns3::ObjectVectorValue.