blob: c6bf97a37255948b5af4dfd21cb4afd2187890f9 [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"
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070026#include "ns3/ndn-name-components.h"
Alexander Afanasyev0845c092012-07-13 17:45:33 -070027#include "ns3/ptr.h"
28
29namespace ndnSIM
30{
31
32class StatsTree
33{
34public:
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070035 typedef trie< ns3::NdnNameComponents,
Alexander Afanasyev0845c092012-07-13 17:45:33 -070036 non_pointer_traits< LoadStatsNode >, void* > tree_type;
37
38 StatsTree ();
39
40 void
41 Step ();
42
43 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070044 NewPitEntry (const ns3::NdnNameComponents &key);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070045
46 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070047 Incoming (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070048
49 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070050 Outgoing (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070051
52 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070053 Satisfy (const ns3::NdnNameComponents &key);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070054
55 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070056 Timeout (const ns3::NdnNameComponents &key);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070057
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070058 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070059 Rx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070060
61 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070062 Tx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070063
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070064 // const LoadStatsNode &
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070065 // Get (const ns3::NdnNameComponents &key) const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070066 const LoadStatsNode &
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070067 operator [] (const ns3::NdnNameComponents &key) const;
Alexander Afanasyev33364b62012-07-26 17:53:56 -070068
69 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070070 RemoveFace (ns3::Ptr<ns3::NdnFace> 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