blob: 49f61ae0d336a04db3454ddf901c78734329fd96 [file] [log] [blame]
/* -*- 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 SYNC_DIFF_STATE_H
#define SYNC_DIFF_STATE_H
#include "sync-state.h"
namespace ns3 {
namespace Sync {
class DiffState;
typedef boost::shared_ptr<DiffState> DiffStatePtr;
typedef boost::shared_ptr<DiffState> DiffStateConstPtr;
/**
* @ingroup ccnx
* @brief Differential SYNC state
*/
class DiffState : public State
{
public:
/**
* @see Default constructor
*/
DiffState ();
virtual ~DiffState ();
/**
* @brief Set successor for the diff state
* @param next successor state
*/
void
setNext (DiffStatePtr next)
{
m_next = next;
}
// void
// setDigest (Hash digest);
// Hash
// getDigest () const;
/**
* @brief Accumulate differences from `this' state to the most current state
* @returns Accumulated differences from `this' state to the most current state
*/
DiffStatePtr
diff () const;
/**
* @brief Combine differences from `this' and `state'
* @param state Differential state to combine with
* @return Combined differences
*
* In case of collisions, `this' leaf will be replaced with the leaf of `state'
*/
DiffState&
operator += (const DiffState &state);
// from State
virtual void
update (NameInfoConstPtr info, const SeqNo &seq);
virtual void
remove (NameInfoConstPtr info);
private:
DiffStatePtr m_next;
// Hash m_digest;
};
} // Sync
} // ns3
#endif // SYNC_DIFF_STATE_H