Rcpp Version 0.12.12
Rcpp::Module Class Reference

#include <Module.h>

Public Types

typedef std::map< std::string, CppFunction * > MAP
 
typedef std::pair< const std::string, CppFunction * > FUNCTION_PAIR
 
typedef std::map< std::string, class_Base * > CLASS_MAP
 
typedef std::pair< const std::string, class_Base * > CLASS_PAIR
 
typedef CLASS_MAP::iterator CLASS_ITERATOR
 

Public Member Functions

 Module ()
 
 Module (const char *name_)
 
SEXP invoke (const std::string &name_, SEXP *args, int nargs)
 
IntegerVector functions_arity ()
 
CharacterVector functions_names ()
 
CharacterVector class_names ()
 
List classes_info ()
 
CharacterVector complete ()
 
SEXP get_function (const std::string &name_)
 
DL_FUNC get_function_ptr (const std::string &name_)
 
void Add (const char *name_, CppFunction *ptr)
 
void AddClass (const char *name_, class_Base *cptr)
 
bool has_function (const std::string &m)
 
bool has_class (const std::string &m)
 
CppClass get_class (const std::string &cl)
 
class_Baseget_class_pointer (const std::string &cl)
 
void add_enum (const std::string &parent_class_typeinfo_name, const std::string &enum_name, const std::map< std::string, int > &value)
 

Public Attributes

std::string name
 

Private Attributes

MAP functions
 
CLASS_MAP classes
 
std::string prefix
 

Detailed Description

holds information about exposed functions and classes

Definition at line 30 of file Module.h.

Member Typedef Documentation

typedef CLASS_MAP::iterator Rcpp::Module::CLASS_ITERATOR

Definition at line 37 of file Module.h.

typedef std::map<std::string,class_Base*> Rcpp::Module::CLASS_MAP

Definition at line 35 of file Module.h.

typedef std::pair<const std::string,class_Base*> Rcpp::Module::CLASS_PAIR

Definition at line 36 of file Module.h.

typedef std::pair<const std::string,CppFunction*> Rcpp::Module::FUNCTION_PAIR

Definition at line 33 of file Module.h.

typedef std::map<std::string,CppFunction*> Rcpp::Module::MAP

Definition at line 32 of file Module.h.

Constructor & Destructor Documentation

Rcpp::Module::Module ( )
inline

Definition at line 39 of file Module.h.

Rcpp::Module::Module ( const char *  name_)
inline

Definition at line 42 of file Module.h.

References name, and prefix.

Member Function Documentation

void Rcpp::Module::Add ( const char *  name_,
CppFunction ptr 
)
inline

Definition at line 193 of file Module.h.

References functions, Rcpp::CppFunction::get_function_ptr(), and prefix.

Here is the call graph for this function:

void Rcpp::Module::add_enum ( const std::string &  parent_class_typeinfo_name,
const std::string &  enum_name,
const std::map< std::string, int > &  value 
)
inline

Definition at line 220 of file Module.h.

References Rcpp::class_Base::add_enum(), and classes.

Referenced by Rcpp::enum_< Enum, Parent >::~enum_().

Here is the call graph for this function:

void Rcpp::Module::AddClass ( const char *  name_,
class_Base cptr 
)
inline

Definition at line 198 of file Module.h.

References classes.

CharacterVector Rcpp::Module::class_names ( )
inline

exposed class names

Definition at line 102 of file Module.h.

References classes, and classes_info().

Here is the call graph for this function:

List Rcpp::Module::classes_info ( )
inline

information about the classes

Definition at line 25 of file Module.h.

References classes, and Rcpp::NamesProxyPolicy< CLASS >::names().

Referenced by class_names().

Here is the call graph for this function:

CharacterVector Rcpp::Module::complete ( )
inline

completion information

Definition at line 120 of file Module.h.

References classes, and functions.

IntegerVector Rcpp::Module::functions_arity ( )
inline

vector of arity of all the functions exported by the module

Definition at line 73 of file Module.h.

References functions, and Rcpp::NamesProxyPolicy< CLASS >::names().

Here is the call graph for this function:

CharacterVector Rcpp::Module::functions_names ( )
inline

vector of names of the functions

Definition at line 89 of file Module.h.

References functions.

CppClass Rcpp::Module::get_class ( const std::string &  cl)
inline

Definition at line 39 of file Module.h.

References BEGIN_RCPP, classes, and END_RCPP.

Referenced by has_class().

class_Base* Rcpp::Module::get_class_pointer ( const std::string &  cl)
inline

Definition at line 212 of file Module.h.

References classes.

SEXP Rcpp::Module::get_function ( const std::string &  name_)
inline

Returns a list that contains:

  • an external pointer that encapsulates a CppFunction*
  • voidness of the function (logical)
  • docstring (character)
  • signature (character)
  • formal arguments of the function

The R code in Module.R uses this information to create a C++Function object

Definition at line 155 of file Module.h.

References Rcpp::Vector< RTYPE, StoragePolicy >::create(), Rcpp::CppFunction::docstring, functions, Rcpp::CppFunction::get_formals(), Rcpp::CppFunction::is_void(), Rcpp::CppFunction::nargs(), Rcpp::sign(), and Rcpp::CppFunction::signature().

Here is the call graph for this function:

DL_FUNC Rcpp::Module::get_function_ptr ( const std::string &  name_)
inline

get the underlying C++ function pointer as a DL_FUNC

Definition at line 180 of file Module.h.

References functions, and Rcpp::CppFunction::get_function_ptr().

Here is the call graph for this function:

bool Rcpp::Module::has_class ( const std::string &  m)
inline

Definition at line 206 of file Module.h.

References classes, and get_class().

Here is the call graph for this function:

bool Rcpp::Module::has_function ( const std::string &  m)
inline

Definition at line 202 of file Module.h.

References functions.

SEXP Rcpp::Module::invoke ( const std::string &  name_,
SEXP *  args,
int  nargs 
)
inline

calls a function from that module with the specified arguments

Parameters
namethe name of the function to call
argsan array of R objects to use as arguments for the function
nargsnumber of arguments

Definition at line 54 of file Module.h.

References Rcpp::_, Rcpp::Vector< RTYPE, StoragePolicy >::create(), functions, Rcpp::CppFunction::is_void(), and Rcpp::CppFunction::nargs().

Here is the call graph for this function:

Member Data Documentation

CLASS_MAP Rcpp::Module::classes
private
MAP Rcpp::Module::functions
private
std::string Rcpp::Module::name

Definition at line 218 of file Module.h.

Referenced by Module().

std::string Rcpp::Module::prefix
private

Definition at line 237 of file Module.h.

Referenced by Add(), and Module().


The documentation for this class was generated from the following file: