/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
 * Copyright (c) 2014-2017,  The University of Memphis,
 *                           Regents of the University of California,
 *                           Arizona Board of Regents.
 *
 * This file is part of NLSR (Named-data Link State Routing).
 * See AUTHORS.md for complete list of NLSR authors and contributors.
 *
 * NLSR 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.
 *
 * NLSR 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
 * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 **/

#ifndef NLSR_SEQUENCING_MANAGER_HPP
#define NLSR_SEQUENCING_MANAGER_HPP

#include <list>
#include <string>
#include <boost/cstdint.hpp>

#include <ndn-cxx/face.hpp>

#include "conf-parameter.hpp"

namespace nlsr {

class SequencingManager
{
public:
  SequencingManager()
    : m_nameLsaSeq(0)
    , m_adjLsaSeq(0)
    , m_corLsaSeq(0)
    , m_seqFileNameWithPath()
  {
  }

  uint64_t
  getNameLsaSeq() const
  {
    return m_nameLsaSeq;
  }

  void
  setNameLsaSeq(uint64_t nlsn)
  {
    m_nameLsaSeq = nlsn;
  }

  uint64_t
  getAdjLsaSeq() const
  {
    return m_adjLsaSeq;
  }

  void
  setAdjLsaSeq(uint64_t alsn)
  {
    m_adjLsaSeq = alsn;
  }

  uint64_t
  getCorLsaSeq() const
  {
    return m_corLsaSeq;
  }

  void
  setCorLsaSeq(uint64_t clsn)
  {
    m_corLsaSeq = clsn;
  }

  void
  increaseNameLsaSeq()
  {
    m_nameLsaSeq++;
  }

  void
  increaseAdjLsaSeq()
  {
    m_adjLsaSeq++;
  }

  void
  increaseCorLsaSeq()
  {
    m_corLsaSeq++;
  }

  void
  writeSeqNoToFile() const;

  void
  initiateSeqNoFromFile(int hypState);

  /*! \brief Set the sequence file directory

    If the string is empty, home directory is set as sequence file directory

  \param filePath The directory where sequence file will be stored
 */
  void
  setSeqFileDirectory(std::string filePath);

  void
  writeLog() const;

private:
  uint64_t m_nameLsaSeq;
  uint64_t m_adjLsaSeq;
  uint64_t m_corLsaSeq;
  std::string m_seqFileNameWithPath;
};

} // namespace nlsr
#endif // NLSR_SEQUENCING_MANAGER_HPP
