A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
#include "
attribute-default-iterator.h
"
8
9
#include "ns3/type-id.h"
10
11
#include <gtk/gtk.h>
12
#include <vector>
13
14
namespace
ns3
15
{
16
17
enum
18
{
19
COL_TYPEID
= 0,
20
COL_LASTID
21
};
22
23
/**
24
* @ingroup configstore
25
* @brief A class used in the implementation of the GtkConfigStore
26
*/
27
struct
ModelTypeid
28
{
29
/**
30
* @brief Whether the node represents an attribute or TypeId
31
*/
32
enum
33
{
34
// store TypeId + attribute name +defaultValue and index
35
NODE_ATTRIBUTE
,
36
// store TypeId
37
NODE_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
45
TypeId
tid
;
46
/// stores the index of the attribute in list of attributes for a given TypeId
47
uint32_t
index
;
48
};
49
50
/**
51
* @ingroup configstore
52
* @brief ModelTypeIdCreator class
53
*/
54
class
ModelTypeidCreator
:
public
AttributeDefaultIterator
55
{
56
public
:
57
ModelTypeidCreator
();
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
attribute-default-iterator.h
ns3::AttributeDefaultIterator
Iterator to iterate on the default values of attributes of an ns3::Object.
Definition
attribute-default-iterator.h:24
ns3::ModelTypeidCreator
ModelTypeIdCreator class.
Definition
model-typeid-creator.h:55
ns3::ModelTypeidCreator::EndVisitTypeId
void EndVisitTypeId() override
Remove the last gtk tree iterator.
Definition
model-typeid-creator.cc:70
ns3::ModelTypeidCreator::StartVisitTypeId
void StartVisitTypeId(std::string name) override
Add a node for the new TypeId object.
Definition
model-typeid-creator.cc:61
ns3::ModelTypeidCreator::m_iters
std::vector< GtkTreeIter * > m_iters
This contains a vector of iterators used to build the TreeStore.
Definition
model-typeid-creator.h:99
ns3::ModelTypeidCreator::VisitAttribute
void VisitAttribute(TypeId tid, std::string name, std::string defaultValue, uint32_t index) override
This method will add a ModelTypeid to the GtkTreeIterator.
Definition
model-typeid-creator.cc:45
ns3::ModelTypeidCreator::Build
void Build(GtkTreeStore *treestore)
This method will iterate on typeIds having default attributes and create a model for them,...
Definition
model-typeid-creator.cc:18
ns3::ModelTypeidCreator::ModelTypeidCreator
ModelTypeidCreator()
Definition
model-typeid-creator.cc:12
ns3::ModelTypeidCreator::Add
void Add(ModelTypeid *node)
Adds a treestore iterator to m_treestore model.
Definition
model-typeid-creator.cc:27
ns3::ModelTypeidCreator::m_treestore
GtkTreeStore * m_treestore
this is the TreeStore model corresponding to the view
Definition
model-typeid-creator.h:97
ns3::ModelTypeidCreator::Remove
void Remove()
Removes the last GtkTreeIterator from m_iters.
Definition
model-typeid-creator.cc:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:49
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::COL_TYPEID
@ COL_TYPEID
Definition
model-typeid-creator.h:19
ns3::COL_LASTID
@ COL_LASTID
Definition
model-typeid-creator.h:20
ns3::ModelTypeid
A class used in the implementation of the GtkConfigStore.
Definition
model-typeid-creator.h:28
ns3::ModelTypeid::index
uint32_t index
stores the index of the attribute in list of attributes for a given TypeId
Definition
model-typeid-creator.h:47
ns3::ModelTypeid::NODE_TYPEID
@ NODE_TYPEID
Definition
model-typeid-creator.h:37
ns3::ModelTypeid::NODE_ATTRIBUTE
@ NODE_ATTRIBUTE
Definition
model-typeid-creator.h:35
ns3::ModelTypeid::tid
TypeId tid
The TypeId object and if it is an attribute, it's the TypeId object of the attribute.
Definition
model-typeid-creator.h:45
ns3::ModelTypeid::type
enum ns3::ModelTypeid::@3 type
Whether the node represents an attribute or TypeId.
ns3::ModelTypeid::defaultValue
std::string defaultValue
TypeId default value.
Definition
model-typeid-creator.h:43
ns3::ModelTypeid::name
std::string name
TypeId name.
Definition
model-typeid-creator.h:41
src
config-store
model
model-typeid-creator.h
Generated on Tue Apr 29 2025 11:06:51 for ns-3 by
1.11.0