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 | |
Alexander Afanasyev | 182fdc2 | 2012-03-05 18:06:52 -0800 | [diff] [blame] | 26 | #include "sync-diff-state.h" |
Alexander Afanasyev | 8f25cbb | 2012-03-01 23:53:40 -0800 | [diff] [blame] | 27 | |
| 28 | #include <boost/multi_index_container.hpp> |
| 29 | // #include <boost/multi_index/tag.hpp> |
| 30 | // #include <boost/multi_index/ordered_index.hpp> |
| 31 | // #include <boost/multi_index/composite_key.hpp> |
| 32 | #include <boost/multi_index/hashed_index.hpp> |
| 33 | #include <boost/multi_index/sequenced_index.hpp> |
| 34 | // #include <boost/multi_index/random_access_index.hpp> |
| 35 | // #include <boost/multi_index/member.hpp> |
| 36 | #include <boost/multi_index/mem_fun.hpp> |
| 37 | |
| 38 | namespace mi = boost::multi_index; |
| 39 | |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame^] | 40 | namespace Sync { |
| 41 | |
Alexander Afanasyev | 8f25cbb | 2012-03-01 23:53:40 -0800 | [diff] [blame] | 42 | // struct DigestHash : public std::unary_function<Digest, std::size_t> |
| 43 | // { |
| 44 | // std::size_t |
| 45 | // operator() (const Digest &digest) const |
| 46 | // { |
| 47 | // return digest % std::limits<std::size_t>::max (); |
| 48 | // } |
| 49 | // }; |
| 50 | |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame^] | 51 | /// @cond include_hidden |
Alexander Afanasyev | 8f25cbb | 2012-03-01 23:53:40 -0800 | [diff] [blame] | 52 | struct sequenced { }; |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame^] | 53 | /// @endcond |
| 54 | |
Alexander Afanasyev | 8f25cbb | 2012-03-01 23:53:40 -0800 | [diff] [blame] | 55 | /** |
| 56 | * \ingroup sync |
| 57 | * @brief Container for differential states |
| 58 | */ |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame^] | 59 | struct DiffStateContainer : public mi::multi_index_container< |
Alexander Afanasyev | 8f25cbb | 2012-03-01 23:53:40 -0800 | [diff] [blame] | 60 | DiffStatePtr, |
| 61 | // mi::indexed_by< |
| 62 | // // For fast access to elements using DiffState hashes |
| 63 | // mi::hashed_unique< |
| 64 | // mi::tag<hashed>, |
| 65 | // mi::const_mem_fun<Leaf, const Digest&, &DiffState::getDigest>, |
| 66 | // DigestHash |
| 67 | // >, |
| 68 | |
| 69 | // sequenced index to access older/newer element (like in list) |
| 70 | mi::indexed_by< |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame^] | 71 | mi::sequenced<mi::tag<sequenced> > |
Alexander Afanasyev | 8f25cbb | 2012-03-01 23:53:40 -0800 | [diff] [blame] | 72 | > |
| 73 | > |
| 74 | { |
| 75 | }; |
| 76 | |
| 77 | |
| 78 | } // Sync |
Alexander Afanasyev | 8f25cbb | 2012-03-01 23:53:40 -0800 | [diff] [blame] | 79 | |
| 80 | #endif // SYNC_DIFF_STATE_CONTAINER_H |