A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
model-typeid-creator.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 *
4 * Author: Moatamri Faker <faker.moatamri@sophia.inria.fr>
5 */
6
8
9#include "ns3/type-id.h"
10
11#include <gtk/gtk.h>
12#include <vector>
13
14namespace ns3
15{
16
17enum
18{
21};
22
23/**
24 * @ingroup configstore
25 * @brief A class used in the implementation of the GtkConfigStore
26 */
28{
29 /**
30 * @brief Whether the node represents an attribute or TypeId
31 */
32 enum
33 {
34 // store TypeId + attribute name +defaultValue and index
36 // store TypeId
38 } type; ///< node type
39
40 /// TypeId name
41 std::string name;
42 /// TypeId default value
43 std::string defaultValue;
44 /// The TypeId object and if it is an attribute, it's the TypeId object of the attribute
46 /// stores the index of the attribute in list of attributes for a given TypeId
48};
49
50/**
51 * @ingroup configstore
52 * @brief ModelTypeIdCreator class
53 */
55{
56 public:
58 /**
59 * @brief This method will iterate on typeIds having default attributes and create a model
60 * for them, this model will be used by the view.
61 *
62 * @param treestore the GtkTreeStore.
63 */
64 void Build(GtkTreeStore* treestore);
65
66 private:
67 /**
68 * @brief This method will add a ModelTypeid to the GtkTreeIterator
69 * @param tid TypeId
70 * @param name attribute name
71 * @param defaultValue default value
72 * @param index index of the attribute in the specified Typeid
73 */
74 void VisitAttribute(TypeId tid,
75 std::string name,
76 std::string defaultValue,
77 uint32_t index) override;
78 /**
79 * @brief Add a node for the new TypeId object
80 * @param name TypeId name
81 */
82 void StartVisitTypeId(std::string name) override;
83 /**
84 * @brief Remove the last gtk tree iterator
85 */
86 void EndVisitTypeId() override;
87 /**
88 * @brief Adds a treestore iterator to m_treestore model
89 * @param node the node to be added
90 */
91 void Add(ModelTypeid* node);
92 /**
93 * Removes the last GtkTreeIterator from m_iters
94 */
95 void Remove();
96 /// this is the TreeStore model corresponding to the view
97 GtkTreeStore* m_treestore;
98 /// This contains a vector of iterators used to build the TreeStore
99 std::vector<GtkTreeIter*> m_iters;
100};
101} // 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:49
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.