blob: 84f96e3eb14c681d82ede138e3e40ecc888e4fa2 [file] [log] [blame]
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2012 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
Chaoyi Bian3e1eb162012-04-03 16:59:32 -070019 * Chaoyi Bian <bcy@pku.edu.cn>
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -080020 * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
21 */
22
23#include "sync-full-leaf.h"
24#include <boost/ref.hpp>
25
26using namespace boost;
27
28namespace Sync {
29
30FullLeaf::FullLeaf (NameInfoConstPtr info, const SeqNo &seq)
31 : Leaf (info, seq)
32{
33 updateDigest ();
34}
35
36void
37FullLeaf::updateDigest ()
38{
39 m_digest.reset ();
Alexander Afanasyeve4e2bf72012-03-12 12:44:54 -070040 m_digest << getInfo ()->getDigest () << *getSeq ().getDigest ();
Alexander Afanasyev1fbdcdd2012-03-05 23:14:33 -080041 m_digest.finalize ();
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -080042}
43
44// from Leaf
45void
46FullLeaf::setSeq (const SeqNo &seq)
47{
48 Leaf::setSeq (seq);
49 updateDigest ();
50}
51
52} // Sync