NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
block.h
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 "../visitors/void-no-argu-visitor.h"
30 #include "../visitors/void-visitor.h"
31 #include "../visitors/no-argu-visitor.h"
32 #include "../visitors/visitor.h"
33 
34 NDN_NAMESPACE_BEGIN
35 
36 namespace wire {
37 namespace CcnbParser {
38 
48 class Block : public SimpleRefCount<Block>
49 {
50 public:
51  // static int counter;
61  static Ptr<Block>
62  ParseBlock (Buffer::Iterator &start, bool dontParseBlock = false);
63 
64  virtual ~Block ();
65 
66  virtual void accept( VoidNoArguVisitor &v ) = 0;
67  virtual void accept( VoidVisitor &v, boost::any param ) = 0;
68  virtual boost::any accept( NoArguVisitor &v ) = 0;
69  virtual boost::any accept( Visitor &v, boost::any param ) = 0;
70 };
71 
77 inline
78 uint8_t
79 BufferIteratorPeekU8 (Buffer::Iterator &i)
80 {
81  uint8_t ret = i.ReadU8 ();
82  i.Prev ();
83  return ret;
84 }
85 
86 } // namespace CcnbParser
87 } // namespace wire
88 
89 NDN_NAMESPACE_END
90 
91 #endif // _CCNB_PARSER_BLOCK_H_
Visitor interface that takes no arguments and returns nothing.
Visitor interface that takes one boost::any argument and returns nothing.
Definition: void-visitor.h:39
Visitor interface that takes no arguments and returns boost::any.
Visitor interface that takes one boost::any argument and returns boost::any.
Definition: visitor.h:39
Base class for ccnb-encoded node.
Definition: block.h:48