NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
depth-first-visitor.cc
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2
/*
3
* Copyright (c) 2011 University of California, Los Angeles
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19
*/
20
21
#include "depth-first-visitor.h"
22
23
#include "../syntax-tree/blob.h"
24
#include "../syntax-tree/udata.h"
25
#include "../syntax-tree/tag.h"
26
#include "../syntax-tree/dtag.h"
27
#include "../syntax-tree/attr.h"
28
#include "../syntax-tree/dattr.h"
29
#include "../syntax-tree/ext.h"
30
31
#include <boost/foreach.hpp>
32
33
NDN_NAMESPACE_BEGIN
34
35
namespace
wire {
36
namespace
CcnbParser {
37
38
boost::any
39
DepthFirstVisitor::visit (
Blob
&n, boost::any param)
40
{
41
// Buffer n.m_blob;
42
return
n.
m_blob
;
43
}
44
45
boost::any
46
DepthFirstVisitor::visit (
Udata
&n, boost::any param)
47
{
48
// std::string n.m_udata;
49
return
n.
m_udata
;
50
}
51
52
boost::any
53
DepthFirstVisitor::visit (
Tag
&n, boost::any param)
54
{
55
// std::string n.m_tag;
56
// std::list<Ptr<Block> > n.m_attrs;
57
// std::list<Ptr<Block> > n.m_nestedBlocks;
58
BOOST_FOREACH (Ptr<Block> block, n.
m_attrs
)
59
{
60
block->accept (*
this
, param);
61
}
62
BOOST_FOREACH (Ptr<Block> block, n.
m_nestedTags
)
63
{
64
block->accept (*
this
, param);
65
}
66
return
boost::any();
67
}
68
69
boost::any
70
DepthFirstVisitor::visit (
Dtag
&n, boost::any param)
71
{
72
// std::string n.m_tag;
73
// std::list<Ptr<Block> > n.m_attrs;
74
// std::list<Ptr<Block> > n.m_nestedBlocks;
75
BOOST_FOREACH (Ptr<Block> block, n.
m_attrs
)
76
{
77
block->accept (*
this
, param);
78
}
79
BOOST_FOREACH (Ptr<Block> block, n.
m_nestedTags
)
80
{
81
block->accept (*
this
, param);
82
}
83
return
boost::any ();
84
}
85
86
boost::any
87
DepthFirstVisitor::visit (
Attr
&n, boost::any param)
88
{
89
// std::string n.m_attr;
90
// Ptr<Udata> n.m_value;
91
return
boost::any ();
92
}
93
94
boost::any
95
DepthFirstVisitor::visit (
Dattr
&n, boost::any param)
96
{
97
// uint32_t n.m_dattr;
98
// Ptr<Udata> n.m_value;
99
return
boost::any ();
100
}
101
102
boost::any
103
DepthFirstVisitor::visit (
Ext
&n, boost::any param)
104
{
105
// uint64_t n.m_extSubtype;
106
return
n.
m_extSubtype
;
107
}
108
109
}
// CcnbParser
110
}
// wire
111
112
NDN_NAMESPACE_END
ns3::ndn::wire::CcnbParser::Ext::m_extSubtype
uint64_t m_extSubtype
Extension type.
Definition:
ext.h:55
ns3::ndn::wire::CcnbParser::BaseTag::m_nestedTags
std::list< Ptr< Block > > m_nestedTags
List of nested tags.
Definition:
base-tag.h:43
ns3::ndn::wire::CcnbParser::Dattr
Class to represent DATTR ccnb-encoded node.
Definition:
dattr.h:37
ns3::ndn::wire::CcnbParser::Udata::m_udata
std::string m_udata
field holding a parsed UDATA value of the block
Definition:
udata.h:54
ns3::ndn::wire::CcnbParser::Dtag
Class to represent DTAG ccnb-encoded node.
Definition:
dtag.h:37
ns3::ndn::wire::CcnbParser::Blob::m_blob
char * m_blob
field holding a parsed BLOB value of the block
Definition:
blob.h:56
ns3::ndn::wire::CcnbParser::Blob
Class to represent BLOB ccnb-encoded node.
Definition:
blob.h:37
ns3::ndn::wire::CcnbParser::Attr
Class to represent ATTR ccnb-encoded node.
Definition:
attr.h:38
ns3::ndn::wire::CcnbParser::Tag
Class to represent TAG ccnb-encoded node.
Definition:
tag.h:38
ns3::ndn::wire::CcnbParser::Ext
Class to represent EXT ccnb-encoded node.
Definition:
ext.h:37
ns3::ndn::wire::CcnbParser::Udata
Class to represent UDATA ccnb-encoded node.
Definition:
udata.h:36
ns3::ndn::wire::CcnbParser::BaseTag::m_attrs
std::list< Ptr< Block > > m_attrs
List of attributes, associated with this tag.
Definition:
base-tag.h:42
ndnSIM
model
wire
ccnb
ccnb-parser
visitors
depth-first-visitor.cc
Generated on Mon Jan 19 2015 11:27:04 for ndnSIM by
1.8.7