/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2013 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: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
 *	   Zhenkai Zhu <zhenkai@cs.ucla.edu>
 */

#ifndef SYNC_STATE_HELPER_H
#define SYNC_STATE_HELPER_H

#include "sync-state.pb.hpp"

inline std::ostream &
operator << (std::ostream &os, const SyncStateMsgPtr &msg)
{
  os << " ===== start Msg ======" << std::endl;

  int size = msg->state_size();
  if (size > 0)
  {
    int index = 0;
    while (index < size)
    {
      SyncState state = msg->state(index);
      string strName = state.name();
      string strLocator = state.locator();
      sqlite3_int64 seq = state.seq();

      os << "Name: " << Ndnx::Name((const unsigned char *)strName.c_str(), strName.size())
         << ", Locator: " << Ndnx::Name((const unsigned char *)strLocator.c_str(), strLocator.size())
         << ", seq: " << seq << std::endl;
      index ++;
    }
  }
  else
  {
    os << "Msg size 0" << std::endl;
  }
  os << " ++++++++ end Msg  ++++++++ " << std::endl;

  return os;
}


#endif // SYNC_STATE_HELPER_H
