Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 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 "ccnb-parser-depth-first-visitor.h" |
| 22 | |
Alexander Afanasyev | f9f4eb0 | 2011-12-16 01:51:14 -0800 | [diff] [blame] | 23 | #include "../syntax-tree/ccnb-parser-blob.h" |
| 24 | #include "../syntax-tree/ccnb-parser-udata.h" |
| 25 | #include "../syntax-tree/ccnb-parser-tag.h" |
| 26 | #include "../syntax-tree/ccnb-parser-dtag.h" |
| 27 | #include "../syntax-tree/ccnb-parser-attr.h" |
| 28 | #include "../syntax-tree/ccnb-parser-dattr.h" |
| 29 | #include "../syntax-tree/ccnb-parser-ext.h" |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 30 | |
| 31 | #include <boost/foreach.hpp> |
| 32 | |
| 33 | namespace ns3 { |
| 34 | namespace CcnbParser { |
| 35 | |
| 36 | boost::any |
Alexander Afanasyev | e709f3d | 2011-08-21 17:55:45 -0700 | [diff] [blame] | 37 | DepthFirstVisitor::visit (Blob &n, boost::any param) |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 38 | { |
| 39 | // Buffer n.m_blob; |
| 40 | return n.m_blob; |
| 41 | } |
| 42 | |
| 43 | boost::any |
Alexander Afanasyev | e709f3d | 2011-08-21 17:55:45 -0700 | [diff] [blame] | 44 | DepthFirstVisitor::visit (Udata &n, boost::any param) |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 45 | { |
| 46 | // std::string n.m_udata; |
| 47 | return n.m_udata; |
| 48 | } |
| 49 | |
| 50 | boost::any |
Alexander Afanasyev | e709f3d | 2011-08-21 17:55:45 -0700 | [diff] [blame] | 51 | DepthFirstVisitor::visit (Tag &n, boost::any param) |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 52 | { |
| 53 | // std::string n.m_tag; |
| 54 | // std::list<Ptr<Block> > n.m_attrs; |
| 55 | // std::list<Ptr<Block> > n.m_nestedBlocks; |
| 56 | BOOST_FOREACH (Ptr<Block> block, n.m_attrs) |
| 57 | { |
| 58 | block->accept (*this, param); |
| 59 | } |
Alexander Afanasyev | e709f3d | 2011-08-21 17:55:45 -0700 | [diff] [blame] | 60 | BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags) |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 61 | { |
| 62 | block->accept (*this, param); |
| 63 | } |
| 64 | return boost::any(); |
| 65 | } |
| 66 | |
| 67 | boost::any |
Alexander Afanasyev | e709f3d | 2011-08-21 17:55:45 -0700 | [diff] [blame] | 68 | DepthFirstVisitor::visit (Dtag &n, boost::any param) |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 69 | { |
| 70 | // std::string n.m_tag; |
| 71 | // std::list<Ptr<Block> > n.m_attrs; |
| 72 | // std::list<Ptr<Block> > n.m_nestedBlocks; |
| 73 | BOOST_FOREACH (Ptr<Block> block, n.m_attrs) |
| 74 | { |
| 75 | block->accept (*this, param); |
| 76 | } |
Alexander Afanasyev | e709f3d | 2011-08-21 17:55:45 -0700 | [diff] [blame] | 77 | BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags) |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 78 | { |
| 79 | block->accept (*this, param); |
| 80 | } |
| 81 | return boost::any (); |
| 82 | } |
| 83 | |
| 84 | boost::any |
Alexander Afanasyev | e709f3d | 2011-08-21 17:55:45 -0700 | [diff] [blame] | 85 | DepthFirstVisitor::visit (Attr &n, boost::any param) |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 86 | { |
| 87 | // std::string n.m_attr; |
| 88 | // Ptr<Udata> n.m_value; |
| 89 | return boost::any (); |
| 90 | } |
| 91 | |
| 92 | boost::any |
Alexander Afanasyev | e709f3d | 2011-08-21 17:55:45 -0700 | [diff] [blame] | 93 | DepthFirstVisitor::visit (Dattr &n, boost::any param) |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 94 | { |
| 95 | // uint32_t n.m_dattr; |
| 96 | // Ptr<Udata> n.m_value; |
| 97 | return boost::any (); |
| 98 | } |
| 99 | |
| 100 | boost::any |
Alexander Afanasyev | e709f3d | 2011-08-21 17:55:45 -0700 | [diff] [blame] | 101 | DepthFirstVisitor::visit (Ext &n, boost::any param) |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 102 | { |
| 103 | // uint64_t n.m_extSubtype; |
| 104 | return n.m_extSubtype; |
| 105 | } |
| 106 | |
| 107 | } |
| 108 | } |