Alexander Afanasyev | 8f25cbb | 2012-03-01 23:53:40 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2012 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: Zhenkai Zhu <zhenkai@cs.ucla.edu> |
| 19 | * 卞超轶 Chaoyi Bian <bcy@pku.edu.cn> |
| 20 | * Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 21 | */ |
| 22 | |
| 23 | #ifndef SYNC_DIFF_STATE_CONTAINER_H |
| 24 | #define SYNC_DIFF_STATE_CONTAINER_H |
| 25 | |
| 26 | namespace ns3 { |
| 27 | namespace Sync { |
| 28 | |
| 29 | #include "diff-state.h" |
| 30 | |
| 31 | #include <boost/multi_index_container.hpp> |
| 32 | // #include <boost/multi_index/tag.hpp> |
| 33 | // #include <boost/multi_index/ordered_index.hpp> |
| 34 | // #include <boost/multi_index/composite_key.hpp> |
| 35 | #include <boost/multi_index/hashed_index.hpp> |
| 36 | #include <boost/multi_index/sequenced_index.hpp> |
| 37 | // #include <boost/multi_index/random_access_index.hpp> |
| 38 | // #include <boost/multi_index/member.hpp> |
| 39 | #include <boost/multi_index/mem_fun.hpp> |
| 40 | |
| 41 | namespace mi = boost::multi_index; |
| 42 | |
| 43 | // struct DigestHash : public std::unary_function<Digest, std::size_t> |
| 44 | // { |
| 45 | // std::size_t |
| 46 | // operator() (const Digest &digest) const |
| 47 | // { |
| 48 | // return digest % std::limits<std::size_t>::max (); |
| 49 | // } |
| 50 | // }; |
| 51 | |
| 52 | struct sequenced { }; |
| 53 | |
| 54 | /** |
| 55 | * \ingroup sync |
| 56 | * @brief Container for differential states |
| 57 | */ |
| 58 | struct LeafContainer : public mi::multi_index_container< |
| 59 | DiffStatePtr, |
| 60 | // mi::indexed_by< |
| 61 | // // For fast access to elements using DiffState hashes |
| 62 | // mi::hashed_unique< |
| 63 | // mi::tag<hashed>, |
| 64 | // mi::const_mem_fun<Leaf, const Digest&, &DiffState::getDigest>, |
| 65 | // DigestHash |
| 66 | // >, |
| 67 | |
| 68 | // sequenced index to access older/newer element (like in list) |
| 69 | mi::indexed_by< |
| 70 | mi::sequenced<mi::tag<seqenced> > |
| 71 | > |
| 72 | > |
| 73 | { |
| 74 | }; |
| 75 | |
| 76 | |
| 77 | } // Sync |
| 78 | } // ns3 |
| 79 | |
| 80 | #endif // SYNC_DIFF_STATE_CONTAINER_H |