Alexander Afanasyev | a4e7428 | 2013-07-11 15:23:20 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013, Regents of the University of California |
| 4 | * Alexander Afanasyev |
| 5 | * |
| 6 | * GNU v3.0 license, See the LICENSE file for more information |
| 7 | * |
| 8 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 9 | */ |
| 10 | |
| 11 | #ifndef NDN_NDNCXX_DETAIL_REGISTERED_PREFIX_CONTAINER_H |
| 12 | #define NDN_NDNCXX_DETAIL_REGISTERED_PREFIX_CONTAINER_H |
| 13 | |
| 14 | #include <ns3/ndnSIM/utils/trie/trie-with-policy.h> |
| 15 | #include <ns3/ndnSIM/utils/trie/counting-policy.h> |
| 16 | |
| 17 | namespace ns3 { |
| 18 | namespace ndn { |
| 19 | namespace detail { |
| 20 | |
| 21 | struct RegisteredPrefixEntry : public SimpleRefCount< RegisteredPrefixEntry > |
| 22 | { |
| 23 | public: |
| 24 | RegisteredPrefixEntry (Ptr<const Name> prefix) |
| 25 | : m_prefix (prefix) |
| 26 | { } |
| 27 | |
| 28 | void |
| 29 | AddCallback (ApiFace::InterestCallback callback) |
| 30 | { |
| 31 | m_callback = callback; |
| 32 | } |
| 33 | |
| 34 | void |
| 35 | ClearCallback () |
| 36 | { |
| 37 | m_callback = ApiFace::InterestCallback (); |
| 38 | } |
| 39 | |
| 40 | Ptr<const Name> |
| 41 | GetPrefix () const |
| 42 | { |
| 43 | return m_prefix; |
| 44 | } |
| 45 | |
| 46 | public: |
| 47 | ApiFace::InterestCallback m_callback; |
| 48 | Ptr<const Name> m_prefix; |
| 49 | }; |
| 50 | |
| 51 | |
| 52 | struct RegisteredPrefixContainer : |
| 53 | public ndnSIM::trie_with_policy<Name, |
| 54 | ndnSIM::smart_pointer_payload_traits< RegisteredPrefixEntry >, |
| 55 | ndnSIM::counting_policy_traits> |
| 56 | { |
| 57 | }; |
| 58 | |
| 59 | } // detail |
| 60 | } // ndn |
| 61 | } // ns3 |
| 62 | |
| 63 | #endif // NDN_NDNCXX_DETAIL_REGISTERED_PREFIX_CONTAINER_H |