A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
model-typeid-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 * Author: Moatamri Faker <faker.moatamri@sophia.inria.fr>
16 */
17
19
20#include "ns3/type-id.h"
21
22#include <gtk/gtk.h>
23#include <vector>
24
25namespace ns3
26{
27
28enum
29{
32};
33
34/**
35 * \ingroup configstore
36 * \brief A class used in the implementation of the GtkConfigStore
37 */
39{
40 /**
41 * \brief Whether the node represents an attribute or TypeId
42 */
43 enum
44 {
45 // store TypeId + attribute name +defaultValue and index
47 // store TypeId
49 } type; ///< node type
50
51 /// TypeId name
52 std::string name;
53 /// TypeId default value
54 std::string defaultValue;
55 /// The TypeId object and if it is an attribute, it's the TypeId object of the attribute
57 /// stores the index of the attribute in list of attributes for a given TypeId
59};
60
61/**
62 * \ingroup configstore
63 * \brief ModelTypeIdCreator class
64 */
66{
67 public:
69 /**
70 * \brief This method will iterate on typeIds having default attributes and create a model
71 * for them, this model will be used by the view.
72 *
73 * \param treestore the GtkTreeStore.
74 */
75 void Build(GtkTreeStore* treestore);
76
77 private:
78 /**
79 * \brief This method will add a ModelTypeid to the GtkTreeIterator
80 * \param tid TypeId
81 * \param name attribute name
82 * \param defaultValue default value
83 * \param index index of the attribute in the specified Typeid
84 */
85 void VisitAttribute(TypeId tid,
86 std::string name,
87 std::string defaultValue,
88 uint32_t index) override;
89 /**
90 * \brief Add a node for the new TypeId object
91 * \param name TypeId name
92 */
93 void StartVisitTypeId(std::string name) override;
94 /**
95 * \brief Remove the last gtk tree iterator
96 */
97 void EndVisitTypeId() override;
98 /**
99 * \brief Adds a treestore iterator to m_treestore model
100 * \param node the node to be added
101 */
102 void Add(ModelTypeid* node);
103 /**
104 * Removes the last GtkTreeIterator from m_iters
105 */
106 void Remove();
107 /// this is the TreeStore model corresponding to the view
108 GtkTreeStore* m_treestore;
109 /// This contains a vector of iterators used to build the TreeStore
110 std::vector<GtkTreeIter*> m_iters;
111};
112} // namespace ns3
Iterator to iterate on the default values of attributes of an ns3::Object.
ModelTypeIdCreator class.
void EndVisitTypeId() override
Remove the last gtk tree iterator.
void StartVisitTypeId(std::string name) override
Add a node for the new TypeId object.
std::vector< GtkTreeIter * > m_iters
This contains a vector of iterators used to build the TreeStore.
void VisitAttribute(TypeId tid, std::string name, std::string defaultValue, uint32_t index) override
This method will add a ModelTypeid to the GtkTreeIterator.
void Build(GtkTreeStore *treestore)
This method will iterate on typeIds having default attributes and create a model for them,...
void Add(ModelTypeid *node)
Adds a treestore iterator to m_treestore model.
GtkTreeStore * m_treestore
this is the TreeStore model corresponding to the view
void Remove()
Removes the last GtkTreeIterator from m_iters.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
A class used in the implementation of the GtkConfigStore.
uint32_t index
stores the index of the attribute in list of attributes for a given TypeId
TypeId tid
The TypeId object and if it is an attribute, it's the TypeId object of the attribute.
enum ns3::ModelTypeid::@3 type
Whether the node represents an attribute or TypeId.
std::string defaultValue
TypeId default value.
std::string name
TypeId name.