Alexander Afanasyev | e00ffbe | 2012-03-05 00:01:36 -0800 | [diff] [blame] | 1 | /* -*- 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 Bian | 3e1eb16 | 2012-04-03 16:59:32 -0700 | [diff] [blame] | 19 | * Chaoyi Bian <bcy@pku.edu.cn> |
Alexander Afanasyev | e00ffbe | 2012-03-05 00:01:36 -0800 | [diff] [blame] | 20 | * Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 21 | */ |
| 22 | |
| 23 | #include "sync-full-leaf.h" |
| 24 | #include <boost/ref.hpp> |
| 25 | |
| 26 | using namespace boost; |
| 27 | |
| 28 | namespace Sync { |
| 29 | |
| 30 | FullLeaf::FullLeaf (NameInfoConstPtr info, const SeqNo &seq) |
| 31 | : Leaf (info, seq) |
| 32 | { |
| 33 | updateDigest (); |
| 34 | } |
| 35 | |
| 36 | void |
| 37 | FullLeaf::updateDigest () |
| 38 | { |
| 39 | m_digest.reset (); |
Alexander Afanasyev | e4e2bf7 | 2012-03-12 12:44:54 -0700 | [diff] [blame] | 40 | m_digest << getInfo ()->getDigest () << *getSeq ().getDigest (); |
Alexander Afanasyev | 1fbdcdd | 2012-03-05 23:14:33 -0800 | [diff] [blame] | 41 | m_digest.finalize (); |
Alexander Afanasyev | e00ffbe | 2012-03-05 00:01:36 -0800 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | // from Leaf |
| 45 | void |
| 46 | FullLeaf::setSeq (const SeqNo &seq) |
| 47 | { |
| 48 | Leaf::setSeq (seq); |
| 49 | updateDigest (); |
| 50 | } |
| 51 | |
| 52 | } // Sync |