diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-10-30 20:31:48 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-10-30 20:32:34 -0400 |
commit | ad39f5eca2603377baa3b7452218c99daad93ec2 (patch) | |
tree | 0be0a21af8547b58dbbfdd5fd9d73d9fecb9a63c /sc | |
parent | beebcb6b671702952c4bc0fb9794345142a6452c (diff) |
dump() method for ScDPCacheTable (for debugging only).
Change-Id: I3d4a4dd5efa64d1506562f976d88599c084b25ab
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/dpcachetable.hxx | 9 | ||||
-rw-r--r-- | sc/source/core/data/dpcachetable.cxx | 37 |
2 files changed, 45 insertions, 1 deletions
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx index c55ec2605438..84edf6ac2855 100644 --- a/sc/inc/dpcachetable.hxx +++ b/sc/inc/dpcachetable.hxx @@ -33,6 +33,7 @@ #include "osl/mutex.hxx" #include "global.hxx" #include "dpitemdata.hxx" +#include "dpmacros.hxx" #include <vector> #include <boost/unordered_set.hpp> @@ -55,6 +56,8 @@ struct ScQueryParam; */ class SC_DLLPUBLIC ScDPCacheTable { + typedef mdds::flat_segment_tree<SCROW, bool> RowFlagType; + public: /** interface class used for filtering of rows. */ class FilterBase @@ -155,6 +158,11 @@ public: bool empty() const; bool hasCache() const; +#if DEBUG_PIVOT_TABLE + void dumpRowFlag(const RowFlagType& rFlag) const; + void dump() const; +#endif + private: ScDPCacheTable(); ScDPCacheTable(const ScDPCacheTable&); @@ -168,7 +176,6 @@ private: bool isRowQualified(sal_Int32 nRow, const ::std::vector<Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims) const; private: - typedef mdds::flat_segment_tree<SCROW, bool> RowFlagType; /** unique field entires for each field (column). */ ::std::vector< ::std::vector<SCROW> > maFieldEntries; diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx index 9cadf1ccf060..01fab13e01c4 100644 --- a/sc/source/core/data/dpcachetable.cxx +++ b/sc/source/core/data/dpcachetable.cxx @@ -431,4 +431,41 @@ const ScDPCache* ScDPCacheTable::getCache() const return mpCache; } +#if DEBUG_PIVOT_TABLE +#include <iostream> +using std::cout; +using std::endl; + +void ScDPCacheTable::dumpRowFlag(const RowFlagType& rFlag) const +{ + RowFlagType::const_iterator it = rFlag.begin(), itEnd = rFlag.end(); + bool bShow = it->second; + SCROW nRow1 = it->first; + for (++it; it != itEnd; ++it) + { + SCROW nRow2 = it->first; + cout << " * range " << nRow1 << "-" << nRow2 << ": " << (bShow ? "on" : "off") << endl; + bShow = it->second; + nRow1 = nRow2; + } +} + +void ScDPCacheTable::dump() const +{ + cout << "--- pivot cache filter dump" << endl; + + // Flat segment tree always has at least 2 nodes. + cout << endl; + cout << "* show by filter" << endl; + dumpRowFlag(maShowByFilter); + + cout << endl; + cout << "* show by page dimensions" << endl; + dumpRowFlag(maShowByPage); + + cout << "---" << endl; +} + +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |