blob: c92d4bb9b24f6152aeb39aacd6f3ad19bec68a08 [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
Alexander Afanasyeve77db792012-08-09 11:10:58 -070029namespace ns3
30{
Alexander Afanasyev0845c092012-07-13 17:45:33 -070031namespace ndnSIM
32{
33
34class StatsTree
35{
36public:
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070037 typedef trie< ns3::NdnNameComponents,
Alexander Afanasyev0845c092012-07-13 17:45:33 -070038 non_pointer_traits< LoadStatsNode >, void* > tree_type;
39
40 StatsTree ();
41
42 void
43 Step ();
44
45 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070046 NewPitEntry (const ns3::NdnNameComponents &key);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070047
48 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070049 Incoming (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070050
51 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070052 Outgoing (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070053
54 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070055 Satisfy (const ns3::NdnNameComponents &key);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070056
57 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070058 Timeout (const ns3::NdnNameComponents &key);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070059
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070060 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070061 Rx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070062
63 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070064 Tx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070065
Alexander Afanasyev0560eec2012-07-16 15:44:31 -070066 // const LoadStatsNode &
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070067 // Get (const ns3::NdnNameComponents &key) const;
Alexander Afanasyev0845c092012-07-13 17:45:33 -070068 const LoadStatsNode &
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070069 operator [] (const ns3::NdnNameComponents &key) const;
Alexander Afanasyev33364b62012-07-26 17:53:56 -070070
71 void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070072 RemoveFace (ns3::Ptr<ns3::NdnFace> face);
Alexander Afanasyev0845c092012-07-13 17:45:33 -070073
74private:
75 const LoadStatsNode &
76 WalkLeftRightRoot (tree_type *node);
Alexander Afanasyev33364b62012-07-26 17:53:56 -070077
Alexander Afanasyev0845c092012-07-13 17:45:33 -070078
79private:
80 tree_type m_tree;
81
82 friend std::ostream &
83 operator << (std::ostream &os, const StatsTree &tree);
84};
85
86std::ostream &
87operator << (std::ostream &os, const StatsTree &tree);
88
89} // ndnSIM
Alexander Afanasyeve77db792012-08-09 11:10:58 -070090} // ns3
Alexander Afanasyev0845c092012-07-13 17:45:33 -070091
92#endif // STATS_TREE_H