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
ndn-fw-hop-count-tag.cc
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2013 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 "ndn-fw-hop-count-tag.h"
22 
23 namespace ns3 {
24 namespace ndn {
25 
26 TypeId
27 FwHopCountTag::GetTypeId ()
28 {
29  static TypeId tid = TypeId("ns3::ndn::FwHopCountTag")
30  .SetParent<Tag>()
31  .AddConstructor<FwHopCountTag>()
32  ;
33  return tid;
34 }
35 
36 TypeId
37 FwHopCountTag::GetInstanceTypeId () const
38 {
39  return FwHopCountTag::GetTypeId ();
40 }
41 
42 uint32_t
43 FwHopCountTag::GetSerializedSize () const
44 {
45  return sizeof(uint32_t);
46 }
47 
48 void
49 FwHopCountTag::Serialize (TagBuffer i) const
50 {
51  i.WriteU32 (m_hopCount);
52 }
53 
54 void
55 FwHopCountTag::Deserialize (TagBuffer i)
56 {
57  m_hopCount = i.ReadU32 ();
58 }
59 
60 void
61 FwHopCountTag::Print (std::ostream &os) const
62 {
63  os << m_hopCount;
64 }
65 
66 } // namespace ndn
67 } // namespace ns3