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
#ifndef MODEL_TYPEID_CREATOR_H
8
#define MODEL_TYPEID_CREATOR_H
9
10
#include "
attribute-default-iterator.h
"
11
12
#include "ns3/type-id.h"
13
14
#include <gtk/gtk.h>
15
#include <vector>
16
17
namespace
ns3
18
{
19
20
enum
21
{
22
COL_TYPEID
= 0,
23
COL_LASTID
24
};
25
26
/**
27
* @ingroup configstore
28
* @brief A class used in the implementation of the GtkConfigStore
29
*/
30
struct
ModelTypeid
31
{
32
/**
33
* @brief Whether the node represents an attribute or TypeId
34
*/
35
enum
36
{
37
// store TypeId + attribute name +defaultValue and index
38
NODE_ATTRIBUTE
,
39
// store TypeId
40
NODE_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
48
TypeId
tid
;
49
/// stores the index of the attribute in list of attributes for a given TypeId
50
uint32_t
index
;
51
};
52
53
/**
54
* @ingroup configstore
55
* @brief ModelTypeIdCreator class
56
*/
57
class
ModelTypeidCreator
:
public
AttributeDefaultIterator
58
{
59
public
:
60
ModelTypeidCreator
();
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
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::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:102
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:100
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:22
ns3::COL_LASTID
@ COL_LASTID
Definition
model-typeid-creator.h:23
ns3::ModelTypeid
A class used in the implementation of the GtkConfigStore.
Definition
model-typeid-creator.h:31
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:50
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:48
ns3::ModelTypeid::type
enum ns3::ModelTypeid::@372067002020026241074307157075166374022350367224 type
Whether the node represents an attribute or TypeId.
ns3::ModelTypeid::defaultValue
std::string defaultValue
TypeId default value.
Definition
model-typeid-creator.h:46
ns3::ModelTypeid::name
std::string name
TypeId name.
Definition
model-typeid-creator.h:44
ns3::ModelTypeid::NODE_TYPEID
@ NODE_TYPEID
Definition
model-typeid-creator.h:40
ns3::ModelTypeid::NODE_ATTRIBUTE
@ NODE_ATTRIBUTE
Definition
model-typeid-creator.h:38
src
config-store
model
model-typeid-creator.h
Generated on
for ns-3 by
1.15.0