A Discrete-Event Network Simulator
API
model-node-creator.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License version 2 as
4  * published by the Free Software Foundation;
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * Authors: Faker Moatamri <faker.moatamri@sophia.inria.fr>
16  * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
17  */
18 
19 #include "attribute-iterator.h"
20 
21 #include <gtk/gtk.h>
22 
23 namespace ns3
24 {
25 
26 enum
27 {
28  COL_NODE = 0,
29  COL_LAST
30 };
31 
36 struct ModelNode
37 {
41  enum
42  {
43  // store object + attribute name
45  // store object + attribute name
47  // store object + attribute name
49  // store index + value (object)
51  // store object
53  } type;
54 
55  std::string name;
57  uint32_t index;
58 };
59 
66 {
67  public:
68  ModelCreator();
69 
74  void Build(GtkTreeStore* treestore);
75 
76  private:
77  void DoVisitAttribute(Ptr<Object> object, std::string name) override;
78  void DoStartVisitObject(Ptr<Object> object) override;
79  void DoEndVisitObject() override;
81  std::string name,
82  Ptr<Object> value) override;
83  void DoEndVisitPointerAttribute() override;
85  std::string name,
86  const ObjectPtrContainerValue& vector) override;
87  void DoEndVisitArrayAttribute() override;
89  uint32_t index,
90  Ptr<Object> item) override;
91  void DoEndVisitArrayItem() override;
96  void Add(ModelNode* node);
98  void Remove();
99 
100  GtkTreeStore* m_treestore;
101  std::vector<GtkTreeIter*> m_iters;
102 };
103 } // namespace ns3
Iterator to iterate on the values of attributes of an ns3::Object.
ModelCreator class.
void DoEndVisitArrayAttribute() override
End the visit to the attribute of type ns3::ObjectVectorValue.
void DoEndVisitPointerAttribute() override
End the visit to the attribute of type ns3::PointerValue.
GtkTreeStore * m_treestore
attribute tree
void DoStartVisitObject(Ptr< Object > object) override
This method is called to start the process of visiting the input object.
void DoStartVisitPointerAttribute(Ptr< Object > object, std::string name, Ptr< Object > value) override
Visit the attribute of type ns3::PointerValue, with the provided name, found on the object pointed to...
void DoStartVisitArrayItem(const ObjectPtrContainerValue &vector, uint32_t index, Ptr< Object > item) override
Start to visit the object found in the input array at the provided index.
std::vector< GtkTreeIter * > m_iters
attribute tree item
void Build(GtkTreeStore *treestore)
Allocate attribute tree.
void DoStartVisitArrayAttribute(Ptr< Object > object, std::string name, const ObjectPtrContainerValue &vector) override
Visit the attribute of type ns3::ObjectVectorValue, with the provided name, found on the object point...
void Add(ModelNode *node)
Add item to attribute tree.
void Remove()
Remove current tree item.
void DoEndVisitArrayItem() override
End the visit to the array item.
void DoEndVisitObject() override
This method is called to end the process of visiting the currently visited object.
void DoVisitAttribute(Ptr< Object > object, std::string name) override
This method visits and performs a config-store action (such as saving to a text file) on the attribut...
Container for a set of ns3::Object pointers.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
A class used in the implementation of the GtkConfigStore.
Ptr< Object > object
the object
uint32_t index
index
std::string name
node name
enum ns3::ModelNode::@3 type
node type structure