Jeff Thompson | fa30664 | 2013-06-17 15:06:57 -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 | * BSD license, See the LICENSE file for more information |
| 7 | * |
| 8 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 9 | */ |
| 10 | |
| 11 | #ifndef NDN_TRIE_PAYLOAD_TRAITS_POINTER_H |
| 12 | #define NDN_TRIE_PAYLOAD_TRAITS_POINTER_H |
| 13 | |
| 14 | namespace ndn { |
| 15 | namespace trie { |
| 16 | |
| 17 | template<typename Payload, typename BasePayload = Payload> |
| 18 | struct pointer_payload_traits |
| 19 | { |
| 20 | typedef Payload payload_type; // general type of the payload |
| 21 | typedef Payload* storage_type; // how the payload is actually stored |
| 22 | typedef Payload* insert_type; // what parameter is inserted |
| 23 | |
| 24 | typedef Payload* return_type; // what is returned on access |
| 25 | typedef const Payload* const_return_type; // what is returned on const access |
| 26 | |
| 27 | typedef BasePayload* base_type; // base type of the entry (when implementation details need to be hidden) |
| 28 | typedef const BasePayload* const_base_type; // const base type of the entry (when implementation details need to be hidden) |
| 29 | |
| 30 | static Payload* empty_payload; |
| 31 | }; |
| 32 | |
| 33 | template<typename Payload, typename BasePayload> |
| 34 | Payload* |
| 35 | pointer_payload_traits<Payload, BasePayload>::empty_payload = NULL; |
| 36 | |
| 37 | } // trie |
| 38 | } // ndn |
| 39 | |
| 40 | #endif // NDN_TRIE_PAYLOAD_TRAITS_POINTER_H |