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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 5 16:04:26 CET 2010


Author: romain
Date: 2010-01-05 16:04:26 +0100 (Tue, 05 Jan 2010)
New Revision: 280

Modified:
   pkg/src/Environment.cpp
   pkg/src/Function.cpp
   pkg/src/Language.cpp
   pkg/src/Pairlist.cpp
   pkg/src/Rcpp/Environment.h
   pkg/src/Rcpp/Function.h
   pkg/src/Rcpp/Language.h
   pkg/src/Rcpp/Pairlist.h
   pkg/src/Rcpp/Symbol.h
   pkg/src/Symbol.cpp
Log:
move all not_compatible exception classes to RObject

Modified: pkg/src/Environment.cpp
===================================================================
--- pkg/src/Environment.cpp	2010-01-05 14:58:31 UTC (rev 279)
+++ pkg/src/Environment.cpp	2010-01-05 15:04:26 UTC (rev 280)
@@ -54,7 +54,7 @@
     		if( evaluator.successfull() ){
     			setSEXP( evaluator.getResult().asSexp() ) ;
     		} else{
-    			throw not_compatible( ) ; 
+    			throw not_compatible( "cannot convert to environment"  ) ; 
     		}
     	}
     }
@@ -265,13 +265,5 @@
     }
     Environment::no_such_env::~no_such_env() throw() {}
     
-    Environment::not_compatible::not_compatible() throw() {}
-    const char* Environment::not_compatible::what() const throw(){
-    	return "cannot convert to environment" ;
-    }
-    Environment::not_compatible::~not_compatible() throw() {}
-    
-    
-    
 } // namespace Rcpp
 

Modified: pkg/src/Function.cpp
===================================================================
--- pkg/src/Function.cpp	2010-01-05 14:58:31 UTC (rev 279)
+++ pkg/src/Function.cpp	2010-01-05 15:04:26 UTC (rev 280)
@@ -35,18 +35,10 @@
 			setSEXP(x); 
 			break; 
 		default:
-			throw not_compatible() ;
+			throw not_compatible("cannot convert to function") ;
 		}
 	};
 	
-	Function::~Function(){}
+	Function::~Function(){}	
 	
-	Function::not_compatible::not_compatible() throw() {}
-    	const char* Function::not_compatible::what() const throw(){
-    		return "not a function" ;
-    	}
-    	Function::not_compatible::~not_compatible() throw() {}
-    
-	
-	
 } // namespace Rcpp

Modified: pkg/src/Language.cpp
===================================================================
--- pkg/src/Language.cpp	2010-01-05 14:58:31 UTC (rev 279)
+++ pkg/src/Language.cpp	2010-01-05 15:04:26 UTC (rev 280)
@@ -38,7 +38,7 @@
 	    		case EXPRSXP:
 	    			{
 	    				int n = Rf_length(lang) ;
-	    				if( n == 0 ) throw not_compatible() ;
+	    				if( n == 0 ) throw not_compatible("cannot convert to call (LANGSXP)") ;
 	    				SEXP names = GET_NAMES(lang) ; 
 	    				SEXP res, ap;
 	    				PROTECT( ap = res = Rf_allocList( n ) ) ;
@@ -53,7 +53,7 @@
 	    				setSEXP(res) ; 
 	    			}
 	    		default:
-	    			throw not_compatible() ;
+	    			throw not_compatible("cannot convert to call (LANGSXP)") ;
 	    		}
 	    		SET_TYPEOF(m_sexp, LANGSXP);
 	    		SET_TAG(m_sexp, R_NilValue);
@@ -82,12 +82,5 @@
 		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" ;
-    	}
-    	Language::not_compatible::~not_compatible() throw() {}
-    
 	
-	
 } // namespace Rcpp

Modified: pkg/src/Pairlist.cpp
===================================================================
--- pkg/src/Pairlist.cpp	2010-01-05 14:58:31 UTC (rev 279)
+++ pkg/src/Pairlist.cpp	2010-01-05 15:04:26 UTC (rev 280)
@@ -41,7 +41,7 @@
 						if( evaluator.successfull() ){
     							setSEXP( evaluator.getResult().asSexp() ) ;
     						} else{
-    							throw not_compatible( ) ; 
+    							throw not_compatible( "cannot convert to call (LANGSXP)" ) ; 
     						}
 					}
 			}
@@ -51,12 +51,5 @@
 	
 	Pairlist::~Pairlist(){}
 	
-	Pairlist::not_compatible::not_compatible() throw() {}
-    	const char* Pairlist::not_compatible::what() const throw(){
-    		return "cannot convert to pair list" ;
-    	}
-    	Pairlist::not_compatible::~not_compatible() throw() {}
-    
 	
-	
 } // namespace Rcpp

Modified: pkg/src/Rcpp/Environment.h
===================================================================
--- pkg/src/Rcpp/Environment.h	2010-01-05 14:58:31 UTC (rev 279)
+++ pkg/src/Rcpp/Environment.h	2010-01-05 15:04:26 UTC (rev 280)
@@ -95,23 +95,6 @@
     } ;
     
     /**
-     * Exception thrown when attempting to convert a SEXP to 
-     * an environment using as.environment
-     */
-    class not_compatible: public std::exception{
-    	public:
-    		not_compatible() throw() ;
-    		
-    		/**
-    		 * The message: cannot convert to environment 
-    		 */
-    		const char* what() const throw() ;
-    		
-    		~not_compatible() throw() ;
-    	
-    } ;
-
-    /**
      * Exception thrown when attempting to get an environment from a 
      * name
      */

Modified: pkg/src/Rcpp/Function.h
===================================================================
--- pkg/src/Rcpp/Function.h	2010-01-05 14:58:31 UTC (rev 279)
+++ pkg/src/Rcpp/Function.h	2010-01-05 15:04:26 UTC (rev 280)
@@ -34,24 +34,8 @@
  */
 class Function : public RObject{
 public:
+	
 	/**
-	 * Exception thrown when attempting build a Function from a SEXP 
-	 * that is not appropriate
-	 */
-	class not_compatible: public std::exception{
-		public:
-			not_compatible() throw() ;
-			
-			/**
-			 * The message: not a function 
-			 */
-			const char* what() const throw() ;
-			
-			~not_compatible() throw() ;
-		
-	} ;
-  	
-	/**
 	 * Attempts to convert the SEXP to a pair list
 	 *
 	 * @throw not_compatible if the SEXP could not be converted

Modified: pkg/src/Rcpp/Language.h
===================================================================
--- pkg/src/Rcpp/Language.h	2010-01-05 14:58:31 UTC (rev 279)
+++ pkg/src/Rcpp/Language.h	2010-01-05 15:04:26 UTC (rev 280)
@@ -36,24 +36,8 @@
  */
 class Language : public RObject{
 public:
+	
 	/**
-	 * Exception thrown when attempting to convert a SEXP to 
-	 * a call using as.call
-	 */
-	class not_compatible: public std::exception{
-		public:
-			not_compatible() throw() ;
-			
-			/**
-			 * The message: cannot convert to call 
-			 */
-			const char* what() const throw() ;
-			
-			~not_compatible() throw() ;
-		
-	} ;
-  	
-	/**
 	 * Attempts to convert the SEXP to a call
 	 *
 	 * @throw not_compatible if the SEXP could not be converted

Modified: pkg/src/Rcpp/Pairlist.h
===================================================================
--- pkg/src/Rcpp/Pairlist.h	2010-01-05 14:58:31 UTC (rev 279)
+++ pkg/src/Rcpp/Pairlist.h	2010-01-05 15:04:26 UTC (rev 280)
@@ -35,24 +35,8 @@
  */
 class Pairlist : public RObject{
 public:
+	
 	/**
-	 * Exception thrown when attempting to convert a SEXP to 
-	 * a pair list using as.pairlist
-	 */
-	class not_compatible: public std::exception{
-		public:
-			not_compatible() throw() ;
-			
-			/**
-			 * The message: cannot convert to call 
-			 */
-			const char* what() const throw() ;
-			
-			~not_compatible() throw() ;
-		
-	} ;
-  	
-	/**
 	 * Attempts to convert the SEXP to a pair list
 	 *
 	 * @throw not_compatible if the SEXP could not be converted

Modified: pkg/src/Rcpp/Symbol.h
===================================================================
--- pkg/src/Rcpp/Symbol.h	2010-01-05 14:58:31 UTC (rev 279)
+++ pkg/src/Rcpp/Symbol.h	2010-01-05 15:04:26 UTC (rev 280)
@@ -31,25 +31,6 @@
 public:
 
     /**
-     * Exception thrown when attempting to create a Symbol from a 
-     * SEXP that is not compatible
-     */
-    class not_compatible: public std::exception{
-    	public:
-    		not_compatible(int type) throw() ;
-    		
-    		/**
-    		 * The message: not compatible with Symbol
-    		 */
-    		const char* what() const throw();
-    		
-    		~not_compatible() throw() ;
-    		
-    	private:
-    		int type ;
-    } ;
-    	
-    /**
      * wraps the SEXP into a Symbol object. 
      * 
      * @param m_sexp Accepted SEXP types are SYMSXP, CHARSXP and STRSXP

Modified: pkg/src/Symbol.cpp
===================================================================
--- pkg/src/Symbol.cpp	2010-01-05 14:58:31 UTC (rev 279)
+++ pkg/src/Symbol.cpp	2010-01-05 15:04:26 UTC (rev 280)
@@ -23,12 +23,6 @@
 
 namespace Rcpp {
 
-	Symbol::not_compatible::not_compatible(int type) throw() {}
-	Symbol::not_compatible::~not_compatible() throw() {}
-	const char* Symbol::not_compatible::what() const throw() {
-		return "not compatible with Symbol, excepting SYMSXP, CHARSXP or STRSXP" ;
-	}
-	
 	Symbol::Symbol( SEXP x ) throw(not_compatible) : RObject::RObject() {
 		if( x != R_NilValue ){
 			int type = TYPEOF(x) ;
@@ -46,7 +40,7 @@
 					break ;
 				}
 			default:
-				throw not_compatible(type) ;
+				throw not_compatible("cannot convert to symbol (SYMSXP)") ;
 			}
 		} else {
 			setSEXP( x ) ;



More information about the Rcpp-commits mailing list