[Libreoffice-commits] core.git: sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Wed Oct 30 14:28:35 CET 2013


 sc/source/core/opencl/formulagroupcl.cxx |   37 +++++++++++++++----------------
 sc/source/core/opencl/opbase.cxx         |    2 -
 sc/source/core/opencl/opbase.hxx         |   11 ++++++---
 3 files changed, 27 insertions(+), 23 deletions(-)

New commits:
commit 9c6d513fe77120c85858b4f3f3250c6c0a09bbf7
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 30 09:29:24 2013 -0400

    Let's use typedef for this.
    
    Change-Id: If2523ee085285dc47d18fce425f784caa664d73e

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index c2802e8..94ab088 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -93,7 +93,7 @@ class ConstStringArgument: public DynamicKernelArgument
 {
 public:
     ConstStringArgument(const std::string &s,
-        boost::shared_ptr<FormulaTreeNode> ft):
+        FormulaTreeNodeRef ft):
             DynamicKernelArgument(s, ft) {}
     /// Generate declaration
     virtual void GenDecl(std::stringstream &ss) const
@@ -151,7 +151,7 @@ class DynamicKernelConstantArgument: public DynamicKernelArgument
 {
 public:
     DynamicKernelConstantArgument(const std::string &s,
-        boost::shared_ptr<FormulaTreeNode> ft):
+        FormulaTreeNodeRef ft):
             DynamicKernelArgument(s, ft) {}
     /// Generate declaration
     virtual void GenDecl(std::stringstream &ss) const
@@ -195,7 +195,7 @@ class DynamicKernelStringArgument: public DynamicKernelArgument
 {
 public:
     DynamicKernelStringArgument(const std::string &s,
-        boost::shared_ptr<FormulaTreeNode> ft):
+        FormulaTreeNodeRef ft):
         DynamicKernelArgument(s, ft) {}
 
     virtual void GenSlidingWindowFunction(std::stringstream &) {}
@@ -268,7 +268,7 @@ class DynamicKernelSlidingArgument: public Base
 {
 public:
     DynamicKernelSlidingArgument(const std::string &s,
-        boost::shared_ptr<FormulaTreeNode> ft):
+        FormulaTreeNodeRef ft):
         Base(s, ft)
     {
         FormulaToken *t = ft->GetFormulaToken();
@@ -665,7 +665,7 @@ public:
     typedef std::vector<SubArgument> SubArgumentsType;
 
     DynamicKernelSoPArguments(const std::string &s,
-        boost::shared_ptr<FormulaTreeNode> ft);
+        FormulaTreeNodeRef ft);
 
     /// Create buffer and pass the buffer to a given kernel
     virtual size_t Marshal(cl_kernel k, int argno, int nVectorWidth)
@@ -766,7 +766,7 @@ private:
 
 template <class Op>
 boost::shared_ptr<DynamicKernelArgument> SoPHelper(const std::string &ts,
-    boost::shared_ptr<FormulaTreeNode> ft)
+    FormulaTreeNodeRef ft)
 {
     return boost::shared_ptr<DynamicKernelArgument>(
         new DynamicKernelSoPArguments<Op>(ts, ft));
@@ -774,7 +774,7 @@ boost::shared_ptr<DynamicKernelArgument> SoPHelper(const std::string &ts,
 
 template <class Op>
 DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s,
-    boost::shared_ptr<FormulaTreeNode> ft):
+    FormulaTreeNodeRef ft):
     DynamicKernelArgument(s, ft) {
     size_t nChildren = ft->Children.size();
 
@@ -1113,7 +1113,7 @@ public:
     typedef std::list< boost::shared_ptr<DynamicKernelArgument> > ArgumentList;
     SymbolTable(void):mCurId(0) {}
     template <class T>
-    const DynamicKernelArgument *DeclRefArg(boost::shared_ptr<FormulaTreeNode>);
+    const DynamicKernelArgument *DeclRefArg(FormulaTreeNodeRef);
     /// Used to generate sliding window helpers
     void DumpSlidingWindowFunctions(std::stringstream &ss)
     {
@@ -1144,7 +1144,7 @@ void SymbolTable::Marshal(cl_kernel k, int nVectorWidth)
 /// Code generation
 class DynamicKernel {
 public:
-    DynamicKernel(boost::shared_ptr<FormulaTreeNode> r):mpRoot(r),
+    DynamicKernel(FormulaTreeNodeRef r):mpRoot(r),
         mpProgram(NULL), mpKernel(NULL), mpResClmem(NULL) {}
     /// Code generation in OpenCL
     void CodeGen() {
@@ -1227,8 +1227,8 @@ public:
     ~DynamicKernel();
     cl_mem GetResultBuffer(void) const { return mpResClmem; }
 private:
-    void TraverseAST(boost::shared_ptr<FormulaTreeNode>);
-    boost::shared_ptr<FormulaTreeNode> mpRoot;
+    void TraverseAST(FormulaTreeNodeRef);
+    FormulaTreeNodeRef mpRoot;
     SymbolTable mSyms;
     std::string mKernelSignature, mKernelHash;
     std::string mFullProgramSrc;
@@ -1289,7 +1289,7 @@ void DynamicKernel::CreateKernel(void)
 // The template argument T must be a subclass of DynamicKernelArgument
 template <typename T>
 const DynamicKernelArgument *SymbolTable::DeclRefArg(
-                  boost::shared_ptr<FormulaTreeNode> t)
+                  FormulaTreeNodeRef t)
 {
     FormulaToken *ref = t->GetFormulaToken();
     ArgumentMap::iterator it = mSymbols.find(ref);
@@ -1350,15 +1350,15 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
     // Constructing "AST"
     FormulaTokenIterator aCode = rCode;
     std::list<FormulaToken *> list;
-    std::map<FormulaToken *, boost::shared_ptr<FormulaTreeNode> > m_hash_map;
+    std::map<FormulaToken *, FormulaTreeNodeRef> m_hash_map;
     FormulaToken*  pCur;
     while( (pCur = (FormulaToken*)(aCode.Next()) ) != NULL)
     {
         OpCode eOp = pCur->GetOpCode();
         if ( eOp != ocPush )
         {
-            boost::shared_ptr<FormulaTreeNode> m_currNode =
-                 boost::shared_ptr<FormulaTreeNode>(new FormulaTreeNode(pCur));
+            FormulaTreeNodeRef m_currNode =
+                 FormulaTreeNodeRef(new FormulaTreeNode(pCur));
             sal_uInt8 m_ParamCount =  pCur->GetParamCount();
             for(int i=0; i<m_ParamCount; i++)
             {
@@ -1372,8 +1372,8 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
                 }
                 else
                 {
-                    boost::shared_ptr<FormulaTreeNode> m_ChildTreeNode =
-                      boost::shared_ptr<FormulaTreeNode>(
+                    FormulaTreeNodeRef m_ChildTreeNode =
+                      FormulaTreeNodeRef(
                                new FormulaTreeNode(m_TempFormula));
                     m_currNode->Children.push_back(m_ChildTreeNode);
                 }
@@ -1385,8 +1385,7 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
         list.push_back(pCur);
     }
 
-    boost::shared_ptr<FormulaTreeNode> Root =
-            boost::shared_ptr<FormulaTreeNode>(new FormulaTreeNode(NULL));
+    FormulaTreeNodeRef Root = FormulaTreeNodeRef(new FormulaTreeNode(NULL));
     Root->Children.push_back(m_hash_map[list.back()]);
     // Code generation
     mpKernel = new DynamicKernel(Root);
diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx
index ec59e7a..88042ef 100644
--- a/sc/source/core/opencl/opbase.cxx
+++ b/sc/source/core/opencl/opbase.cxx
@@ -16,7 +16,7 @@ using namespace formula;
 namespace sc { namespace opencl {
 
 DynamicKernelArgument::DynamicKernelArgument(const std::string &s,
-   boost::shared_ptr<FormulaTreeNode> ft):
+   FormulaTreeNodeRef ft):
     mSymName(s), mFormulaTree(ft), mpClmem(NULL) {}
 
 /// Generate declaration
diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx
index a858ede..63327b1 100644
--- a/sc/source/core/opencl/opbase.hxx
+++ b/sc/source/core/opencl/opbase.hxx
@@ -19,6 +19,9 @@
 #define ISNAN
 
 namespace sc { namespace opencl {
+
+class FormulaTreeNode;
+
 /// Exceptions
 
 /// Failed in parsing
@@ -46,6 +49,8 @@ public:
     Unhandled() {}
 };
 
+typedef boost::shared_ptr<FormulaTreeNode> FormulaTreeNodeRef;
+
 class FormulaTreeNode
 {
 public:
@@ -53,7 +58,7 @@ public:
     {
         Children.reserve(8);
     }
-    std::vector<boost::shared_ptr<FormulaTreeNode> > Children;
+    std::vector<FormulaTreeNodeRef> Children;
     formula::FormulaToken *GetFormulaToken(void) const
     {
         return mpCurrentFormula;
@@ -70,7 +75,7 @@ private:
 class DynamicKernelArgument
 {
 public:
-    DynamicKernelArgument(const std::string &s, boost::shared_ptr<FormulaTreeNode> ft);
+    DynamicKernelArgument(const std::string &s, FormulaTreeNodeRef ft);
 
     const std::string &GetNameAsString(void) const { return mSymName; }
     /// Generate declaration
@@ -98,7 +103,7 @@ public:
     const std::string& GetName(void) const { return mSymName; }
 protected:
     const std::string mSymName;
-    boost::shared_ptr<FormulaTreeNode> mFormulaTree;
+    FormulaTreeNodeRef mFormulaTree;
     // Used by marshaling
     cl_mem mpClmem;
 };


More information about the Libreoffice-commits mailing list