NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ndn-content-store.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #include "ndn-content-store.hpp"
21 
22 #include "ns3/log.h"
23 #include "ns3/packet.h"
24 
25 NS_LOG_COMPONENT_DEFINE("ndn.cs.ContentStore");
26 
27 namespace ns3 {
28 namespace ndn {
29 
31 
32 TypeId
34 {
35  static TypeId tid =
36  TypeId("ns3::ndn::ContentStore")
37  .SetGroupName("Ndn")
38  .SetParent<Object>()
39 
40  .AddTraceSource("CacheHits", "Trace called every time there is a cache hit",
41  MakeTraceSourceAccessor(&ContentStore::m_cacheHitsTrace))
42 
43  .AddTraceSource("CacheMisses", "Trace called every time there is a cache miss",
44  MakeTraceSourceAccessor(&ContentStore::m_cacheMissesTrace));
45 
46  return tid;
47 }
48 
50 {
51 }
52 
53 namespace cs {
54 
56 
57 Entry::Entry(Ptr<ContentStore> cs, shared_ptr<const Data> data)
58  : m_cs(cs)
59  , m_data(data)
60 {
61 }
62 
63 const Name&
65 {
66  return m_data->getName();
67 }
68 
69 shared_ptr<const Data>
71 {
72  return m_data;
73 }
74 
75 Ptr<ContentStore>
77 {
78  return m_cs;
79 }
80 
81 } // namespace cs
82 } // namespace ndn
83 } // namespace ns3
Entry(Ptr< ContentStore > cs, shared_ptr< const Data > data)
Construct content store entry.
NS_OBJECT_ENSURE_REGISTERED(ContentStore)
TracedCallback< shared_ptr< const Interest > > m_cacheMissesTrace
trace of cache misses
TracedCallback< shared_ptr< const Interest >, shared_ptr< const Data > > m_cacheHitsTrace
trace of cache hits
virtual ~ContentStore()
Virtual destructor.
shared_ptr< const Data > GetData() const
Get Data of the stored entry.
ndn cs ContentStore
Copyright (c) 2011-2015 Regents of the University of California.
Ptr< ContentStore > GetContentStore()
Get pointer to access store, to which this entry is added.
const Name & GetName() const
Get prefix of the stored entry.
static TypeId GetTypeId()
Interface ID.