[Rcpp-commits] r3927 - pkg/Rcpp/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 10 16:31:05 CET 2012


Author: jjallaire
Date: 2012-11-10 16:31:05 +0100 (Sat, 10 Nov 2012)
New Revision: 3927

Modified:
   pkg/Rcpp/src/Attributes.cpp
Log:
optional hook for inclusion of package types

Modified: pkg/Rcpp/src/Attributes.cpp
===================================================================
--- pkg/Rcpp/src/Attributes.cpp	2012-11-10 00:00:10 UTC (rev 3926)
+++ pkg/Rcpp/src/Attributes.cpp	2012-11-10 15:31:05 UTC (rev 3927)
@@ -433,6 +433,7 @@
     };
     
     // Class which manages generating the header file for the package
+    const char * const kTypesSuffix = "_types.h";
     class CppIncludeGenerator : public ExportsGenerator {
     public:
         explicit CppIncludeGenerator(const std::string& packageDir, 
@@ -445,6 +446,7 @@
                 "//")
         {
             includeDir_ = packageDir +  fileSep + "inst" +  fileSep + "include";
+            includeTypes_ = includeDir_ + fileSep + package + kTypesSuffix;
             hasCppInterface_ = false; 
         }
         
@@ -560,6 +562,12 @@
                     ostr << std::endl;
                 }
                 
+                // if there is a types header then include it as well
+                if (FileInfo(includeTypes_).exists()) {
+                    ostr << "#include <" << package() << kTypesSuffix << ">"
+                         << std::endl << std::endl;
+                }
+                
                 // commit with preamble
                 return ExportsGenerator::commit(ostr.str());
             }
@@ -585,6 +593,7 @@
         
     private:
         std::string includeDir_;
+        std::string includeTypes_;
         bool hasCppInterface_;
     };
     



More information about the Rcpp-commits mailing list