blob: e731d3279ef0811f39de82d636c33bcb82177db2 [file] [log] [blame]
Alexander Afanasyev0845c092012-07-13 17:45:33 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011 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: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
21#ifndef STATS_TREE_H
22#define STATS_TREE_H
23
24#include "trie.h"
25#include "load-stats-node.h"
26#include "ns3/ccnx-name-components.h"
27#include "ns3/ptr.h"
28
29namespace ndnSIM
30{
31
32class StatsTree
33{
34public:
35 typedef trie< ns3::CcnxNameComponents,
36 non_pointer_traits< LoadStatsNode >, void* > tree_type;
37
38 StatsTree ();
39
40 void
41 Step ();
42
43 void
44 NewPitEntry (const ns3::CcnxNameComponents &key);
45
46 void
47 Incoming (const ns3::CcnxNameComponents &key, ns3::Ptr<ns3::CcnxFace> face);
48
49 void
50 Outgoing (const ns3::CcnxNameComponents &key, ns3::Ptr<ns3::CcnxFace> face);
51
52 void
53 Satisfy (const ns3::CcnxNameComponents &key);
54
55 void
56 Timeout (const ns3::CcnxNameComponents &key);
57
58 const LoadStatsNode &
59 Get (const ns3::CcnxNameComponents &key) const;
60
61private:
62 const LoadStatsNode &
63 WalkLeftRightRoot (tree_type *node);
64
65private:
66 tree_type m_tree;
67
68 friend std::ostream &
69 operator << (std::ostream &os, const StatsTree &tree);
70};
71
72std::ostream &
73operator << (std::ostream &os, const StatsTree &tree);
74
75} // ndnSIM
76
77#endif // STATS_TREE_H