1 /****************************************************************************** 2 * Project: libspatialindex - A C++ library for spatial indexing 3 * Author: Marios Hadjieleftheriou, mhadji@gmail.com 4 ****************************************************************************** 5 * Copyright (c) 2002, Marios Hadjieleftheriou 6 * 7 * All rights reserved. 8 * 9 * Permission is hereby granted, free of charge, to any person obtaining a 10 * copy of this software and associated documentation files (the "Software"), 11 * to deal in the Software without restriction, including without limitation 12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 13 * and/or sell copies of the Software, and to permit persons to whom the 14 * Software is furnished to do so, subject to the following conditions: 15 * 16 * The above copyright notice and this permission notice shall be included 17 * in all copies or substantial portions of the Software. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 * DEALINGS IN THE SOFTWARE. 26 ******************************************************************************/ 27 28 #pragma once 29 30 namespace SpatialIndex 31 { 32 namespace RTree 33 { 34 class RTree; 35 class Node; 36 class Leaf; 37 class Index; 38 39 class Statistics : public SpatialIndex::IStatistics 40 { 41 public: 42 Statistics(); 43 Statistics(const Statistics&); 44 virtual ~Statistics(); 45 Statistics& operator=(const Statistics&); 46 47 // 48 // IStatistics interface 49 // 50 virtual uint64_t getReads() const; 51 virtual uint64_t getWrites() const; 52 virtual uint32_t getNumberOfNodes() const; 53 virtual uint64_t getNumberOfData() const; 54 55 virtual uint64_t getSplits() const; 56 virtual uint64_t getHits() const; 57 virtual uint64_t getMisses() const; 58 virtual uint64_t getAdjustments() const; 59 virtual uint64_t getQueryResults() const; 60 virtual uint32_t getTreeHeight() const; 61 virtual uint32_t getNumberOfNodesInLevel(uint32_t l) const; 62 63 private: 64 void reset(); 65 66 uint64_t m_u64Reads; 67 68 uint64_t m_u64Writes; 69 70 uint64_t m_u64Splits; 71 72 uint64_t m_u64Hits; 73 74 uint64_t m_u64Misses; 75 76 uint32_t m_u32Nodes; 77 78 uint64_t m_u64Adjustments; 79 80 uint64_t m_u64QueryResults; 81 82 uint64_t m_u64Data; 83 84 uint32_t m_u32TreeHeight; 85 86 std::vector<uint32_t> m_nodesInLevel; 87 88 friend class RTree; 89 friend class Node; 90 friend class Index; 91 friend class Leaf; 92 friend class BulkLoader; 93 94 friend std::ostream& operator<<(std::ostream& os, const Statistics& s); 95 }; // Statistics 96 97 std::ostream& operator<<(std::ostream& os, const Statistics& s); 98 } 99 } 100