[Rinside-commits] r94 - in pkg: inst src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 4 14:20:45 CET 2010


Author: romain
Date: 2010-02-04 14:20:45 +0100 (Thu, 04 Feb 2010)
New Revision: 94

Modified:
   pkg/inst/ChangeLog
   pkg/src/RInside.cpp
   pkg/src/RInside.h
Log:
RInside gains a default constructor when there is no command line arguments

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-02-04 12:57:29 UTC (rev 93)
+++ pkg/inst/ChangeLog	2010-02-04 13:20:45 UTC (rev 94)
@@ -1,3 +1,10 @@
+2010-02-04  Romain Francois <francoisromain at free.fr>
+
+	* RInside::autoloads revisited with the new Rcpp api
+
+	* RInside gains a default constructor to be used when there 
+	is no command line arguments
+	
 2010-01-28  Romain Francois <francoisromain at free.fr>
 
 	* src/RInside.{h,cpp}: Retire assign(vector<vector<double>> )

Modified: pkg/src/RInside.cpp
===================================================================
--- pkg/src/RInside.cpp	2010-02-04 12:57:29 UTC (rev 93)
+++ pkg/src/RInside.cpp	2010-02-04 13:20:45 UTC (rev 94)
@@ -45,7 +45,16 @@
     logTxt("RInside::dtor END", verbose);
 }
 
+RInside::RInside(){
+	initialize( 0, 0 );
+}
+
 RInside::RInside(const int argc, const char* const argv[]) {
+	initialize( argc, argv ); 
+}
+
+/* TODO: use a vector<string> would make all this a bit more readable */
+void RInside::initialize(const int argc, const char* const argv[]){
     logTxt("RInside::ctor BEGIN", verbose);
 
     verbose_m = false; 		// Default is false
@@ -89,7 +98,6 @@
     autoloads();    		// Force all default package to be dynamically required */
 
     if ((argc - optind) > 1){    	// for argv vector in Global Env */
-	// int nargv = argc - optind - 1;	// Build string vector
 	Rcpp::CharacterVector s_argv( argv+(1+optind), argv+argc );
 	assign(s_argv, "argv");
     } else {
@@ -281,6 +289,10 @@
 }
 
 // specializations of Rcpp wrap template
+// this overwrites the default behaviour in Rcpp that would 
+// wrap vector<vector<double>> as lists of numeric vectors
+//
+// RInside uses vector<vector<double>> as matrices
 
 namespace Rcpp{
 

Modified: pkg/src/RInside.h
===================================================================
--- pkg/src/RInside.h	2010-02-04 12:57:29 UTC (rev 93)
+++ pkg/src/RInside.h	2010-02-04 13:20:45 UTC (rev 94)
@@ -50,6 +50,8 @@
     void init_tempdir(void);
     void init_rand(void);
     void autoloads(void);
+    
+    void initialize(const int argc, const char* const argv[] ) ;
 
 public:
     int parseEval(const std::string & line, SEXP &ans);
@@ -60,9 +62,7 @@
 	Rcpp::Environment::global_env().assign( nam, object ) ;
     }
     
-    // non-templated version
-    // void assign(const std::vector< std::vector< double > > & mat, const std::string & nam);
-
+    RInside() ;
     RInside(const int argc, const char* const argv[]);
     ~RInside();
 };



More information about the Rinside-commits mailing list