Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 1 | /* -*- 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 | |
| 29 | namespace ndnSIM |
| 30 | { |
| 31 | |
| 32 | class StatsTree |
| 33 | { |
| 34 | public: |
| 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 Afanasyev | 0560eec | 2012-07-16 15:44:31 -0700 | [diff] [blame] | 58 | // const LoadStatsNode & |
| 59 | // Get (const ns3::CcnxNameComponents &key) const; |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 60 | const LoadStatsNode & |
Alexander Afanasyev | 0560eec | 2012-07-16 15:44:31 -0700 | [diff] [blame] | 61 | operator [] (const ns3::CcnxNameComponents &key) const; |
Alexander Afanasyev | 0845c09 | 2012-07-13 17:45:33 -0700 | [diff] [blame] | 62 | |
| 63 | private: |
| 64 | const LoadStatsNode & |
| 65 | WalkLeftRightRoot (tree_type *node); |
| 66 | |
| 67 | private: |
| 68 | tree_type m_tree; |
| 69 | |
| 70 | friend std::ostream & |
| 71 | operator << (std::ostream &os, const StatsTree &tree); |
| 72 | }; |
| 73 | |
| 74 | std::ostream & |
| 75 | operator << (std::ostream &os, const StatsTree &tree); |
| 76 | |
| 77 | } // ndnSIM |
| 78 | |
| 79 | #endif // STATS_TREE_H |