/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2012-2014 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>
 */

#ifndef SYNC_NAME_INFO_H
#define SYNC_NAME_INFO_H

#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <map>
#include <string>
#include "sync-digest.h"

namespace Sync {

/**
 * @ingroup sync
 * @brief Templated class for the leaf name
 */
class NameInfo
{
private:
  typedef boost::weak_ptr<const NameInfo> const_weak_ptr;

public:
  virtual ~NameInfo () { };

  /**
   * @brief Get ID of the record (should be locally-unique, but not really necessary---this is be used for hashing purposes)
   */
  size_t
  getHashId () const { return m_id; }

  /**
   * @brief Check if two names are equal
   * @param info name to check with
   */
  virtual bool
  operator == (const NameInfo &info) const = 0;

  /**
   * @brief Check if two names are in order
   * @param info name to check with
   */
  virtual bool
  operator < (const NameInfo &info) const = 0;

  /**
   * @brief Calculates digest of the name
   */
  const Digest &
  getDigest () const { return m_digest; }

  /**
   * @brief Convert prefix to string
   * @returns string representation of prefix
   */
  virtual std::string
  toString () const = 0;

protected:
  // actual stuff
  size_t m_id; ///< @brief Identifies NameInfo throughout the library (for hash container, doesn't need to be strictly unique)
  Digest m_digest;

  // static stuff
  typedef std::map<std::string, const_weak_ptr> NameMap;
  static size_t  m_ids;
  static NameMap m_names;
};

typedef boost::shared_ptr<NameInfo> NameInfoPtr;
typedef boost::shared_ptr<const NameInfo> NameInfoConstPtr;

inline std::ostream &
operator << (std::ostream &os, const NameInfo &info)
{
  os << info.toString ();
  return os;
}

} // Sync

#endif // SYNC_NAME_INFO_H
