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
7#ifndef MODEL_TYPEID_CREATOR_H
8#define MODEL_TYPEID_CREATOR_H
9
11
12#include "ns3/type-id.h"
13
14#include <gtk/gtk.h>
15#include <vector>
16
17namespace ns3
18{
19
20enum
21{
24};
25
26/**
27 * @ingroup configstore
28 * @brief A class used in the implementation of the GtkConfigStore
29 */
31{
32 /**
33 * @brief Whether the node represents an attribute or TypeId
34 */
35 enum
36 {
37 // store TypeId + attribute name +defaultValue and index
39 // store TypeId
41 } type; ///< node type
42
43 /// TypeId name
44 std::string name;
45 /// TypeId default value
46 std::string defaultValue;
47 /// The TypeId object and if it is an attribute, it's the TypeId object of the attribute
49 /// stores the index of the attribute in list of attributes for a given TypeId
51};
52
53/**
54 * @ingroup configstore
55 * @brief ModelTypeIdCreator class
56 */
58{
59 public:
61 /**
62 * @brief This method will iterate on typeIds having default attributes and create a model
63 * for them, this model will be used by the view.
64 *
65 * @param treestore the GtkTreeStore.
66 */
67 void Build(GtkTreeStore* treestore);
68
69 private:
70 /**
71 * @brief This method will add a ModelTypeid to the GtkTreeIterator
72 * @param tid TypeId
73 * @param name attribute name
74 * @param defaultValue default value
75 * @param index index of the attribute in the specified Typeid
76 */
77 void VisitAttribute(TypeId tid,
78 std::string name,
79 std::string defaultValue,
80 uint32_t index) override;
81 /**
82 * @brief Add a node for the new TypeId object
83 * @param name TypeId name
84 */
85 void StartVisitTypeId(std::string name) override;
86 /**
87 * @brief Remove the last gtk tree iterator
88 */
89 void EndVisitTypeId() override;
90 /**
91 * @brief Adds a treestore iterator to m_treestore model
92 * @param node the node to be added
93 */
94 void Add(ModelTypeid* node);
95 /**
96 * Removes the last GtkTreeIterator from m_iters
97 */
98 void Remove();
99 /// this is the TreeStore model corresponding to the view
100 GtkTreeStore* m_treestore;
101 /// This contains a vector of iterators used to build the TreeStore
102 std::vector<GtkTreeIter*> m_iters;
103};
104} // namespace ns3
105
106#endif // MODEL_TYPEID_CREATOR_H
Iterator to iterate on the default values of attributes of an ns3::Object.
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::@372067002020026241074307157075166374022350367224 type
Whether the node represents an attribute or TypeId.
std::string defaultValue
TypeId default value.
std::string name
TypeId name.