[Rcpp-commits] r265 - in pkg/src: . Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 3 21:52:36 CET 2010


Author: romain
Date: 2010-01-03 21:52:36 +0100 (Sun, 03 Jan 2010)
New Revision: 265

Modified:
   pkg/src/Language.cpp
   pkg/src/Rcpp/Language.h
Log:
added setSymbol methods to Language

Modified: pkg/src/Language.cpp
===================================================================
--- pkg/src/Language.cpp	2010-01-03 17:10:51 UTC (rev 264)
+++ pkg/src/Language.cpp	2010-01-03 20:52:36 UTC (rev 265)
@@ -73,6 +73,15 @@
 	
 	Language::~Language(){}
 	
+	void Language::setSymbol( const std::string& symbol){
+		setSymbol( Symbol( symbol ) ) ;
+	}
+	
+	void Language::setSymbol( const Symbol& symbol){
+		SETCAR( m_sexp, symbol ) ;
+		SET_TAG(m_sexp, R_NilValue);
+	}
+	
 	Language::not_compatible::not_compatible() throw() {}
     	const char* Language::not_compatible::what() const throw(){
     		return "cannot convert to call" ;

Modified: pkg/src/Rcpp/Language.h
===================================================================
--- pkg/src/Rcpp/Language.h	2010-01-03 17:10:51 UTC (rev 264)
+++ pkg/src/Rcpp/Language.h	2010-01-03 20:52:36 UTC (rev 265)
@@ -71,7 +71,7 @@
 	 * > as.call( as.list( as.name( "rnorm") ) )
 	 * > call( "rnorm" )
 	 */
-	Language( const std::string& symbol ); 
+	explicit Language( const std::string& symbol ); 
 	
 	/**
 	 * Creates a call using the given symbol as the function name
@@ -81,7 +81,7 @@
 	 * Language( Symbol("rnorm") ) makes a SEXP similar to this: 
 	 * > call( "rnorm" )
 	 */
-	Language( const Symbol& symbol ); 
+	explicit Language( const Symbol& symbol ); 
 	
 	/**
 	 * Creates a call to the given symbol using variable number of 
@@ -107,6 +107,17 @@
 		setSEXP( Rf_lcons( Symbol(symbol), pairlist( args... ) ) );
 	}
 #endif	
+	
+	/**
+	 * sets the symbol of the call
+	 */
+	void setSymbol( const std::string& symbol);
+	
+	/**
+	 * sets the symbol of the call
+	 */
+	void setSymbol( const Symbol& symbol ) ;
+
 	~Language() ;
 };
 



More information about the Rcpp-commits mailing list