blob: 7f510bb8bb31c1cc6f54abcf2747437f942fae5c [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 Afanasyev8f25cbb2012-03-01 23:53:40 -080026namespace Sync {
27
28#include "diff-state.h"
29
30#include <boost/multi_index_container.hpp>
31// #include <boost/multi_index/tag.hpp>
32// #include <boost/multi_index/ordered_index.hpp>
33// #include <boost/multi_index/composite_key.hpp>
34#include <boost/multi_index/hashed_index.hpp>
35#include <boost/multi_index/sequenced_index.hpp>
36// #include <boost/multi_index/random_access_index.hpp>
37// #include <boost/multi_index/member.hpp>
38#include <boost/multi_index/mem_fun.hpp>
39
40namespace mi = boost::multi_index;
41
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
51struct sequenced { };
52
53/**
54 * \ingroup sync
55 * @brief Container for differential states
56 */
57struct LeafContainer : public mi::multi_index_container<
58 DiffStatePtr,
59 // mi::indexed_by<
60 // // For fast access to elements using DiffState hashes
61 // mi::hashed_unique<
62 // mi::tag<hashed>,
63 // mi::const_mem_fun<Leaf, const Digest&, &DiffState::getDigest>,
64 // DigestHash
65 // >,
66
67 // sequenced index to access older/newer element (like in list)
68 mi::indexed_by<
69 mi::sequenced<mi::tag<seqenced> >
70 >
71 >
72{
73};
74
75
76} // Sync
Alexander Afanasyev8f25cbb2012-03-01 23:53:40 -080077
78#endif // SYNC_DIFF_STATE_CONTAINER_H