diff options
author | Tor Lillqvist <tml@collabora.com> | 2014-10-29 17:12:13 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2014-10-29 17:16:21 +0200 |
commit | 3bdee6495ebc7f515d6d297e7f7df9a46acc3880 (patch) | |
tree | f26167806894da6586eabe4cbc8941c81336c09a /sc | |
parent | 66884ac67e248c24b3872bb6ff316ae35c7c1aba (diff) |
Avoid pointless thin wrapper layer
Also works around some warnings from our Clang plug-ins.
Change-Id: Ic9d2bbafefac345b6319300514735143f92dd196
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/inc/clcc/clew.h (renamed from sc/source/core/opencl/clcc/clew.h) | 0 | ||||
-rw-r--r-- | sc/source/core/inc/formulagroupcl.hxx | 41 | ||||
-rw-r--r-- | sc/source/core/inc/openclwrapper.hxx (renamed from sc/source/core/opencl/openclwrapper.hxx) | 0 | ||||
-rw-r--r-- | sc/source/core/opencl/clcc/clew.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 58 | ||||
-rw-r--r-- | sc/source/core/tool/formulagroup.cxx | 22 |
6 files changed, 53 insertions, 70 deletions
diff --git a/sc/source/core/opencl/clcc/clew.h b/sc/source/core/inc/clcc/clew.h index 57f3dc282f56..57f3dc282f56 100644 --- a/sc/source/core/opencl/clcc/clew.h +++ b/sc/source/core/inc/clcc/clew.h diff --git a/sc/source/core/inc/formulagroupcl.hxx b/sc/source/core/inc/formulagroupcl.hxx new file mode 100644 index 000000000000..9325b258b8d6 --- /dev/null +++ b/sc/source/core/inc/formulagroupcl.hxx @@ -0,0 +1,41 @@ +/* -*- 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_SOURCE_CORE_INC_FORMULAGROUPCL_HXX +#define INCLUDED_SC_SOURCE_CORE_INC_FORMULAGROUPCL_HXX + +#include "formulagroup.hxx" + +namespace sc { namespace opencl { + +class FormulaGroupInterpreterOpenCL : public FormulaGroupInterpreter +{ +public: + FormulaGroupInterpreterOpenCL() : + FormulaGroupInterpreter() + { + } + virtual ~FormulaGroupInterpreterOpenCL() + { + } + + virtual ScMatrixRef inverseMatrix( const ScMatrix& rMat ) SAL_OVERRIDE; + virtual CompiledFormula* createCompiledFormula( ScDocument& rDoc, + const ScAddress& rTopPos, + ScFormulaCellGroup& rGroup, + ScTokenArray& rCode ) SAL_OVERRIDE; + virtual bool interpret( ScDocument& rDoc, const ScAddress& rTopPos, + ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode ) SAL_OVERRIDE; +}; + +}} // namespace sc::opencl + +#endif // INCLUDED_SC_SOURCE_CORE_INC_FORMULAGROUPCL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/opencl/openclwrapper.hxx b/sc/source/core/inc/openclwrapper.hxx index ef9842ab03f1..ef9842ab03f1 100644 --- a/sc/source/core/opencl/openclwrapper.hxx +++ b/sc/source/core/inc/openclwrapper.hxx diff --git a/sc/source/core/opencl/clcc/clew.cxx b/sc/source/core/opencl/clcc/clew.cxx index 636c8e2623bb..dec4cc9b71c9 100644 --- a/sc/source/core/opencl/clcc/clew.cxx +++ b/sc/source/core/opencl/clcc/clew.cxx @@ -4,7 +4,7 @@ // Distributed under the Boost Software License, Version 1.0. // (See accompanying file license.txt) -#include "clew.h" +#include "clcc/clew.h" //! \file clew.c //! \brief OpenCL run-time loader source diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 42860509dbe0..645d889e6367 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -8,6 +8,7 @@ */ #include "formulagroup.hxx" +#include "formulagroupcl.hxx" #include "clkernelthread.hxx" #include "grouptokenconverter.hxx" #include "document.hxx" @@ -3510,26 +3511,6 @@ const DynamicKernelArgument* SymbolTable::DeclRefArg( } } -class FormulaGroupInterpreterOpenCL : public FormulaGroupInterpreter -{ -public: - FormulaGroupInterpreterOpenCL() : - FormulaGroupInterpreter() - { - } - virtual ~FormulaGroupInterpreterOpenCL() - { - } - - virtual ScMatrixRef inverseMatrix( const ScMatrix& rMat ) SAL_OVERRIDE; - virtual CompiledFormula* createCompiledFormula( ScDocument& rDoc, - const ScAddress& rTopPos, - ScFormulaCellGroup& rGroup, - ScTokenArray& rCode ) SAL_OVERRIDE; - virtual bool interpret( ScDocument& rDoc, const ScAddress& rTopPos, - ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode ) SAL_OVERRIDE; -}; - ScMatrixRef FormulaGroupInterpreterOpenCL::inverseMatrix( const ScMatrix& ) { return NULL; @@ -3730,41 +3711,4 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc, }} // namespace sc::opencl -extern "C" { - -sc::FormulaGroupInterpreter* -createFormulaGroupOpenCLInterpreter() -{ - return new sc::opencl::FormulaGroupInterpreterOpenCL(); -} - -size_t getOpenCLPlatformCount() -{ - return sc::opencl::getOpenCLPlatformCount(); -} - -void fillOpenCLInfo( - sc::OpenCLPlatformInfo* pInfos, size_t nInfoSize ) -{ - const std::vector<sc::OpenCLPlatformInfo>& rPlatforms = - sc::opencl::fillOpenCLInfo(); - size_t n = std::min(rPlatforms.size(), nInfoSize); - for (size_t i = 0; i < n; ++i) - pInfos[i] = rPlatforms[i]; -} - -bool switchOpenCLDevice( - const OUString* pDeviceId, bool bAutoSelect, - bool bForceEvaluation ) -{ - return sc::opencl::switchOpenCLDevice(pDeviceId, bAutoSelect, bForceEvaluation); -} - -void getOpenCLDeviceInfo( size_t* pDeviceId, size_t* pPlatformId ) -{ - sc::opencl::getOpenCLDeviceInfo(*pDeviceId, *pPlatformId); -} - -} // extern "C" - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index 376b22d88438..9d61efa195ce 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -10,6 +10,7 @@ #include <config_features.h> #include "formulagroup.hxx" +#include "formulagroupcl.hxx" #include "document.hxx" #include "formulacell.hxx" #include "tokenarray.hxx" @@ -31,11 +32,7 @@ #if HAVE_FEATURE_OPENCL -extern "C" size_t getOpenCLPlatformCount(void); -extern "C" void fillOpenCLInfo(sc::OpenCLPlatformInfo*, size_t); -extern "C" bool switchOpenCLDevice(const OUString*, bool, bool); -extern "C" sc::FormulaGroupInterpreter* createFormulaGroupOpenCLInterpreter(); -extern "C" void getOpenCLDeviceInfo(size_t*, size_t*); +#include "openclwrapper.hxx" #endif @@ -543,13 +540,14 @@ void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rP #if !HAVE_FEATURE_OPENCL (void) rPlatforms; #else - size_t nPlatforms = ::getOpenCLPlatformCount(); + size_t nPlatforms = sc::opencl::getOpenCLPlatformCount(); if (!nPlatforms) return; - std::vector<OpenCLPlatformInfo> aPlatforms(nPlatforms); - ::fillOpenCLInfo(&aPlatforms[0], aPlatforms.size()); - rPlatforms.swap(aPlatforms); + const std::vector<sc::OpenCLPlatformInfo>& rPlatformsFromWrapper = + sc::opencl::fillOpenCLInfo(); + + rPlatforms.assign(rPlatformsFromWrapper.begin(), rPlatformsFromWrapper.end()); #endif } @@ -571,7 +569,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool return true; } #if HAVE_FEATURE_OPENCL - bool bSuccess = ::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation); + bool bSuccess = sc::opencl::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation); if(!bSuccess) return false; #else @@ -584,7 +582,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool #if HAVE_FEATURE_OPENCL if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled ) { - msInstance = ::createFormulaGroupOpenCLInterpreter(); + msInstance = new sc::opencl::FormulaGroupInterpreterOpenCL(); return msInstance != NULL; } #else @@ -606,7 +604,7 @@ void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int3 size_t aDeviceId = static_cast<size_t>(-1); size_t aPlatformId = static_cast<size_t>(-1); - ::getOpenCLDeviceInfo(&aDeviceId, &aPlatformId); + sc::opencl::getOpenCLDeviceInfo(aDeviceId, aPlatformId); rDeviceId = aDeviceId; rPlatformId = aPlatformId; #endif |