blob: 5e7f8e13eac8f26fd87ad0d1f53c188a933e504f [file] [log] [blame]
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
Alexander Afanasyev8722d872014-07-02 13:00:29 -07003 * Copyright (c) 2012-2014 University of California, Los Angeles
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -08004 *
Alexander Afanasyev8722d872014-07-02 13:00:29 -07005 * This file is part of ChronoSync, synchronization library for distributed realtime
6 * applications for NDN.
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -08007 *
Alexander Afanasyev8722d872014-07-02 13:00:29 -07008 * ChronoSync is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation, either
10 * version 3 of the License, or (at your option) any later version.
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -080011 *
Alexander Afanasyev8722d872014-07-02 13:00:29 -070012 * ChronoSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -080015 *
Alexander Afanasyev8722d872014-07-02 13:00:29 -070016 * You should have received a copy of the GNU General Public License along with
17 * ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @author Zhenkai Zhu <http://irl.cs.ucla.edu/~zhenkai/>
20 * @author Chaoyi Bian <bcy@pku.edu.cn>
21 * @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -080022 */
23
24#ifndef SYNC_FULL_LEAF_H
25#define SYNC_FULL_LEAF_H
26
27#include "sync-leaf.h"
28
29namespace Sync {
30
31/**
32 * @ingroup sync
Yingdi Yu7c64e5c2014-04-30 14:06:37 -070033 * @brief SYNC leaf for the full state (with support of Digest calculation)
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -080034 */
35class FullLeaf : public Leaf
36{
37public:
38 /**
39 * @brief Constructor to create an UPDATE diff leaf
40 * @param info Smart pointer to leaf's name
41 * @param seq Initial sequence number of the pointer
42 */
43 FullLeaf (NameInfoConstPtr info, const SeqNo &seq);
44 virtual ~FullLeaf () { }
45
46 /**
47 * @brief Get hash digest of the leaf
48 *
49 * The underlying Digest object is recalculated on every update or removal
50 * (including updates of child classes)
51 */
52 const Digest &
Yingdi Yu7c64e5c2014-04-30 14:06:37 -070053 getDigest () const { return m_digest; }
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -080054
55 // from Leaf
56 virtual void
57 setSeq (const SeqNo &seq);
Yingdi Yu7c64e5c2014-04-30 14:06:37 -070058
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -080059private:
60 void
61 updateDigest ();
62
63private:
64 Digest m_digest;
65};
66
67typedef boost::shared_ptr<FullLeaf> FullLeafPtr;
Alexander Afanasyevd94542d2012-03-05 08:41:46 -080068typedef boost::shared_ptr<const FullLeaf> FullLeafConstPtr;
Alexander Afanasyeve00ffbe2012-03-05 00:01:36 -080069
70} // Sync
71
72#endif // SYNC_FULL_LEAF_H