blob: b1f5ef446037aef9d6b4cac247aa56dd54b6d0ff [file] [log] [blame]
akmhoque66e66182014-02-21 17:56:03 -06001/* -*- 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>
19 * Chaoyi Bian <bcy@pku.edu.cn>
Vince Lehman0a7da612014-10-29 14:39:29 -050020 * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
akmhoque66e66182014-02-21 17:56:03 -060021 */
22
dmcoomese689dd62017-03-29 11:05:12 -050023#ifndef NLSR_NSYNC_SYNC_FULL_LEAF_H
24#define NLSR_NSYNC_SYNC_FULL_LEAF_H
akmhoque66e66182014-02-21 17:56:03 -060025
26#include "sync-leaf.h"
27
28namespace Sync {
29
30/**
31 * @ingroup sync
Vince Lehman0a7da612014-10-29 14:39:29 -050032 * @brief SYNC leaf for the full state (with support of Digest calculation)
akmhoque66e66182014-02-21 17:56:03 -060033 */
34class FullLeaf : public Leaf
35{
36public:
37 /**
38 * @brief Constructor to create an UPDATE diff leaf
39 * @param info Smart pointer to leaf's name
40 * @param seq Initial sequence number of the pointer
41 */
42 FullLeaf (NameInfoConstPtr info, const SeqNo &seq);
43 virtual ~FullLeaf () { }
44
45 /**
46 * @brief Get hash digest of the leaf
47 *
48 * The underlying Digest object is recalculated on every update or removal
49 * (including updates of child classes)
50 */
51 const Digest &
Vince Lehman0a7da612014-10-29 14:39:29 -050052 getDigest () const { return m_digest; }
akmhoque66e66182014-02-21 17:56:03 -060053
54 // from Leaf
55 virtual void
56 setSeq (const SeqNo &seq);
Vince Lehman0a7da612014-10-29 14:39:29 -050057
akmhoque66e66182014-02-21 17:56:03 -060058private:
59 void
60 updateDigest ();
61
62private:
63 Digest m_digest;
64};
65
Vince Lehman0a7da612014-10-29 14:39:29 -050066typedef shared_ptr<FullLeaf> FullLeafPtr;
67typedef shared_ptr<const FullLeaf> FullLeafConstPtr;
akmhoque66e66182014-02-21 17:56:03 -060068
69} // Sync
70
dmcoomese689dd62017-03-29 11:05:12 -050071#endif // NLSR_NSYNC_SYNC_FULL_LEAF_H