blob: 56cb95c9d6bcce8a0f1b59f34f507e857ed2c62d [file] [log] [blame]
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -08001/* -*- 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 Afanasyev182fdc22012-03-05 18:06:52 -080026#include "sync-diff-state.h"
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -080027
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
38namespace mi = boost::multi_index;
39
Alexander Afanasyevc1030192012-03-08 22:21:28 -080040namespace Sync {
41
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -080042// 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 Afanasyevc1030192012-03-08 22:21:28 -080051/// @cond include_hidden
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -080052struct sequenced { };
Alexander Afanasyevc1030192012-03-08 22:21:28 -080053/// @endcond
54
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -080055/**
56 * \ingroup sync
57 * @brief Container for differential states
58 */
Alexander Afanasyevc1030192012-03-08 22:21:28 -080059struct DiffStateContainer : public mi::multi_index_container<
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -080060 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 Afanasyevc1030192012-03-08 22:21:28 -080071 mi::sequenced<mi::tag<sequenced> >
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -080072 >
73 >
74{
75};
76
77
78} // Sync
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -080079
80#endif // SYNC_DIFF_STATE_CONTAINER_H