A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
model-typeid-creator.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License version 2 as
5
* published by the Free Software Foundation;
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
*
16
* Author: Faker Moatamri <faker.moatamri@sophia.inria.fr>
17
*/
18
19
#include "
model-typeid-creator.h
"
20
21
namespace
ns3 {
22
23
ModelTypeidCreator::ModelTypeidCreator
()
24
{
25
}
26
void
27
28
ModelTypeidCreator::Build
(GtkTreeStore *treestore)
29
{
30
m_treestore
= treestore;
31
m_iters
.push_back (0);
32
Iterate
();
33
NS_ASSERT
(
m_iters
.size () == 1);
34
}
35
36
void
37
ModelTypeidCreator::Add
(
ModelTypeid
*node)
38
{
39
GtkTreeIter *parent =
m_iters
.back ();
40
GtkTreeIter *
current
= g_new (GtkTreeIter, 1);
41
gtk_tree_store_append (
m_treestore
, current, parent);
42
gtk_tree_store_set (
m_treestore
, current,
COL_TYPEID
, node, -1);
43
m_iters
.push_back (current);
44
}
45
46
void
47
ModelTypeidCreator::Remove
(
void
)
48
{
49
GtkTreeIter *iter =
m_iters
.back ();
50
g_free (iter);
51
m_iters
.pop_back ();
52
}
53
54
void
55
ModelTypeidCreator::VisitAttribute
(
TypeId
tid, std::string name, std::string defaultValue, uint32_t index)
56
{
57
ModelTypeid
*node =
new
ModelTypeid
();
58
node->
type
=
ModelTypeid::NODE_ATTRIBUTE
;
59
node->
tid
= tid;
60
node->
name
= name;
61
node->
defaultValue
= defaultValue;
62
node->
index
= index;
63
Add
(node);
64
Remove
();
65
}
66
67
void
68
ModelTypeidCreator::StartVisitTypeId
(std::string name)
69
{
70
ModelTypeid
*node =
new
ModelTypeid
();
71
node->
type
=
ModelTypeid::NODE_TYPEID
;
72
node->
tid
=
TypeId::LookupByName
(name);
73
Add
(node);
74
}
75
76
void
77
ModelTypeidCreator::EndVisitTypeId
(
void
)
78
{
79
Remove
();
80
}
81
}
//end namespace ns3
ns3::ModelTypeidCreator::m_iters
std::vector< GtkTreeIter * > m_iters
Definition:
model-typeid-creator.h:80
ns3::ModelTypeidCreator::m_treestore
GtkTreeStore * m_treestore
Definition:
model-typeid-creator.h:78
ns3::ModelTypeidCreator::VisitAttribute
virtual void VisitAttribute(TypeId tid, std::string name, std::string defaultValue, uint32_t index)
This method will add a ModelTypeid to the GtkTreeIterator.
Definition:
model-typeid-creator.cc:55
ns3::ModelTypeid::NODE_TYPEID
Definition:
model-typeid-creator.h:38
ns3::ModelTypeid::type
enum ns3::ModelTypeid::@3 type
NS_ASSERT
#define NS_ASSERT(condition)
Definition:
assert.h:64
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:28
ns3::ModelTypeid::NODE_ATTRIBUTE
Definition:
model-typeid-creator.h:36
ns3::ModelTypeid::defaultValue
std::string defaultValue
Definition:
model-typeid-creator.h:41
ns3::ModelTypeidCreator::ModelTypeidCreator
ModelTypeidCreator()
Definition:
model-typeid-creator.cc:23
ns3::ModelTypeid::name
std::string name
Definition:
model-typeid-creator.h:40
ns3::ModelTypeid::tid
TypeId tid
Definition:
model-typeid-creator.h:43
ns3::ModelTypeidCreator::EndVisitTypeId
virtual void EndVisitTypeId(void)
Remove the last gtk tree iterator.
Definition:
model-typeid-creator.cc:77
ns3::ModelTypeidCreator::StartVisitTypeId
virtual void StartVisitTypeId(std::string name)
Add a node for the new TypeId object.
Definition:
model-typeid-creator.cc:68
current
Time current
Definition:
tcp-variants-comparison.cc:59
ns3::COL_TYPEID
Definition:
model-typeid-creator.h:28
ns3::ModelTypeidCreator::Add
void Add(ModelTypeid *node)
Adds a treestore iterator to m_treestore model.
Definition:
model-typeid-creator.cc:37
ns3::ModelTypeidCreator::Remove
void Remove(void)
Removes the last GtkTreeIterator from m_iters.
Definition:
model-typeid-creator.cc:47
ns3::AttributeDefaultIterator::Iterate
void Iterate(void)
This function will go through all the TypeIds and get only the attributes which are explicit values (...
Definition:
attribute-default-iterator.cc:35
ns3::ModelTypeid::index
uint32_t index
Definition:
model-typeid-creator.h:45
model-typeid-creator.h
ns3::ModelTypeid
Definition:
model-typeid-creator.h:31
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::LookupByName
static TypeId LookupByName(std::string name)
Definition:
type-id.cc:536
src
config-store
model
model-typeid-creator.cc
Generated on Sat Apr 19 2014 14:06:51 for ns-3 by
1.8.6