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 | #ifndef _CCNB_PARSER_BLOCK_H_ |
| 22 | #define _CCNB_PARSER_BLOCK_H_ |
| 23 | |
| 24 | #include "ns3/simple-ref-count.h" |
| 25 | #include "ns3/buffer.h" |
| 26 | #include "ns3/ptr.h" |
| 27 | |
| 28 | // visitors |
| 29 | #include "ns3/ccnb-parser-void-no-argu-visitor.h" |
| 30 | #include "ns3/ccnb-parser-void-visitor.h" |
| 31 | #include "ns3/ccnb-parser-no-argu-visitor.h" |
| 32 | #include "ns3/ccnb-parser-visitor.h" |
| 33 | |
| 34 | namespace ns3 { |
| 35 | namespace CcnbParser { |
| 36 | |
| 37 | /** |
| 38 | * \ingroup ccnx-ccnb |
| 39 | * \brief Base class for ccnb-encoded node |
| 40 | * |
| 41 | * This class provides a static method to create a new block |
| 42 | * (recursively) from the stream |
| 43 | * |
| 44 | * \see http://www.ccnx.org/releases/latest/doc/technical/BinaryEncoding.html |
| 45 | */ |
| 46 | class Block : public SimpleRefCount<Block> |
| 47 | { |
| 48 | public: |
| 49 | /** |
| 50 | * \brief Parsing stream (recursively) and creating a parsed BLOCK |
| 51 | * object |
| 52 | * |
| 53 | * \param start buffer iterator pointing to the start position for parsing |
| 54 | * \returns parsed ccnb-encoded block, that could contain more block inside |
| 55 | */ |
| 56 | static Ptr<Block> |
| 57 | ParseBlock (Buffer::Iterator &start); |
| 58 | |
Alexander Afanasyev | e709f3d | 2011-08-21 17:55:45 -0700 | [diff] [blame] | 59 | virtual void accept( VoidNoArguVisitor &v ) = 0; |
| 60 | virtual void accept( VoidVisitor &v, boost::any param ) = 0; |
| 61 | virtual boost::any accept( NoArguVisitor &v ) = 0; |
| 62 | virtual boost::any accept( Visitor &v, boost::any param ) = 0; |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | #endif // _CCNB_PARSER_BLOCK_H_ |