Rcpp Version 1.0.14
Loading...
Searching...
No Matches
Module.h
Go to the documentation of this file.
1// Module.h: Rcpp R/C++ interface class library -- Rcpp modules
2//
3// Copyright (C) 2013 Romain Francois
4//
5// This file is part of Rcpp.
6//
7// Rcpp is free software: you can redistribute it and/or modify it
8// under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 2 of the License, or
10// (at your option) any later version.
11//
12// Rcpp is distributed in the hope that it will be useful, but
13// WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
19
20#ifndef Rcpp_api_meat_Module_h
21#define Rcpp_api_meat_Module_h
22
23namespace Rcpp {
24
26 size_t n = classes.size() ;
27 CharacterVector names(n) ;
28 List info(n);
29 CLASS_MAP::iterator it = classes.begin() ;
30 std::string buffer ;
31 for( size_t i=0; i<n; i++, ++it){
32 names[i] = it->first ;
33 info[i] = CppClass( this , it->second, buffer ) ;
34 }
35 info.names() = names ;
36 return info ;
37 }
38
39 inline CppClass Module::get_class( const std::string& cl ){
41 CLASS_MAP::iterator it = classes.find(cl) ;
42 if( it == classes.end() ) throw std::range_error( "no such class" ) ;
43 std::string buffer ;
44 return CppClass( this, it->second, buffer ) ;
46 }
47
48}
49
50#endif
CLASS_MAP classes
Definition Module.h:235
CppClass get_class(const std::string &cl)
Definition Module.h:39
List classes_info()
Definition Module.h:25
R_xlen_t size() const
Definition Vector.h:275
#define END_RCPP
Definition macros.h:99
#define BEGIN_RCPP
Definition macros.h:49
Rcpp API.
Definition algo.h:28
T as(SEXP x)
Definition as.h:151