akmhoque | 66e6618 | 2014-02-21 17:56:03 -0600 | [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 | #include "sync-diff-state.h" |
| 27 | #include "sync-digest.h" |
| 28 | |
| 29 | #include <boost/multi_index_container.hpp> |
| 30 | #include <boost/multi_index/tag.hpp> |
| 31 | // #include <boost/multi_index/ordered_index.hpp> |
| 32 | // #include <boost/multi_index/composite_key.hpp> |
| 33 | #include <boost/multi_index/hashed_index.hpp> |
| 34 | #include <boost/multi_index/sequenced_index.hpp> |
| 35 | // #include <boost/multi_index/random_access_index.hpp> |
| 36 | #include <boost/multi_index/member.hpp> |
| 37 | #include <boost/multi_index/mem_fun.hpp> |
| 38 | |
| 39 | namespace mi = boost::multi_index; |
| 40 | |
| 41 | namespace Sync { |
| 42 | |
| 43 | /// @cond include_hidden |
| 44 | struct sequenced { }; |
| 45 | struct timed { }; |
| 46 | /// @endcond |
| 47 | |
| 48 | /** |
| 49 | * \ingroup sync |
| 50 | * @brief Container for differential states |
| 51 | */ |
| 52 | struct DiffStateContainer : public mi::multi_index_container< |
| 53 | DiffStatePtr, |
| 54 | mi::indexed_by< |
| 55 | // For fast access to elements using DiffState hashes |
| 56 | mi::hashed_unique< |
| 57 | mi::tag<hashed>, |
| 58 | mi::const_mem_fun<DiffState, DigestConstPtr, &DiffState::getDigest>, |
| 59 | DigestPtrHash, |
| 60 | DigestPtrEqual |
| 61 | > |
| 62 | , |
| 63 | // sequenced index to access older/newer element (like in list) |
| 64 | mi::sequenced<mi::tag<sequenced> > |
| 65 | > |
| 66 | > |
| 67 | { |
| 68 | }; |
| 69 | |
| 70 | } // Sync |
| 71 | |
| 72 | #endif // SYNC_DIFF_STATE_CONTAINER_H |