/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2012-2017 University of California, Los Angeles
 *
 * This file is part of ChronoSync, synchronization library for distributed realtime
 * applications for NDN.
 *
 * ChronoSync is free software: you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * ChronoSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * ChronoSync, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @author Zhenkai Zhu <http://irl.cs.ucla.edu/~zhenkai/>
 * @author Chaoyi Bian <bcy@pku.edu.cn>
 * @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
 * @author Yingdi Yu <yingdi@cs.ucla.edu>
 */

#ifndef CHRONOSYNC_LEAF_CONTAINER_HPP
#define CHRONOSYNC_LEAF_CONTAINER_HPP

#include "mi-tag.hpp"
#include "leaf.hpp"

#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/mem_fun.hpp>

#include <ndn-cxx/util/sha256.hpp>

namespace chronosync {

namespace mi = boost::multi_index;

struct SessionNameHash
{
  std::size_t
  operator()(const Name& prefix) const
  {
    ndn::ConstBufferPtr buffer =
      ndn::util::Sha256::computeDigest(prefix.wireEncode().wire(), prefix.wireEncode().size());

    BOOST_ASSERT(buffer->size() > sizeof(std::size_t));

    return *reinterpret_cast<const std::size_t*>(buffer->buf());
  }
};

struct SessionNameEqual
{
  bool
  operator()(const Name& prefix1, const Name& prefix2) const
  {
    return prefix1 == prefix2;
  }
};

struct SessionNameCompare : public std::less<Name>
{
  bool
  operator()(const Name& prefix1, const Name& prefix2) const
  {
    return prefix1 < prefix2;
  }
};

/**
 * @brief Container for chronosync leaves
 */
struct LeafContainer : public mi::multi_index_container<
  LeafPtr,
  mi::indexed_by<
    // For fast access to elements using SessionName
    mi::hashed_unique<
      mi::tag<hashed>,
      mi::const_mem_fun<Leaf, const Name&, &Leaf::getSessionName>,
      SessionNameHash,
      SessionNameEqual
      >,

    mi::ordered_unique<
      mi::tag<ordered>,
      mi::const_mem_fun<Leaf, const Name&, &Leaf::getSessionName>,
      SessionNameCompare
      >
    >
  >
{
};

} // namespace chronosync

#endif // CHRONOSYNC_LEAF_CONTAINER_HPP
