blob: 1bb128b2d75e1540066972933e20b279a8de8090 [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 Afanasyev1c0248b2012-07-24 15:59:50 -070058 void
59 Rx (const ns3::CcnxNameComponents &key, ns3::Ptr<ns3::CcnxFace> face, uint32_t amount);
60
61 void
62 Tx (const ns3::CcnxNameComponents &key, ns3::Ptr<ns3::CcnxFace> face, uint32_t amount);
63
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070064 // const LoadStatsNode &
65 // Get (const ns3::CcnxNameComponents &key) const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070066 const LoadStatsNode &
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070067 operator [] (const ns3::CcnxNameComponents &key) const;
Alexander Afanasyev33364b62012-07-26 17:53:56 -070068
69 void
70 RemoveFace (ns3::Ptr<ns3::CcnxFace> face);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070071
72private:
73 const LoadStatsNode &
74 WalkLeftRightRoot (tree_type *node);
Alexander Afanasyev33364b62012-07-26 17:53:56 -070075
Alexander Afanasyev0845c092012-07-13 17:45:33 -070076
77private:
78 tree_type m_tree;
79
80 friend std::ostream &
81 operator << (std::ostream &os, const StatsTree &tree);
82};
83
84std::ostream &
85operator << (std::ostream &os, const StatsTree &tree);
86
87} // ndnSIM
88
89#endif // STATS_TREE_H