A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
23namespace ns3
24{
25
26enum
27{
30};
31
32/**
33 * \ingroup configstore
34 * \brief A class used in the implementation of the GtkConfigStore
35 */
37{
38 /**
39 * \brief node type structure
40 */
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; ///< node type
54
55 std::string name; ///< node name
56 Ptr<Object> object; ///< the object
57 uint32_t index; ///< index
58};
59
60/**
61 * \ingroup configstore
62 * \brief ModelCreator class
63 *
64 */
66{
67 public:
69
70 /**
71 * Allocate attribute tree
72 * \param treestore GtkTreeStore *
73 */
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;
92 /**
93 * Add item to attribute tree
94 * \param node The model node
95 */
96 void Add(ModelNode* node);
97 /// Remove current tree item
98 void Remove();
99
100 GtkTreeStore* m_treestore; ///< attribute tree
101 std::vector<GtkTreeIter*> m_iters; ///< attribute tree item
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.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.
A class used in the implementation of the GtkConfigStore.
enum ns3::ModelNode::@1 type
node type structure
Ptr< Object > object
the object
uint32_t index
index
std::string name
node name