Rosetta  3.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Typedefs | Functions | Variables
binder Namespace Reference

Classes

class  Binder
 Bindings Generator - represent object that can generate binding info for function, class, enum or data variable. More...
 
class  ClassBinder
 
class  Config
 
class  Context
 Module - represent bindings of individual Python module. More...
 
class  EnumBinder
 
class  FunctionBinder
 
class  IncludeSet
 
class  map_binder
 
class  vector_binder
 

Typedefs

typedef std::shared_ptr< BinderBinderOP
 
typedef std::vector< BinderOPBinders
 

Functions

string template_specialization (clang::CXXRecordDecl const *C)
 
string class_name (CXXRecordDecl const *C)
 
string python_class_name (CXXRecordDecl const *C)
 
string class_qualified_name (CXXRecordDecl const *C)
 
vector< QualType > get_type_dependencies (CXXRecordDecl const *C)
 
bool is_inherited_from_enable_shared_from_this (CXXRecordDecl const *C)
 
bool is_field_assignable (FieldDecl const *f)
 
bool is_bindable (FieldDecl *f)
 check if generator can create binding More...
 
string bind_data_member (FieldDecl const *d, string const &class_qualified_name)
 
bool is_bindable (clang::CXXRecordDecl const *C)
 check if generator can create binding More...
 
bool is_binding_requested (clang::CXXRecordDecl const *C, Config const &config)
 check if user requested binding for the given declaration More...
 
bool is_skipping_requested (clang::CXXRecordDecl const *C, Config const &config)
 check if user requested skipping for the given declaration More...
 
void add_relevant_includes (clang::CXXRecordDecl const *C, IncludeSet &includes, int level)
 
bool base_default_default_constructor_available (CXXRecordDecl const *C)
 DEPRECATED Check if all bases have public default constructors. More...
 
string binding_public_data_members (CXXRecordDecl const *C)
 
bool is_const_overload (CXXMethodDecl *mc)
 
string callback_structure_name (CXXRecordDecl const *C)
 
bool is_callback_structure_needed (CXXRecordDecl const *C)
 
bool is_callback_structure_constructible (CXXRecordDecl const *C)
 
string bind_member_functions_for_call_back (CXXRecordDecl const *C, set< string > &binded, int &ret_id, std::vector< clang::FunctionDecl const * > &prefix_includes)
 
string binding_public_member_functions (CXXRecordDecl const *C, bool callback_structure, bool callback_structure_constructible, Context &context)
 
string binding_template_bases (CXXRecordDecl const *C, bool callback_structure, bool callback_structure_constructible, Context &context)
 
string bind_forward_declaration (CXXRecordDecl const *C, Context &context)
 Create forward-binding for given class which consist of only class type without any member, function or constructors. More...
 
string bind_constructor (CXXConstructorDecl const *T, pair< string, string > const &constructor_types, uint args_to_bind, bool request_bindings_f, Context &context)
 
string bind_constructor (CXXConstructorDecl const *T, pair< string, string > const &constructor_types, Context &context)
 
std::string class_name (clang::CXXRecordDecl const *C)
 
std::string class_qualified_name (clang::CXXRecordDecl const *C)
 
std::vector< clang::QualType > get_type_dependencies (clang::CXXRecordDecl const *C)
 
std::vector< clang::NamedDecl
const * > 
get_decl_dependencies (clang::CXXRecordDecl const *C)
 
std::string bind_forward_declaration (clang::CXXRecordDecl const *C, Context &)
 Create forward-binding for given class which consist of only class type without any member, function or constructors. More...
 
std::pair< string, string > split_in_two (string const &s, string const &error_string)
 Split string in two by ether space or tab character. More...
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &os, Binder const &b)
 
string generate_include_directives (IncludeSet const &include_set)
 
string file_name_prefix_for_binder (BinderOP &b)
 Generate file name where binding for given generator should be stored. More...
 
void add_relevant_includes (clang::EnumDecl const *E, IncludeSet &includes, int level)
 extract include needed for this generator and add it to includes vector More...
 
std::string bind_enum (std::string const &module, EnumDecl *E)
 
std::string bind_enum (std::string const &module, clang::EnumDecl *E)
 
string function_arguments (clang::FunctionDecl const *record)
 
pair< string, string > function_arguments_for_lambda (clang::FunctionDecl const *record, uint n)
 
tuple< string, string, string > function_arguments_for_py_overload (clang::FunctionDecl const *record)
 
string template_specialization (FunctionDecl const *F)
 
string python_function_name (FunctionDecl const *F)
 
string function_pointer_type (FunctionDecl const *F)
 
string function_qualified_name (FunctionDecl const *F)
 
vector< QualType > get_type_dependencies (FunctionDecl const *F)
 
bool is_binding_requested (FunctionDecl const *F, Config const &config)
 check if user requested binding for the given declaration More...
 
bool is_skipping_requested (FunctionDecl const *F, Config const &config)
 check if user requested skipping for the given declaration More...
 
string bind_function (FunctionDecl const *F, uint args_to_bind, bool request_bindings_f, Context &context)
 
string bind_function (string const &module, FunctionDecl const *F, Context &context)
 
void add_relevant_includes (FunctionDecl const *F, IncludeSet &includes, int level)
 extract include needed for this generator and add it to includes vector More...
 
bool is_bindable (FunctionDecl const *F)
 check if generator can create binding More...
 
std::string python_function_name (clang::FunctionDecl const *F)
 
std::string function_pointer_type (clang::FunctionDecl const *record)
 
std::string function_qualified_name (clang::FunctionDecl const *F)
 
bool is_binding_requested (clang::FunctionDecl const *F, Config const &config)
 check if user requested binding for the given declaration More...
 
bool is_skipping_requested (clang::FunctionDecl const *F, Config const &config)
 check if user requested skipping for the given declaration More...
 
std::string bind_function (std::string const &module, clang::FunctionDecl const *F, Context &)
 
void add_relevant_includes (clang::FunctionDecl const *F, IncludeSet &includes, int level)
 extract include needed for this generator and add it to includes vector More...
 
bool is_bindable (clang::FunctionDecl const *F)
 check if generator can create binding More...
 
bool is_binding_requested (clang::QualType const &qt, Config const &config)
 check if user requested binding for the given QualType More...
 
bool is_skipping_requested (QualType const &qt, Config const &config)
 
string relevant_include (NamedDecl const *decl)
 
void add_relevant_include_for_decl (NamedDecl const *decl, IncludeSet &includes)
 
void add_relevant_includes (QualType const &qt, IncludeSet &includes, int level)
 extract include needed for this generator and add it to includes vector More...
 
bool is_bindable (QualType const &qt)
 
void request_bindings (clang::QualType const &qt, Context &context)
 extract type info from QualType if any and bind relative type More...
 
string standard_name (string const &type)
 
bool is_python_builtin (NamedDecl const *C)
 check if given class/struct is builtin in Python and therefor should not be binded More...
 
bool is_skipping_requested (clang::QualType const &qt, Config const &config)
 check if user requested skipping for the given QualType More...
 
std::string relevant_include (clang::NamedDecl const *decl)
 
void add_relevant_include_for_decl (clang::NamedDecl const *decl, IncludeSet &includes)
 
void add_relevant_includes (clang::QualType const &qt, IncludeSet &includes, int level)
 extract include needed for this generator and add it to includes vector More...
 
bool is_bindable (clang::QualType const &qt)
 
bool is_python_builtin (clang::NamedDecl const *C)
 check if given class/struct is builtin in Python and therefor should not be binded More...
 
vector< string > split (string const &buffer, string const &separator)
 Split string using given separator. More...
 
void replace (string &r, string const &from, string const &to)
 Replace all occurrences of string. More...
 
string replace_ (string const &s, string const &from, string const &to)
 Replace all occurrences of string and return result as new string. More...
 
bool begins_with (std::string const &source, std::string const &prefix)
 check if string begins with given prefix More...
 
bool ends_with (std::string const &source, std::string const &prefix)
 check if string ends with given prefix More...
 
string indent (std::string const &code, std::string const &indentation)
 indent given code More...
 
void update_source_file (std::string const &prefix, std::string const &file_name, std::string const &code)
 Try to read exisitng file and if content does not match to code - write a new version. Also create nested dirs starting from prefix if nessesary. More...
 
string namespace_from_named_decl (NamedDecl const *decl)
 
string typename_from_type_decl (TypeDecl *decl)
 generate unique string representation of type represented by given declaration More...
 
string base_namespace (string const &ns)
 Calculate base (upper) namespace for given one: core::pose::motif –> core::pose. More...
 
string last_namespace (string const &ns)
 Calculate last namespace for given one: core::pose::motif –> motif. More...
 
void fix_boolean_types (std::string &type)
 replace all _Bool types with bool More...
 
string expresion_to_string (clang::Expr *e)
 Generate string representation of given expression. More...
 
string template_argument_to_string (clang::TemplateArgument const &)
 Generate string representation of given TemplateArgument. More...
 
string line_number (NamedDecl const *decl)
 
string mangle_type_name (string const &name, bool mark_template)
 
string generate_comment_for_declaration (clang::NamedDecl const *decl)
 
string get_text (comments::Comment const *C, SourceManager const &SM, SourceLocation previous)
 
std::string generate_documentation_string_for_declaration (clang::Decl const *decl)
 
std::string namespace_from_named_decl (clang::NamedDecl const *decl)
 calculate namespace path from given NamedDecl, like: std, core::pose More...
 
std::string typename_from_type_decl (clang::TypeDecl *decl)
 
std::string line_number (clang::NamedDecl const *decl)
 calcualte line in source file for NamedDecl More...
 

Variables

const char * call_back_function_body_template
 
char const * constructor_template = "\tcl.def(\"__init__\", []({2} *self_{0}) {{ new (self_) {2}({1}); }}, \"doc\");"
 
char const * constructor_if_template = "\tcl.def(\"__init__\", [cl_type](pybind11::handle self_{0}) {{ if (self_.get_type() == cl_type) new (self_.cast<{2} *>()) {2}({1}); else new (self_.cast<{3} *>()) {3}({1}); }}, \"doc\");"
 
const char * main_module_header
 
const char * module_header = "\n#include <pybind11/pybind11.h>\n\n{}#ifndef BINDER_PYBIND11_TYPE_CASTER\n\t#define BINDER_PYBIND11_TYPE_CASTER\n\tPYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);\n#endif\n\n"
 
const char * module_function_suffix = "(std::function< pybind11::module &(std::string const &namespace_) > &M)"
 
static std::map< string,
string > const 
cpp_python_operator_map
 

Typedef Documentation

typedef std::shared_ptr< Binder > binder::BinderOP

Function Documentation

void binder::add_relevant_include_for_decl ( clang::NamedDecl const *  decl,
IncludeSet &  includes 
)
void binder::add_relevant_include_for_decl ( NamedDecl const *  decl,
IncludeSet &  includes 
)
void binder::add_relevant_includes ( clang::EnumDecl const *  E,
IncludeSet &  includes,
int  level 
)

extract include needed for this generator and add it to includes vector

References binder::IncludeSet::add_decl(), and add_relevant_include_for_decl().

void binder::add_relevant_includes ( clang::QualType const &  qt,
IncludeSet &  includes,
int  level 
)

extract include needed for this generator and add it to includes vector

void binder::add_relevant_includes ( clang::FunctionDecl const *  F,
IncludeSet &  includes,
int  level 
)

extract include needed for this generator and add it to includes vector

void binder::add_relevant_includes ( QualType const &  qt,
IncludeSet &  includes,
int  level 
)

extract include needed for this generator and add it to includes vector

References basic::options::OptionKeys::out::level.

void binder::add_relevant_includes ( clang::CXXRecordDecl const *  C,
IncludeSet &  includes,
int  level 
)
void binder::add_relevant_includes ( FunctionDecl const *  F,
IncludeSet &  includes,
int  level 
)

extract include needed for this generator and add it to includes vector

References binder::IncludeSet::add_decl(), add_relevant_include_for_decl(), add_relevant_includes(), get_type_dependencies(), and basic::options::OptionKeys::in::file::t.

bool binder::base_default_default_constructor_available ( CXXRecordDecl const *  C)

DEPRECATED Check if all bases have public default constructors.

References basic::options::OptionKeys::score::fiber_diffraction::b, and basic::options::OptionKeys::in::file::t.

Referenced by binder::ClassBinder::bind().

std::string binder::base_namespace ( string const &  ns)

Calculate base (upper) namespace for given one: core::pose::motif –> core::pose.

References demo.D060_Folding::f.

Referenced by binder::Context::create_all_nested_namespaces(), and binder::Context::generate().

bool binder::begins_with ( std::string const &  source,
std::string const &  prefix 
)
string binder::bind_constructor ( CXXConstructorDecl const *  T,
pair< string, string > const &  constructor_types,
uint  args_to_bind,
bool  request_bindings_f,
Context &  context 
)
string binder::bind_constructor ( CXXConstructorDecl const *  T,
pair< string, string > const &  constructor_types,
Context &  context 
)
string binder::bind_data_member ( FieldDecl const *  d,
string const &  class_qualified_name 
)
std::string binder::bind_enum ( std::string const &  module,
clang::EnumDecl *  E 
)
std::string binder::bind_enum ( std::string const &  module,
EnumDecl *  E 
)
std::string binder::bind_forward_declaration ( clang::CXXRecordDecl const *  C,
Context &   
)

Create forward-binding for given class which consist of only class type without any member, function or constructors.

string binder::bind_forward_declaration ( CXXRecordDecl const *  C,
Context &  context 
)

Create forward-binding for given class which consist of only class type without any member, function or constructors.

References class_qualified_name(), is_inherited_from_enable_shared_from_this(), line_number(), binder::Context::module_variable_name(), namespace_from_named_decl(), python_class_name(), and relevant_include().

std::string binder::bind_function ( std::string const &  module,
clang::FunctionDecl const *  F,
Context &   
)
string binder::bind_function ( FunctionDecl const *  F,
uint  args_to_bind,
bool  request_bindings_f,
Context &  context 
)
string binder::bind_function ( string const &  module,
FunctionDecl const *  F,
Context &  context 
)
string binder::bind_member_functions_for_call_back ( CXXRecordDecl const *  C,
set< string > &  binded,
int ret_id,
std::vector< clang::FunctionDecl const * > &  prefix_includes 
)
string binder::binding_public_data_members ( CXXRecordDecl const *  C)
string binder::binding_public_member_functions ( CXXRecordDecl const *  C,
bool  callback_structure,
bool  callback_structure_constructible,
Context &  context 
)
string binder::binding_template_bases ( CXXRecordDecl const *  C,
bool  callback_structure,
bool  callback_structure_constructible,
Context &  context 
)
string binder::callback_structure_name ( CXXRecordDecl const *  C)
inline
std::string binder::class_name ( clang::CXXRecordDecl const *  C)
string binder::class_name ( CXXRecordDecl const *  C)
std::string binder::class_qualified_name ( clang::CXXRecordDecl const *  C)
string binder::class_qualified_name ( CXXRecordDecl const *  C)
bool binder::ends_with ( std::string const &  source,
std::string const &  prefix 
)

check if string ends with given prefix

References basic::options::OptionKeys::antibody::prefix.

Referenced by is_const_overload().

std::string binder::expresion_to_string ( clang::Expr *  e)

Generate string representation of given expression.

References basic::options::OptionKeys::in::file::s.

string binder::file_name_prefix_for_binder ( BinderOP &  b)

Generate file name where binding for given generator should be stored.

References begins_with(), namespace_from_named_decl(), relevant_include(), and replace().

Referenced by binder::Context::generate().

void binder::fix_boolean_types ( string &  type)
std::string binder::function_arguments ( clang::FunctionDecl const *  record)
std::pair< std::string, std::string > binder::function_arguments_for_lambda ( clang::FunctionDecl const *  record,
uint  n 
)
std::tuple< std::string, std::string, std::string > binder::function_arguments_for_py_overload ( clang::FunctionDecl const *  record)
std::string binder::function_pointer_type ( clang::FunctionDecl const *  record)
string binder::function_pointer_type ( FunctionDecl const *  F)
std::string binder::function_qualified_name ( clang::FunctionDecl const *  F)
string binder::function_qualified_name ( FunctionDecl const *  F)
std::string binder::generate_comment_for_declaration ( clang::NamedDecl const *  decl)
std::string binder::generate_documentation_string_for_declaration ( clang::Decl const *  decl)
string binder::generate_include_directives ( IncludeSet const &  include_set)
std::vector<clang::NamedDecl const *> binder::get_decl_dependencies ( clang::CXXRecordDecl const *  C)
string binder::get_text ( comments::Comment const *  C,
SourceManager const &  SM,
SourceLocation  previous 
)
std::vector<clang::QualType> binder::get_type_dependencies ( clang::CXXRecordDecl const *  C)
vector<QualType> binder::get_type_dependencies ( CXXRecordDecl const *  C)
vector<QualType> binder::get_type_dependencies ( FunctionDecl const *  F)
std::string binder::indent ( string const &  code,
string const &  indentation 
)
bool binder::is_bindable ( clang::QualType const &  qt)
bool binder::is_bindable ( clang::FunctionDecl const *  F)

check if generator can create binding

bool binder::is_bindable ( FieldDecl *  f)
bool binder::is_bindable ( clang::CXXRecordDecl const *  C)
bool binder::is_bindable ( QualType const &  qt)

References begins_with(), and standard_name().

bool binder::is_bindable ( FunctionDecl const *  F)
bool binder::is_binding_requested ( clang::QualType const &  qt,
Config const &  config 
)

check if user requested binding for the given QualType

References basic::options::OptionKeys::frags::scoring::config.

bool binder::is_binding_requested ( clang::FunctionDecl const *  F,
Config const &  config 
)

check if user requested binding for the given declaration

bool binder::is_binding_requested ( FunctionDecl const *  F,
Config const &  config 
)
bool binder::is_binding_requested ( clang::CXXRecordDecl const *  C,
Config const &  config 
)
bool binder::is_callback_structure_constructible ( CXXRecordDecl const *  C)
bool binder::is_callback_structure_needed ( CXXRecordDecl const *  C)
bool binder::is_const_overload ( CXXMethodDecl *  mc)
bool binder::is_field_assignable ( FieldDecl const *  f)

References C.

Referenced by is_bindable().

bool binder::is_inherited_from_enable_shared_from_this ( CXXRecordDecl const *  C)
bool binder::is_python_builtin ( clang::NamedDecl const *  C)

check if given class/struct is builtin in Python and therefor should not be binded

bool binder::is_python_builtin ( NamedDecl const *  C)

check if given class/struct is builtin in Python and therefor should not be binded

References begins_with(), name, and standard_name().

Referenced by is_bindable(), binder::Binder::is_binded(), binder::Context::is_forward_needed(), and binder::Context::request_bindings().

bool binder::is_skipping_requested ( clang::QualType const &  qt,
Config const &  config 
)

check if user requested skipping for the given QualType

bool binder::is_skipping_requested ( QualType const &  qt,
Config const &  config 
)
bool binder::is_skipping_requested ( clang::FunctionDecl const *  F,
Config const &  config 
)

check if user requested skipping for the given declaration

bool binder::is_skipping_requested ( FunctionDecl const *  F,
Config const &  config 
)
bool binder::is_skipping_requested ( clang::CXXRecordDecl const *  C,
Config const &  config 
)
std::string binder::last_namespace ( string const &  ns)

Calculate last namespace for given one: core::pose::motif –> motif.

References demo.D060_Folding::f.

Referenced by binder::Context::generate().

std::string binder::line_number ( clang::NamedDecl const *  decl)

calcualte line in source file for NamedDecl

string binder::line_number ( NamedDecl const *  decl)
std::string binder::mangle_type_name ( string const &  name,
bool  mark_template 
)
std::string binder::namespace_from_named_decl ( clang::NamedDecl const *  decl)

calculate namespace path from given NamedDecl, like: std, core::pose

string binder::namespace_from_named_decl ( NamedDecl const *  decl)
llvm::raw_ostream & binder::operator<< ( llvm::raw_ostream &  os,
Binder const &  b 
)
string binder::python_class_name ( CXXRecordDecl const *  C)
std::string binder::python_function_name ( clang::FunctionDecl const *  F)
string binder::python_function_name ( FunctionDecl const *  F)
std::string binder::relevant_include ( clang::NamedDecl const *  decl)
string binder::relevant_include ( NamedDecl const *  decl)
void binder::replace ( string &  r,
string const &  from,
string const &  to 
)
std::string binder::replace_ ( string const &  s,
string const &  from,
string const &  to 
)

Replace all occurrences of string and return result as new string.

References replace().

Referenced by binder::Context::generate().

void binder::request_bindings ( clang::QualType const &  qt,
Context &  context 
)
std::vector< std::string > binder::split ( string const &  buffer,
string const &  separator 
)

Split string using given separator.

References line, and clean_pdb_keep_ligand::lines.

Referenced by app.pyrosetta_toolkit.modules.prettytable.prettytable.PrettyTable::_stringify_row(), BuildBindings::buildModule_All(), BuildBindings::buildModule_One(), app.pyrosetta_toolkit.modules.DesignBreakdown.DesignBreakdown::calculate_results(), BuildBindings::calculate_source_modification_date(), app.pyrosetta_toolkit.window_modules.design.ResfileDesignWindow.ResfileDesignWindow::check_for_residue_existance(), app.pyrosetta_toolkit.modules.tools.output::convert_PDBLIST_to_sqlite3db(), app.pyrosetta_toolkit.modules.ScoreAnalysis.ScoreAnalysis::copy_results(), arls_impl::find_programs(), build::generate_bindings(), build::generate_rosetta_external_cmake_files(), BuildBindings::get_all_rosetta_objs(), BuildBindings::get_compiler_defines(), toolbox.adjust_library_path::get_current_dylib_path(), build::get_rosetta_include_directories(), build::get_rosetta_system_include_directories(), app.pyrosetta_toolkit.modules.tools.interfaces.Antibodies::getContactCDRs(), PhiPsi::hbond_record(), indent(), exclude::isFileInScons(), tools.CppParser.CppClass::isPublicMembersWrappable(), best_ifaceE::main(), get_scores::main(), prune_atdiff_top5pct::main(), BuildBindings::main(), app.pyrosetta_toolkit.window_modules.design.ResfileDesignWindow.ResfileDesignWindow::nextRes(), app.pyrosetta_toolkit.window_modules.ligand_ncaa_ptm_manager.ligand_ncaa_ptm_manager.ligand_ncaa_ptm_manager::open_param_or_patch(), app.pyrosetta_toolkit.modules.tools.output::output_molfile_to_params(), tools.CppParser.GccXML::parse(), app.pyrosetta_toolkit.window_modules.scorefunction.ScoreFxnControl.ScoreFxnControl::populateScoreList(), app.pyrosetta_toolkit.window_modules.design.ResfileDesignWindow.ResfileDesignWindow::prevRes(), app.pyrosetta_toolkit.modules.ScoreAnalysis.ScoreAnalysis::read_FASC(), app.pyrosetta_toolkit.modules.ScoreAnalysis.ScoreAnalysis::read_SC(), register_options(), app.pyrosetta_toolkit.window_modules.design.ResfileDesignWindow.ResfileDesignWindow::remove_from_current_designs_callback(), app.pyrosetta_toolkit.modules.tools.general_tools::renameandsave(), app.pyrosetta_toolkit.modules.calibur.calibur::ret_centers(), app.pyrosetta_toolkit.modules.tools.loops::return_residue_array(), run(), self-test::run_test(), demo.D090_Ala_scan::scanning_analysis(), app.pyrosetta_toolkit.window_main.frames.SimpleAnalysisFrame.SimpleAnalysisFrame::score_loops(), split_in_two(), update_source_file(), app.pyrosetta_toolkit.window_modules.design.ResfileDesignWindow.ResfileDesignWindow::updateInfo(), BuildBindings::windows_buildOneNamespace(), and tools.CppParser::wrapModule().

std::pair<string, string> binder::split_in_two ( string const &  s,
string const &  error_string 
)

Split string in two by ether space or tab character.

References min(), ObjexxFCL::space(), and split().

Referenced by binder::Config::read().

std::string binder::standard_name ( string const &  type)
std::string binder::template_argument_to_string ( clang::TemplateArgument const &  t)

Generate string representation of given TemplateArgument.

References basic::options::OptionKeys::in::file::s.

Referenced by binder::ClassBinder::bind_with(), and template_specialization().

std::string binder::template_specialization ( clang::CXXRecordDecl const *  C)
string binder::template_specialization ( FunctionDecl const *  F)
std::string binder::typename_from_type_decl ( clang::TypeDecl *  decl)
string binder::typename_from_type_decl ( TypeDecl *  decl)

generate unique string representation of type represented by given declaration

References standard_name().

Referenced by binder::Context::add(), and request_bindings().

void binder::update_source_file ( std::string const &  prefix,
std::string const &  file_name,
std::string const &  code 
)

Try to read exisitng file and if content does not match to code - write a new version. Also create nested dirs starting from prefix if nessesary.

References demo.D060_Folding::f, basic::options::OptionKeys::in::path::path, basic::options::OptionKeys::antibody::prefix, and split().

Referenced by binder::Context::generate().

Variable Documentation

const char* binder::call_back_function_body_template
Initial value:
= R"_(
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(this, "{}");
if (overload) return overload.operator()<pybind11::return_value_policy::reference>({}).cast<{}>();
)_"

Referenced by bind_member_functions_for_call_back().

char const* binder::constructor_if_template = "\tcl.def(\"__init__\", [cl_type](pybind11::handle self_{0}) {{ if (self_.get_type() == cl_type) new (self_.cast<{2} *>()) {2}({1}); else new (self_.cast<{3} *>()) {3}({1}); }}, \"doc\");"

Referenced by bind_constructor().

char const* binder::constructor_template = "\tcl.def(\"__init__\", []({2} *self_{0}) {{ new (self_) {2}({1}); }}, \"doc\");"

Referenced by bind_constructor().

std::map<string, string > const binder::cpp_python_operator_map
static
Initial value:
{
{"operator+", "__add__"},
{"operator-", "__sub__"},
{"operator*=", "__imul__"},
{"operator/=", "__idiv__"},
{"operator()", "__call__"},
{"operator==", "__eq__"},
{"operator!=", "__ne__"},
{"operator[]", "__getitem__"},
{"operator=", "assign"},
{"operator++", "plus_plus"},
{"operator--", "minus_minus"},
}

Referenced by is_bindable(), and python_function_name().

const char* binder::main_module_header
Initial value:
= R"_(#include <map>
#include <memory>
#include <stdexcept>
#include <functional>
#include <pybind11/pybind11.h>
typedef std::function< pybind11::module & (std::string const &) > ModuleGetter;
{0}
PYBIND11_PLUGIN({1}) {{
std::map <std::string, std::shared_ptr<pybind11::module> > modules;
ModuleGetter M = [&](std::string const &namespace_) -> pybind11::module & {{
auto it = modules.find(namespace_);
if( it == modules.end() ) throw std::runtime_error("Attempt to access pybind11::module for namespace " + namespace_ + " before it was created!!!");
return * it->second;
}};
modules[""] = std::make_shared<pybind11::module>("{1}", "{1} module");
std::vector< std::pair<std::string, std::string> > sub_modules {{
{2} }};
for(auto &p : sub_modules ) modules[p.first.size() ? p.first+"::"+p.second : p.second] = std::make_shared<pybind11::module>( modules[p.first]->def_submodule(p.second.c_str(), ("Bindings for " + p.first + "::" + p.second + " namespace").c_str() ) );
{3}
return modules[""]->ptr();
}}
)_"

Referenced by binder::Context::generate().

const char* binder::module_function_suffix = "(std::function< pybind11::module &(std::string const &namespace_) > &M)"
const char* binder::module_header = "\n#include <pybind11/pybind11.h>\n\n{}#ifndef BINDER_PYBIND11_TYPE_CASTER\n\t#define BINDER_PYBIND11_TYPE_CASTER\n\tPYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);\n#endif\n\n"