Rcpp Version 1.0.9
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 29 of file Module.h.

Member Typedef Documentation

◆ CLASS_ITERATOR

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

Definition at line 36 of file Module.h.

◆ CLASS_MAP

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

Definition at line 34 of file Module.h.

◆ CLASS_PAIR

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

Definition at line 35 of file Module.h.

◆ FUNCTION_PAIR

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

Definition at line 32 of file Module.h.

◆ MAP

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

Definition at line 31 of file Module.h.

Constructor & Destructor Documentation

◆ Module() [1/2]

Rcpp::Module::Module ( )
inline

Definition at line 38 of file Module.h.

◆ Module() [2/2]

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

Definition at line 41 of file Module.h.

References name, and prefix.

Member Function Documentation

◆ Add()

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

Definition at line 192 of file Module.h.

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

Here is the call graph for this function:

◆ add_enum()

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 219 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:

◆ AddClass()

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

Definition at line 197 of file Module.h.

References classes.

◆ class_names()

CharacterVector Rcpp::Module::class_names ( )
inline

exposed class names

Definition at line 101 of file Module.h.

References classes.

◆ classes_info()

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().

Here is the call graph for this function:

◆ complete()

CharacterVector Rcpp::Module::complete ( )
inline

completion information

Definition at line 119 of file Module.h.

References classes, and functions.

◆ functions_arity()

IntegerVector Rcpp::Module::functions_arity ( )
inline

vector of arity of all the functions exported by the module

Definition at line 72 of file Module.h.

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

Here is the call graph for this function:

◆ functions_names()

CharacterVector Rcpp::Module::functions_names ( )
inline

vector of names of the functions

Definition at line 88 of file Module.h.

References functions.

◆ get_class()

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.

◆ get_class_pointer()

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

Definition at line 211 of file Module.h.

References classes.

◆ get_function()

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 154 of file Module.h.

References Rcpp::Vector< VECSXP >::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:

◆ get_function_ptr()

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 179 of file Module.h.

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

Here is the call graph for this function:

◆ has_class()

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

Definition at line 205 of file Module.h.

References classes.

◆ has_function()

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

Definition at line 201 of file Module.h.

References functions.

◆ invoke()

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 53 of file Module.h.

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

Here is the call graph for this function:

Member Data Documentation

◆ classes

CLASS_MAP Rcpp::Module::classes
private

◆ functions

MAP Rcpp::Module::functions
private

◆ name

std::string Rcpp::Module::name

Definition at line 217 of file Module.h.

Referenced by Module().

◆ prefix

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

Definition at line 236 of file Module.h.

Referenced by Add(), and Module().


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