blob: 1f9d146f7d48079288663a01aafbffb7e46a99bf [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
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070058 // const LoadStatsNode &
59 // Get (const ns3::CcnxNameComponents &key) const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070060 const LoadStatsNode &
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070061 operator [] (const ns3::CcnxNameComponents &key) const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070062
63private:
64 const LoadStatsNode &
65 WalkLeftRightRoot (tree_type *node);
66
67private:
68 tree_type m_tree;
69
70 friend std::ostream &
71 operator << (std::ostream &os, const StatsTree &tree);
72};
73
74std::ostream &
75operator << (std::ostream &os, const StatsTree &tree);
76
77} // ndnSIM
78
79#endif // STATS_TREE_H