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
* 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
18
#include "
attribute-default-iterator.h
"
19
20
#include "ns3/type-id.h"
21
22
#include <gtk/gtk.h>
23
#include <vector>
24
25
namespace
ns3
26
{
27
28
enum
29
{
30
COL_TYPEID
= 0,
31
COL_LASTID
32
};
33
34
/**
35
* \ingroup configstore
36
* \brief A class used in the implementation of the GtkConfigStore
37
*/
38
struct
ModelTypeid
39
{
40
/**
41
* \brief Whether the node represents an attribute or TypeId
42
*/
43
enum
44
{
45
// store TypeId + attribute name +defaultValue and index
46
NODE_ATTRIBUTE
,
47
// store TypeId
48
NODE_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
56
TypeId
tid
;
57
/// stores the index of the attribute in list of attributes for a given TypeId
58
uint32_t
index
;
59
};
60
61
/**
62
* \ingroup configstore
63
* \brief ModelTypeIdCreator class
64
*/
65
class
ModelTypeidCreator
:
public
AttributeDefaultIterator
66
{
67
public
:
68
ModelTypeidCreator
();
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
attribute-default-iterator.h
ns3::AttributeDefaultIterator
Iterator to iterate on the default values of attributes of an ns3::Object.
Definition:
attribute-default-iterator.h:35
ns3::ModelTypeidCreator
ModelTypeIdCreator class.
Definition:
model-typeid-creator.h:66
ns3::ModelTypeidCreator::EndVisitTypeId
void EndVisitTypeId() override
Remove the last gtk tree iterator.
Definition:
model-typeid-creator.cc:81
ns3::ModelTypeidCreator::StartVisitTypeId
void StartVisitTypeId(std::string name) override
Add a node for the new TypeId object.
Definition:
model-typeid-creator.cc:72
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:110
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:56
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:29
ns3::ModelTypeidCreator::ModelTypeidCreator
ModelTypeidCreator()
Definition:
model-typeid-creator.cc:23
ns3::ModelTypeidCreator::Add
void Add(ModelTypeid *node)
Adds a treestore iterator to m_treestore model.
Definition:
model-typeid-creator.cc:38
ns3::ModelTypeidCreator::m_treestore
GtkTreeStore * m_treestore
this is the TreeStore model corresponding to the view
Definition:
model-typeid-creator.h:108
ns3::ModelTypeidCreator::Remove
void Remove()
Removes the last GtkTreeIterator from m_iters.
Definition:
model-typeid-creator.cc:48
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
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:30
ns3::COL_LASTID
@ COL_LASTID
Definition:
model-typeid-creator.h:31
ns3::ModelTypeid
A class used in the implementation of the GtkConfigStore.
Definition:
model-typeid-creator.h:39
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:58
ns3::ModelTypeid::NODE_TYPEID
@ NODE_TYPEID
Definition:
model-typeid-creator.h:48
ns3::ModelTypeid::NODE_ATTRIBUTE
@ NODE_ATTRIBUTE
Definition:
model-typeid-creator.h:46
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:56
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:54
ns3::ModelTypeid::name
std::string name
TypeId name.
Definition:
model-typeid-creator.h:52
src
config-store
model
model-typeid-creator.h
Generated on Mon Aug 12 2024 11:16:12 for ns-3 by
1.9.6