[Rcpp-devel] Modifications

Ott Toomet OTTT at asb.dk
Fri Nov 13 11:13:27 CET 2009


Hi,

OK, so it works for me now.  I changed RcppParams a little bit, so it can extract arbitrary list components (getValue member function) and it's components need not to be named ('named' member variable).  It is also easy to extract components by position.

I would be happy to implement some of the stuff in a more polished way to the package but only if we can agree about what and how.

Best,
Ott

Below my modified class.

class RcppParams {
public:
    RcppParams(SEXP params);
    void   		 checkNames(char *inputNames[], int len);
    bool		 exists(std::string name);
    double 		 getDoubleValue(std::string name);
    int    		 getIntValue(std::string name);
    std::string  getStringValue(std::string name);
    bool   		 getBoolValue(std::string name);
    RcppDate 	 getDateValue(std::string name);
    RcppDatetime getDatetimeValue(std::string name);
    SEXP         getValue(std::string name);
    SEXP         getValue(int posn) { return VECTOR_ELT(_params,posn); };
    int          size() { return Rf_length(_params); };
    bool         isNamed() { return named; };

private:
    bool named;
    std::map<std::string, int> pmap;
    SEXP _params;
};


---------
Ott Toomet
post-doc

Aarhus University
Aarhus Business School
Frichshuset, Hermodsvej 22
DK-8230 Aabyhøj
Denmark

ph:  +45 89 486 196
Fax: +45 89 486 197 
email: ottt at asb.dk

Tartu University
Department of Economics
Narva 4,
Tartu 51009
Estonia

ph: +372 737 6348
email: otoomet at ut.ee
-------------------------------------------

 (o_         (*_         (O_         (o< -!  
//\         //\         //\         //\      
V_/_        V_/_        V_/_        V_/_     
					     
standard    drunken     shocked     noisy    
penguin     penguin     penguin     penguin  




--
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and privileged material.Any review, retransmission, dissemination or other use of,or taking of any action in reliance upon, this informationby persons or entities other than the intended recipientis prohibited.If you received this in error, please contact the senderand delete the material from any computer.



More information about the Rcpp-devel mailing list