/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2012 University of California, Los Angeles
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
 *         Chaoyi Bian <bcy@pku.edu.cn>
 *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
 */

#ifndef NLSR_NSYNC_SYNC_STATE_LEAF_CONTAINER_H
#define NLSR_NSYNC_SYNC_STATE_LEAF_CONTAINER_H

#include "sync-leaf.h"
#include "sync-name-info.h"

#include <boost/multi_index_container.hpp>
// #include <boost/multi_index/tag.hpp>
#include <boost/multi_index/ordered_index.hpp>
// #include <boost/multi_index/composite_key.hpp>
#include <boost/multi_index/hashed_index.hpp>
// #include <boost/multi_index/random_access_index.hpp>
// #include <boost/multi_index/member.hpp>
#include <boost/multi_index/mem_fun.hpp>

namespace mi = boost::multi_index;

namespace Sync {

struct NameInfoHash : public std::unary_function<NameInfo, std::size_t>
{
  std::size_t
  operator() (NameInfoConstPtr prefix) const
  {
    return prefix->getHashId ();
  }
};

struct NameInfoEqual : public std::unary_function<NameInfo, std::size_t>
{
  bool
  operator() (NameInfoConstPtr prefix1, NameInfoConstPtr prefix2) const
  {
    return *prefix1 == *prefix2;
  }
};

struct NameInfoCompare : public std::unary_function<NameInfo, std::size_t>
{
  bool
  operator() (NameInfoConstPtr prefix1, NameInfoConstPtr prefix2) const
  {
    return *prefix1 < *prefix2;
  }
};

/// @cond include_hidden
struct hashed { };
struct ordered { };
/// @endcond

/**
 * \ingroup sync
 * @brief Container for SYNC leaves
 */
struct LeafContainer : public mi::multi_index_container<
  LeafPtr,
  mi::indexed_by<
    // For fast access to elements using NameInfo
    mi::hashed_unique<
      mi::tag<hashed>,
      mi::const_mem_fun<Leaf, NameInfoConstPtr, &Leaf::getInfo>,
      NameInfoHash,
      NameInfoEqual
      >,

    mi::ordered_unique<
      mi::tag<ordered>,
      mi::const_mem_fun<Leaf, NameInfoConstPtr, &Leaf::getInfo>,
      NameInfoCompare
      >
    >
  >
{
};

} // Sync

#endif // NLSR_NSYNC_SYNC_STATE_LEAF_CONTAINER_H
