sc/inc/formulagroup.hxx | 128 +++++++++++++++++++++++++++++++ sc/inc/formulagroupcontext.hxx | 76 ------------------ sc/inc/formulagroupinterpreter.hxx | 76 ------------------ sc/qa/unit/opencl-test.cxx | 2 sc/source/core/data/column2.cxx | 2 sc/source/core/data/documen2.cxx | 2 sc/source/core/data/documen7.cxx | 2 sc/source/core/data/document.cxx | 2 sc/source/core/data/formulacell.cxx | 2 sc/source/core/inc/dynamickernel.hxx | 2 sc/source/core/opencl/formulagroupcl.cxx | 2 sc/source/core/tool/clkernelthread.cxx | 2 sc/source/core/tool/formulagroup.cxx | 3 sc/source/core/tool/formulaopt.cxx | 2 sc/source/core/tool/interpr5.cxx | 2 sc/source/ui/optdlg/calcoptionsdlg.cxx | 2 16 files changed, 141 insertions(+), 166 deletions(-)
New commits: commit 8efe73fcd4c3b9d7ed45021764f57265e1bc7225 Author: Tor Lillqvist <[email protected]> Date: Tue Nov 19 11:16:34 2013 +0200 Don't split groupcontext.hxx after all Change-Id: Ie829765f7d9a6e7ba8b99d8fc973537a2576581f diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx new file mode 100644 index 0000000..7cb055e --- /dev/null +++ b/sc/inc/formulagroup.hxx @@ -0,0 +1,128 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef SC_FORMULAGROUP_HXX +#define SC_FORMULAGROUP_HXX + +#include "address.hxx" +#include "types.hxx" +#include "platforminfo.hxx" + +#include "svl/sharedstringpool.hxx" + +#include <vector> +#include <boost/noncopyable.hpp> +#include <boost/ptr_container/ptr_vector.hpp> +#include <boost/unordered_set.hpp> + +class ScDocument; +class ScTokenArray; + +namespace sc { + +struct FormulaGroupContext : boost::noncopyable +{ + typedef std::vector<double> NumArrayType; + typedef std::vector<rtl_uString*> StrArrayType; + typedef boost::ptr_vector<NumArrayType> NumArrayStoreType; + typedef boost::ptr_vector<StrArrayType> StrArrayStoreType; + + struct ColKey + { + SCTAB mnTab; + SCCOL mnCol; + + struct Hash + { + size_t operator() ( const ColKey& rKey ) const; + }; + + ColKey( SCTAB nTab, SCCOL nCol ); + + bool operator== ( const ColKey& r ) const; + bool operator!= ( const ColKey& r ) const; + }; + + struct ColArray + { + NumArrayType* mpNumArray; + StrArrayType* mpStrArray; + size_t mnSize; + + ColArray( NumArrayType* pNumArray, StrArrayType* pStrArray ); + }; + + typedef boost::unordered_map<ColKey, ColArray, ColKey::Hash> ColArraysType; + + NumArrayStoreType maNumArrays; /// manage life cycle of numeric arrays. + StrArrayStoreType maStrArrays; /// manage life cycle of string arrays. + + ColArraysType maColArrays; /// keep track of longest array for each column. + + ColArray* getCachedColArray( SCTAB nTab, SCCOL nCol, size_t nSize ); + + ColArray* setCachedColArray( + SCTAB nTab, SCCOL nCol, NumArrayType* pNumArray, StrArrayType* pStrArray ); + + void ensureStrArray( ColArray& rColArray, size_t nArrayLen ); + void ensureNumArray( ColArray& rColArray, size_t nArrayLen ); +}; + +/** + * Abstract base class for a "compiled" formula + */ +class SC_DLLPUBLIC CompiledFormula +{ +}; + +/** + * Abstract base class for vectorised formula group interpreters, + * plus a global instance factory. + */ +class SC_DLLPUBLIC FormulaGroupInterpreter +{ + static FormulaGroupInterpreter *msInstance; + protected: + FormulaGroupInterpreter() {} + virtual ~FormulaGroupInterpreter() {} + + public: + static FormulaGroupInterpreter *getStatic(); + static void fillOpenCLInfo(std::vector<OpenclPlatformInfo>& rPlatforms); + static bool switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect); + static void enableOpenCL(bool bEnable); + + virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat) = 0; + virtual CompiledFormula* createCompiledFormula(ScDocument& rDoc, + const ScAddress& rTopPos, + ScFormulaCellGroupRef& xGroup, + ScTokenArray& rCode) = 0; + virtual bool interpret(ScDocument& rDoc, const ScAddress& rTopPos, ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode) = 0; +}; + +/// Inherit from this for alternate formula group calculation approaches. +class SC_DLLPUBLIC FormulaGroupInterpreterSoftware : public FormulaGroupInterpreter +{ +public: + FormulaGroupInterpreterSoftware(); + virtual ~FormulaGroupInterpreterSoftware() {} + + virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat); + virtual CompiledFormula* createCompiledFormula(ScDocument& rDoc, + const ScAddress& rTopPos, + ScFormulaCellGroupRef& xGroup, + ScTokenArray& rCode) SAL_OVERRIDE; + virtual bool interpret(ScDocument& rDoc, const ScAddress& rTopPos, ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/formulagroupcontext.hxx b/sc/inc/formulagroupcontext.hxx deleted file mode 100644 index 575f687..0000000 --- a/sc/inc/formulagroupcontext.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef INCLUDED_SC_INC_FORMULAGROUPCONTEXT_HXX -#define INCLUDED_SC_INC_FORMULAGROUPCONTEXT_HXX - -#include "address.hxx" -#include "types.hxx" - -#include <vector> -#include <boost/noncopyable.hpp> -#include <boost/ptr_container/ptr_vector.hpp> -#include <boost/unordered_map.hpp> -#include <rtl/ustring.hxx> - -namespace sc { - -struct FormulaGroupContext : boost::noncopyable -{ - typedef std::vector<double> NumArrayType; - typedef std::vector<rtl_uString*> StrArrayType; - typedef boost::ptr_vector<NumArrayType> NumArrayStoreType; - typedef boost::ptr_vector<StrArrayType> StrArrayStoreType; - - struct ColKey - { - SCTAB mnTab; - SCCOL mnCol; - - struct Hash - { - size_t operator() ( const ColKey& rKey ) const; - }; - - ColKey( SCTAB nTab, SCCOL nCol ); - - bool operator== ( const ColKey& r ) const; - bool operator!= ( const ColKey& r ) const; - }; - - struct ColArray - { - NumArrayType* mpNumArray; - StrArrayType* mpStrArray; - size_t mnSize; - - ColArray( NumArrayType* pNumArray, StrArrayType* pStrArray ); - }; - - typedef boost::unordered_map<ColKey, ColArray, ColKey::Hash> ColArraysType; - - NumArrayStoreType maNumArrays; /// manage life cycle of numeric arrays. - StrArrayStoreType maStrArrays; /// manage life cycle of string arrays. - - ColArraysType maColArrays; /// keep track of longest array for each column. - - ColArray* getCachedColArray( SCTAB nTab, SCCOL nCol, size_t nSize ); - - ColArray* setCachedColArray( - SCTAB nTab, SCCOL nCol, NumArrayType* pNumArray, StrArrayType* pStrArray ); - - void ensureStrArray( ColArray& rColArray, size_t nArrayLen ); - void ensureNumArray( ColArray& rColArray, size_t nArrayLen ); -}; - -} - -#endif // INCLUDED_SC_INC_FORMULAGROUPCONTEXT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/formulagroupinterpreter.hxx b/sc/inc/formulagroupinterpreter.hxx deleted file mode 100644 index f408727..0000000 --- a/sc/inc/formulagroupinterpreter.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef SC_INC_FORMULAGROUPINTERPRETER_HXX -#define SC_INC_FORMULAGROUPINTERPRETER_HXX - -#include "address.hxx" -#include "types.hxx" -#include "platforminfo.hxx" - -#include <vector> -#include <boost/ptr_container/ptr_vector.hpp> - -class ScDocument; -class ScTokenArray; - -namespace sc { - -/** - * Abstract base class for a "compiled" formula - */ -class SC_DLLPUBLIC CompiledFormula -{ -}; - -/** - * Abstract base class for vectorised formula group interpreters, - * plus a global instance factory. - */ -class SC_DLLPUBLIC FormulaGroupInterpreter -{ - static FormulaGroupInterpreter *msInstance; - protected: - FormulaGroupInterpreter() {} - virtual ~FormulaGroupInterpreter() {} - - public: - static FormulaGroupInterpreter *getStatic(); - static void fillOpenCLInfo(std::vector<OpenclPlatformInfo>& rPlatforms); - static bool switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect); - static void enableOpenCL(bool bEnable); - - virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat) = 0; - virtual CompiledFormula* createCompiledFormula(ScDocument& rDoc, - const ScAddress& rTopPos, - ScFormulaCellGroupRef& xGroup, - ScTokenArray& rCode) = 0; - virtual bool interpret(ScDocument& rDoc, const ScAddress& rTopPos, ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode) = 0; -}; - -/// Inherit from this for alternate formula group calculation approaches. -class SC_DLLPUBLIC FormulaGroupInterpreterSoftware : public FormulaGroupInterpreter -{ -public: - FormulaGroupInterpreterSoftware(); - virtual ~FormulaGroupInterpreterSoftware() {} - - virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat) SAL_OVERRIDE; - virtual CompiledFormula* createCompiledFormula(ScDocument& rDoc, - const ScAddress& rTopPos, - ScFormulaCellGroupRef& xGroup, - ScTokenArray& rCode) SAL_OVERRIDE; - virtual bool interpret(ScDocument& rDoc, const ScAddress& rTopPos, ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode) SAL_OVERRIDE; -}; - -} - -#endif // SC_INC_FORMULAGROUPINTERPRETER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 486ee23..c26e25d 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -31,7 +31,7 @@ #include "userdat.hxx" #include "formulacell.hxx" #include "platforminfo.hxx" -#include "formulagroupinterpreter.hxx" +#include "formulagroup.hxx" #include <svx/svdpage.hxx> diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index f2f027d..952f5bd 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -39,7 +39,7 @@ #include "cellvalue.hxx" #include "tokenarray.hxx" #include "globalnames.hxx" -#include "formulagroupcontext.hxx" +#include "formulagroup.hxx" #include "listenercontext.hxx" #include "mtvcellfunc.hxx" #include "scmatrix.hxx" diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 3fc4b33..23a4bcf 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -90,7 +90,7 @@ #include "clipcontext.hxx" #include "refupdatecontext.hxx" #include "scopetools.hxx" -#include "formulagroupcontext.hxx" +#include "formulagroup.hxx" using namespace com::sun::star; diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index f84b83a..7dd9821 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -36,7 +36,7 @@ #include "sheetevents.hxx" #include "tokenarray.hxx" #include "listenercontext.hxx" -#include "formulagroupcontext.hxx" +#include "formulagroup.hxx" #include <tools/shl.hxx> diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 016778a..f8a6d92 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -94,7 +94,7 @@ #include "listenercontext.hxx" #include "scopetools.hxx" #include "refupdatecontext.hxx" -#include "formulagroupcontext.hxx" +#include "formulagroup.hxx" #include "formula/vectortoken.hxx" diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 8a7d644..30888af 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -45,7 +45,7 @@ #include "formula/vectortoken.hxx" #include "svl/intitem.hxx" #include "rtl/strbuf.hxx" -#include "formulagroupinterpreter.hxx" +#include "formulagroup.hxx" #include "listenercontext.hxx" #include "types.hxx" #include "scopetools.hxx" diff --git a/sc/source/core/inc/dynamickernel.hxx b/sc/source/core/inc/dynamickernel.hxx index e4a42aa..b3f3e8f 100644 --- a/sc/source/core/inc/dynamickernel.hxx +++ b/sc/source/core/inc/dynamickernel.hxx @@ -12,7 +12,7 @@ #include <config_features.h> -#include "formulagroupinterpreter.hxx" +#include "formulagroup.hxx" #if !HAVE_FEATURE_OPENCL diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index a66e4e1..f656c7e 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "formulagroupinterpreter.hxx" +#include "formulagroup.hxx" #include "grouptokenconverter.hxx" #include "document.hxx" #include "formulacell.hxx" diff --git a/sc/source/core/tool/clkernelthread.cxx b/sc/source/core/tool/clkernelthread.cxx index f4debc6..e7bda8a 100644 --- a/sc/source/core/tool/clkernelthread.cxx +++ b/sc/source/core/tool/clkernelthread.cxx @@ -9,7 +9,7 @@ #include <sal/log.hxx> -#include "formulagroupinterpreter.hxx" +#include "formulagroup.hxx" #include "grouptokenconverter.hxx" #include "clkernelthread.hxx" diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index 7bb10ad..ba85800 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -9,8 +9,7 @@ #include <config_features.h> -#include "formulagroupcontext.hxx" -#include "formulagroupinterpreter.hxx" +#include "formulagroup.hxx" #include "document.hxx" #include "formulacell.hxx" #include "tokenarray.hxx" diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx index 271ee0b2..79d84a6 100644 --- a/sc/source/core/tool/formulaopt.cxx +++ b/sc/source/core/tool/formulaopt.cxx @@ -15,7 +15,7 @@ #include "formulaopt.hxx" #include "miscuno.hxx" #include "global.hxx" -#include "formulagroupinterpreter.hxx" +#include "formulagroup.hxx" using namespace utl; using namespace com::sun::star::uno; diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 8558e17..2c03ccb 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -35,7 +35,7 @@ #include "scmatrix.hxx" #include "globstr.hrc" #include "cellkeytranslator.hxx" -#include "formulagroupinterpreter.hxx" +#include "formulagroup.hxx" #include <vector> diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 3085451..eefb7f6 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -15,7 +15,7 @@ #include "svtools/treelistentry.hxx" #if HAVE_FEATURE_OPENCL -#include "formulagroupinterpreter.hxx" +#include "formulagroup.hxx" #endif namespace { _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
