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 }
ns3::ModelCreator::m_treestore
GtkTreeStore * m_treestore
attribute tree
Definition: model-node-creator.h:94
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::ModelNode::NODE_POINTER
@ NODE_POINTER
Definition: model-node-creator.h:47
ns3::ModelCreator::DoStartVisitArrayItem
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.
Definition: model-node-creator.cc:109
ns3::ModelCreator::DoEndVisitArrayItem
virtual void DoEndVisitArrayItem(void)
End the visit to the array item.
Definition: model-node-creator.cc:124
ns3::ModelCreator
ModelCreator class.
Definition: model-node-creator.h:65
ns3::ModelCreator::ModelCreator
ModelCreator()
Definition: model-node-creator.cc:23
ns3::ModelNode::object
Ptr< Object > object
the object
Definition: model-node-creator.h:56
ns3::ObjectPtrContainerValue
Container for a set of ns3::Object pointers.
Definition: object-ptr-container.h:46
ns3::ModelNode::name
std::string name
node name
Definition: model-node-creator.h:55
ns3::Ptr< Object >
attribute-iterator.h
ns3::ModelNode::NODE_VECTOR
@ NODE_VECTOR
Definition: model-node-creator.h:49
ns3::ModelCreator::Build
void Build(GtkTreeStore *treestore)
Allocate attribute tree.
Definition: model-node-creator.cc:28
ns3::ModelNode::type
enum ns3::ModelNode::@1 type
node type
ns3::AttributeIterator
Iterator to iterate on the values of attributes of an ns3::Object.
Definition: attribute-iterator.h:36
ns3::ModelCreator::DoEndVisitObject
virtual void DoEndVisitObject(void)
This method is called to end the process of visiting the currently visited object.
Definition: model-node-creator.cc:76
ns3::ModelCreator::Remove
void Remove(void)
Remove current tree item.
Definition: model-node-creator.cc:50
ns3::ModelCreator::Add
void Add(ModelNode *node)
Add item to attribute tree.
Definition: model-node-creator.cc:40
ns3::ModelCreator::DoEndVisitArrayAttribute
virtual void DoEndVisitArrayAttribute(void)
End the visit to the attribute of type ns3::ObjectVectorValue.
Definition: model-node-creator.cc:104
ns3::ModelCreator::m_iters
std::vector< GtkTreeIter * > m_iters
attribute tree item
Definition: model-node-creator.h:95
ns3::ModelNode::NODE_VECTOR_ITEM
@ NODE_VECTOR_ITEM
Definition: model-node-creator.h:51
ns3::COL_LAST
@ COL_LAST
Definition: model-node-creator.h:28
ns3::ModelCreator::DoEndVisitPointerAttribute
virtual void DoEndVisitPointerAttribute(void)
End the visit to the attribute of type ns3::PointerValue.
Definition: model-node-creator.cc:90
ns3::ModelNode::NODE_ATTRIBUTE
@ NODE_ATTRIBUTE
Definition: model-node-creator.h:45
ns3::ModelNode
A class used in the implementation of the GtkConfigStore.
Definition: model-node-creator.h:36
ns3::COL_NODE
@ COL_NODE
Definition: model-node-creator.h:28
ns3::ModelNode::index
uint32_t index
index
Definition: model-node-creator.h:57
ns3::ModelCreator::DoStartVisitArrayAttribute
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...
Definition: model-node-creator.cc:95
ns3::ModelCreator::DoVisitAttribute
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...
Definition: model-node-creator.cc:58
ns3::ModelCreator::DoStartVisitObject
virtual void DoStartVisitObject(Ptr< Object > object)
This method is called to start the process of visiting the input object.
Definition: model-node-creator.cc:68
ns3::ModelCreator::DoStartVisitPointerAttribute
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...
Definition: model-node-creator.cc:81
ns3::ModelNode::NODE_OBJECT
@ NODE_OBJECT
Definition: model-node-creator.h:53