Rosetta
Classes | Typedefs | Functions | Variables
binder Namespace Reference

Classes

class  IncludeSet
 
class  Binder
 Bindings Generator - represent object that can generate binding info for function, class, enum or data variable. More...
 
struct  ConstructorBindingInfo
 
class  ClassBinder
 
class  Config
 
class  Context
 Context - root, hold bindings info for whole TranslationUnit. More...
 
class  EnumBinder
 
class  FunctionBinder
 
class  vector_binder
 
class  map_binder
 

Typedefs

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

Functions

llvm::raw_ostream & operator<< (llvm::raw_ostream &os, Binder const &b)
 
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_const_overload (CXXMethodDecl *mc)
 
bool is_std_function_bindable (CXXRecordDecl const *C)
 
bool is_bindable_raw (clang::CXXRecordDecl const *C)
 check if generator can create binding More...
 
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)
 
void add_includes_to_set (std::vector< std::string > const &from, IncludeSet &to)
 
void add_relevant_includes_cached (clang::CXXRecordDecl const *C, IncludeSet &includes)
 
bool base_default_default_constructor_available (CXXRecordDecl const *C)
 DEPRECATED Check if all bases have public default constructors. More...
 
string generate_opaque_declaration_if_needed (string const &qualified_name, string const &qualified_name_without_template)
 
string binding_public_data_members (CXXRecordDecl const *C)
 
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, string const &class_name, 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 (ConstructorBindingInfo const &CBI, uint args_to_bind, bool request_bindings_f)
 
string bind_default_constructor (ConstructorBindingInfo const &CBI)
 Generate code for binding default constructor. More...
 
string bind_copy_constructor (ConstructorBindingInfo const &CBI)
 
string bind_constructor (ConstructorBindingInfo const &CBI)
 
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 forward declared class (no class members given) 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...
 
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...
 
bool is_bindable (EnumDecl const *E)
 check if generator can create binding More...
 
bool is_binding_requested (clang::EnumDecl const *E, Config const &config)
 check if user requested binding for the given declaration More...
 
bool is_skipping_requested (clang::EnumDecl const *E, Config const &config)
 check if user requested skipping for the given declaration More...
 
std::string getQualifiedNameAsStringLLVM5Fix (NamedDecl const *E)
 
std::string bind_enum (std::string const &module, EnumDecl const *E)
 
bool is_bindable (clang::EnumDecl const *E)
 check if generator can create binding More...
 
std::string bind_enum (std::string const &module, clang::EnumDecl const *E)
 
string cpp_python_operator (const FunctionDecl &F)
 
string function_arguments (clang::FunctionDecl const *record)
 Generate function argument list separated by comma. More...
 
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, bool omit_return_type)
 
vector< QualType > get_type_dependencies (FunctionDecl const *F)
 generate human redable C++ type signature for given function More...
 
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, CXXRecordDecl const *parent, bool always_use_lambda)
 
string bind_function (string const &module, FunctionDecl const *F, Context &context, CXXRecordDecl const *parent, bool always_use_lambda)
 
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_raw (FunctionDecl const *F)
 check if generator can create binding More...
 
bool is_bindable (FunctionDecl const *F)
 check if generator can create binding More...
 
bool is_overloadable (CXXMethodDecl const *M)
 check if methods could be overload in Python More...
 
std::string python_function_name (clang::FunctionDecl const *F)
 generate string representing class name that could be used in python More...
 
std::string function_pointer_type (clang::FunctionDecl const *record)
 Generate function pointer type string for given function. Example void (*)(int, doule)_ or void (ClassName::*)(int, doule)_ for memeber function. More...
 
std::string function_qualified_name (clang::FunctionDecl const *F, bool omit_return_type=false)
 generate qualified function name that could be used in bindings code including template specialization if any More...
 
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 &, clang::CXXRecordDecl const *parent=nullptr, bool always_use_lambda=false)
 
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_overloadable (clang::CXXMethodDecl const *M)
 check if methods could be overload in Python 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)
 
bool is_function_type (QualType const &qt)
 
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_raw (string const &type)
 
string standard_name (std::string const &type)
 transform give type name to standard form More...
 
string simplify_std_class_name_raw (string const &type)
 Attempt to simplify std:: name by removing unneded template arguments. Function assume that there is no 'std::' namespaces prefix at the beginning of the argument string. More...
 
string simplify_std_class_name (string const &type)
 Attempt to simplify std:: name by removing unneded template arguments. Function assume that there is no 'std::' namespaces prefix at the beginning of the argument string. More...
 
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_banned_symbol (clang::NamedDecl const *D)
 check if class/struct/function/enum is in banned symbol lists More...
 
bool is_skipping_requested (clang::QualType const &qt, Config const &config)
 check if user requested skipping for the given QualType More...
 
bool is_function_type (clang::QualType const &qt)
 
std::string relevant_include (clang::NamedDecl const *decl)
 extract include path needed for declaration itself (without template dependency if any), return empty string if no include could be found More...
 
void add_relevant_include_for_decl (clang::NamedDecl const *decl, IncludeSet &includes)
 extract include path needed for declaration itself (without template dependency if any), do nothing if include could not be found (ie for build-in's) More...
 
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)
 check if given QualType is bindable More...
 
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_reverse (string &r, string const &from, string const &to)
 Replace all occurrences of string. More...
 
void replace (std::string &r, std::string const &from, std::string const &to)
 Replace all occurrences of string in-place. 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...
 
std::string trim (std::string const &s)
 remove leading and trailing tabs and spaces 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 const *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 (std::string const &name, bool mark_template=true)
 generate string represeting class name that could be used in python More...
 
string generate_comment_for_declaration (clang::NamedDecl const *decl)
 generate C++ comment line for given declaration along with file path and line number More...
 
string get_text (comments::Comment const *C, SourceManager const &SM, SourceLocation previous)
 
std::string generate_documentation_string_for_declaration (clang::Decl const *)
 extract doc string (Doxygen comments) for given declaration and convert it to C++ code More...
 
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 const *decl)
 
std::string line_number (clang::NamedDecl const *decl)
 calculate line in source file for NamedDecl More...
 

Variables

const char * call_back_function_body_template
 
char const * constructor_template = "\tcl.def( pybind11::init( []({0}){{ return new {2}({1}); }} ), \"doc\");"
 
char const * constructor_template_with_py_arg = "\tcl.def( pybind11::init( []({0}){{ return new {2}({1}); }} ), \"doc\" {3});"
 
char const * constructor_with_trampoline_template = "\tcl.def( pybind11::init( []({0}){{ return new {2}({1}); }}, []({0}){{ return new {3}({1}); }} ), \"doc\");"
 

Typedef Documentation

◆ BinderOP

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

◆ Binders

typedef std::vector<BinderOP> binder::Binders

Function Documentation

◆ add_includes_to_set()

void binder::add_includes_to_set ( std::vector< std::string > const &  from,
IncludeSet to 
)
inline

◆ add_relevant_include_for_decl() [1/2]

void binder::add_relevant_include_for_decl ( clang::NamedDecl const *  decl,
IncludeSet includes 
)

extract include path needed for declaration itself (without template dependency if any), do nothing if include could not be found (ie for build-in's)

◆ add_relevant_include_for_decl() [2/2]

void binder::add_relevant_include_for_decl ( NamedDecl const *  decl,
IncludeSet includes 
)

◆ add_relevant_includes() [1/6]

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

◆ add_relevant_includes() [2/6]

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(), add_relevant_include_for_decl(), ObjexxFCL::format::E(), and basic::options::OptionKeys::out::level.

◆ add_relevant_includes() [3/6]

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

◆ add_relevant_includes() [4/6]

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

◆ add_relevant_includes() [5/6]

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

◆ add_relevant_includes() [6/6]

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 test.T009_Exceptions::e, basic::options::OptionKeys::out::level, and create_a3b_hbs::r.

◆ add_relevant_includes_cached()

void binder::add_relevant_includes_cached ( clang::CXXRecordDecl const *  C,
IncludeSet includes 
)

◆ base_default_default_constructor_available()

bool binder::base_default_default_constructor_available ( CXXRecordDecl const *  C)

DEPRECATED Check if all bases have public default constructors.

References compute_difference::b, C, docking::R, and predPRE::t.

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

◆ base_namespace()

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

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

References create_a3b_hbs::f.

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

◆ begins_with()

bool binder::begins_with ( std::string const &  source,
std::string const &  prefix 
)

◆ bind_constructor() [1/2]

string binder::bind_constructor ( ConstructorBindingInfo const &  CBI)

◆ bind_constructor() [2/2]

string binder::bind_constructor ( ConstructorBindingInfo const &  CBI,
uint  args_to_bind,
bool  request_bindings_f 
)

◆ bind_copy_constructor()

string binder::bind_copy_constructor ( ConstructorBindingInfo const &  CBI)

Generate copy constructor in most cases this will be just: "\tcl.def(pybind11::init<{} const &>());\n"_format(binding_qualified_name); but for POD structs with zero data mambers this will be a lambda function. This is done as a workaround for Pybind11 2,2+ bug

References binder::ConstructorBindingInfo::C, binder::ConstructorBindingInfo::class_qualified_name, binder::ConstructorBindingInfo::T, binder::ConstructorBindingInfo::trampoline, and binder::ConstructorBindingInfo::trampoline_qualified_name.

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

◆ bind_data_member()

string binder::bind_data_member ( FieldDecl const *  d,
string const &  class_qualified_name_ 
)

◆ bind_default_constructor()

string binder::bind_default_constructor ( ConstructorBindingInfo const &  CBI)

◆ bind_enum() [1/2]

std::string binder::bind_enum ( std::string const &  module,
clang::EnumDecl const *  E 
)

◆ bind_enum() [2/2]

std::string binder::bind_enum ( std::string const &  module,
EnumDecl const *  E 
)

◆ bind_forward_declaration() [1/2]

std::string binder::bind_forward_declaration ( clang::CXXRecordDecl const *  C,
Context  
)

Create forward-binding for forward declared class (no class members given)

◆ bind_forward_declaration() [2/2]

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

◆ bind_function() [1/3]

string binder::bind_function ( FunctionDecl const *  F,
uint  args_to_bind,
bool  request_bindings_f,
Context context,
CXXRecordDecl const *  parent,
bool  always_use_lambda 
)

◆ bind_function() [2/3]

std::string binder::bind_function ( std::string const &  module,
clang::FunctionDecl const *  F,
Context ,
clang::CXXRecordDecl const *  parent = nullptr,
bool  always_use_lambda = false 
)

◆ bind_function() [3/3]

string binder::bind_function ( string const &  module,
FunctionDecl const *  F,
Context context,
CXXRecordDecl const *  parent,
bool  always_use_lambda 
)

◆ bind_member_functions_for_call_back()

string binder::bind_member_functions_for_call_back ( CXXRecordDecl const *  C,
string const &  class_name,
set< string > &  binded,
int &  ret_id,
std::vector< clang::FunctionDecl const * > &  prefix_includes_ 
)

◆ binding_public_data_members()

string binder::binding_public_data_members ( CXXRecordDecl const *  C)

◆ binding_public_member_functions()

string binder::binding_public_member_functions ( CXXRecordDecl const *  C,
bool  callback_structure,
bool  callback_structure_constructible,
Context context 
)

◆ binding_template_bases()

string binder::binding_template_bases ( CXXRecordDecl const *  C,
bool  callback_structure,
bool  callback_structure_constructible,
Context context 
)

◆ callback_structure_name()

string binder::callback_structure_name ( CXXRecordDecl const *  C)
inline

◆ class_name() [1/2]

std::string binder::class_name ( clang::CXXRecordDecl const *  C)

◆ class_name() [2/2]

string binder::class_name ( CXXRecordDecl const *  C)

◆ class_qualified_name() [1/2]

std::string binder::class_qualified_name ( clang::CXXRecordDecl const *  C)

◆ class_qualified_name() [2/2]

string binder::class_qualified_name ( CXXRecordDecl const *  C)

◆ cpp_python_operator()

string binder::cpp_python_operator ( const FunctionDecl &  F)

◆ ends_with()

bool binder::ends_with ( std::string const &  source,
std::string const &  prefix 
)

check if string ends with given prefix

References create_a3b_hbs::prefix.

Referenced by bind_data_member().

◆ expresion_to_string()

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

Generate string representation of given expression.

References kmeans_adaptive_kernel_density_bb_dependent_rotlib::_, test.T009_Exceptions::e, and docking::s.

◆ fix_boolean_types()

void binder::fix_boolean_types ( string &  type)

◆ function_arguments()

std::string binder::function_arguments ( clang::FunctionDecl const *  record)

◆ function_arguments_for_lambda()

std::pair< std::string, std::string > binder::function_arguments_for_lambda ( clang::FunctionDecl const *  record,
uint  n 
)

Generate function argument list separated by comma name_arguments - if arguments should be named: a1, a2, ... n - number of arguments to generate. If n > num_of_function_parameters - generate only list with num_of_function_parameters

References a, fix_boolean_types(), create_a3b_hbs::i, kmeans_adaptive_kernel_density_bb_dependent_rotlib::n, create_a3b_hbs::r, standard_name(), and numeric::interpolation::to_string().

Referenced by bind_constructor(), and bind_function().

◆ function_arguments_for_py_overload()

std::tuple< std::string, std::string, std::string > binder::function_arguments_for_py_overload ( clang::FunctionDecl const *  record)

Generate function argument list with types separated by comma and with only arguments names name_arguments - if arguments should be named: a1, a2, ...

References a, fix_boolean_types(), create_a3b_hbs::i, kmeans_adaptive_kernel_density_bb_dependent_rotlib::p, create_a3b_hbs::r, standard_name(), and numeric::interpolation::to_string().

Referenced by bind_member_functions_for_call_back().

◆ function_pointer_type() [1/2]

std::string binder::function_pointer_type ( clang::FunctionDecl const *  record)

Generate function pointer type string for given function. Example void (*)(int, doule)_ or void (ClassName::*)(int, doule)_ for memeber function.

◆ function_pointer_type() [2/2]

string binder::function_pointer_type ( FunctionDecl const *  F)

◆ function_qualified_name() [1/2]

std::string binder::function_qualified_name ( clang::FunctionDecl const *  F,
bool  omit_return_type = false 
)

generate qualified function name that could be used in bindings code including template specialization if any

◆ function_qualified_name() [2/2]

string binder::function_qualified_name ( FunctionDecl const *  F,
bool  omit_return_type 
)

◆ generate_comment_for_declaration()

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

generate C++ comment line for given declaration along with file path and line number

References line_number(), relevant_include(), and standard_name().

Referenced by binder::ClassBinder::bind(), binder::EnumBinder::bind(), binder::ClassBinder::bind_with(), and binder::ClassBinder::generate_prefix_code().

◆ generate_documentation_string_for_declaration()

std::string binder::generate_documentation_string_for_declaration ( clang::Decl const *  decl)

extract doc string (Doxygen comments) for given declaration and convert it to C++ code

References get_text(), create_a3b_hbs::i, replace(), sm, and utility::options::OptionKeys::options::table::text.

Referenced by binder::ClassBinder::bind(), bind_enum(), and bind_function().

◆ generate_opaque_declaration_if_needed()

string binder::generate_opaque_declaration_if_needed ( string const &  qualified_name,
string const &  qualified_name_without_template 
)

References begins_with(), and detail::find().

◆ get_decl_dependencies()

std::vector<clang::NamedDecl const *> binder::get_decl_dependencies ( clang::CXXRecordDecl const *  C)

◆ get_text()

string binder::get_text ( comments::Comment const *  C,
SourceManager const &  SM,
SourceLocation  previous 
)

◆ get_type_dependencies() [1/3]

std::vector<clang::QualType> binder::get_type_dependencies ( clang::CXXRecordDecl const *  C)

◆ get_type_dependencies() [2/3]

vector<QualType> binder::get_type_dependencies ( CXXRecordDecl const *  C)

◆ get_type_dependencies() [3/3]

vector<QualType> binder::get_type_dependencies ( FunctionDecl const *  F)

generate human redable C++ type signature for given function

References ObjexxFCL::format::F(), create_a3b_hbs::i, and create_a3b_hbs::r.

Referenced by add_relevant_includes(), is_binding_requested(), and is_skipping_requested().

◆ getQualifiedNameAsStringLLVM5Fix()

std::string binder::getQualifiedNameAsStringLLVM5Fix ( NamedDecl const *  E)

◆ indent()

std::string binder::indent ( string const &  code,
string const &  indentation 
)

◆ is_banned_symbol()

bool binder::is_banned_symbol ( clang::NamedDecl const *  D)

check if class/struct/function/enum is in banned symbol lists

References begins_with(), spectral_cluster_kmeans_adaptive_kernel_density_bb_dependent_rotlib::D, name, and standard_name().

Referenced by binder::EnumBinder::bindable(), and is_bindable_raw().

◆ is_bindable() [1/8]

bool binder::is_bindable ( clang::CXXRecordDecl const *  C)

◆ is_bindable() [2/8]

bool binder::is_bindable ( clang::EnumDecl const *  E)

check if generator can create binding

◆ is_bindable() [3/8]

bool binder::is_bindable ( clang::FunctionDecl const *  F)

check if generator can create binding

◆ is_bindable() [4/8]

bool binder::is_bindable ( clang::QualType const &  qt)

check if given QualType is bindable

◆ is_bindable() [5/8]

bool binder::is_bindable ( EnumDecl const *  E)

check if generator can create binding

References ObjexxFCL::format::E(), and name.

Referenced by binder::EnumBinder::bindable().

◆ is_bindable() [6/8]

bool binder::is_bindable ( FieldDecl *  f)

◆ is_bindable() [7/8]

bool binder::is_bindable ( FunctionDecl const *  F)

check if generator can create binding

References ObjexxFCL::format::F(), is_bindable_raw(), and create_a3b_hbs::r.

Referenced by is_bindable_raw().

◆ is_bindable() [8/8]

bool binder::is_bindable ( QualType const &  qt)

◆ is_bindable_raw() [1/2]

bool binder::is_bindable_raw ( clang::CXXRecordDecl const *  C)

check if generator can create binding

References C, is_banned_symbol(), is_python_builtin(), is_std_function_bindable(), and create_a3b_hbs::r.

Referenced by is_bindable().

◆ is_bindable_raw() [2/2]

bool binder::is_bindable_raw ( FunctionDecl const *  F)

◆ is_binding_requested() [1/5]

bool binder::is_binding_requested ( clang::CXXRecordDecl const *  C,
Config const &  config 
)

◆ is_binding_requested() [2/5]

bool binder::is_binding_requested ( clang::EnumDecl const *  E,
Config const &  config 
)

check if user requested binding for the given declaration

References ObjexxFCL::format::E(), and namespace_from_named_decl().

Referenced by binder::EnumBinder::request_bindings_and_skipping().

◆ is_binding_requested() [3/5]

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

check if user requested binding for the given declaration

◆ is_binding_requested() [4/5]

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

check if user requested binding for the given QualType

References create_a3b_hbs::r.

◆ is_binding_requested() [5/5]

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

◆ is_callback_structure_constructible()

bool binder::is_callback_structure_constructible ( CXXRecordDecl const *  C)

◆ is_callback_structure_needed()

bool binder::is_callback_structure_needed ( CXXRecordDecl const *  C)

◆ is_const_overload()

bool binder::is_const_overload ( CXXMethodDecl *  mc)

◆ is_field_assignable()

bool binder::is_field_assignable ( FieldDecl const *  f)

◆ is_function_type() [1/2]

bool binder::is_function_type ( clang::QualType const &  qt)

◆ is_function_type() [2/2]

bool binder::is_function_type ( QualType const &  qt)

Referenced by bind_function().

◆ is_inherited_from_enable_shared_from_this()

bool binder::is_inherited_from_enable_shared_from_this ( CXXRecordDecl const *  C)

◆ is_overloadable() [1/2]

bool binder::is_overloadable ( clang::CXXMethodDecl const *  M)

check if methods could be overload in Python

◆ is_overloadable() [2/2]

bool binder::is_overloadable ( CXXMethodDecl const *  M)

check if methods could be overload in Python

Referenced by bind_member_functions_for_call_back().

◆ is_python_builtin() [1/2]

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

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

◆ is_python_builtin() [2/2]

bool binder::is_python_builtin ( NamedDecl const *  C)

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

References C, ObjexxFCL::get(), name, O_include_pybind11_stl, and standard_name().

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

◆ is_skipping_requested() [1/6]

bool binder::is_skipping_requested ( clang::CXXRecordDecl const *  C,
Config const &  config 
)

◆ is_skipping_requested() [2/6]

bool binder::is_skipping_requested ( clang::EnumDecl const *  E,
Config const &  config 
)

check if user requested skipping for the given declaration

References ObjexxFCL::format::E(), namespace_from_named_decl(), skip(), and standard_name().

Referenced by binder::EnumBinder::request_bindings_and_skipping().

◆ is_skipping_requested() [3/6]

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

check if user requested skipping for the given declaration

◆ is_skipping_requested() [4/6]

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

check if user requested skipping for the given QualType

◆ is_skipping_requested() [5/6]

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

◆ is_skipping_requested() [6/6]

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

References create_a3b_hbs::r.

Referenced by request_bindings().

◆ is_std_function_bindable()

bool binder::is_std_function_bindable ( CXXRecordDecl const *  C)

◆ last_namespace()

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

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

References create_a3b_hbs::f.

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

◆ line_number() [1/2]

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

calculate line in source file for NamedDecl

◆ line_number() [2/2]

string binder::line_number ( NamedDecl const *  decl)

◆ mangle_type_name()

std::string binder::mangle_type_name ( string const &  name,
bool  mark_template 
)

generate string represeting class name that could be used in python

References kmeans_adaptive_kernel_density_bb_dependent_rotlib::c, name, create_a3b_hbs::r, and replace().

Referenced by binder::ClassBinder::bind_with(), callback_structure_name(), and python_class_name().

◆ namespace_from_named_decl() [1/2]

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

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

◆ namespace_from_named_decl() [2/2]

string binder::namespace_from_named_decl ( NamedDecl const *  decl)

◆ operator<<()

llvm::raw_ostream & binder::operator<< ( llvm::raw_ostream &  os,
Binder const &  b 
)

◆ python_class_name()

string binder::python_class_name ( CXXRecordDecl const *  C)

◆ python_function_name() [1/2]

std::string binder::python_function_name ( clang::FunctionDecl const *  F)

generate string representing class name that could be used in python

◆ python_function_name() [2/2]

string binder::python_function_name ( FunctionDecl const *  F)

◆ relevant_include() [1/2]

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

extract include path needed for declaration itself (without template dependency if any), return empty string if no include could be found

◆ relevant_include() [2/2]

string binder::relevant_include ( NamedDecl const *  decl)

◆ replace()

void binder::replace ( string &  r,
string const &  from,
string const &  to 
)

Replace all occurrences of string in-place.

References create_a3b_hbs::i, and create_a3b_hbs::r.

Referenced by ExemplarMover::apply(), utility::file::FileName::assign(), utility::file::PathName::assign(), auto-DRRAFTER_setup::auto_setup_helices(), DRRAFTER_util::easy_cat(), erraser_wrapper::erraser(), erraser_wrapper::erraser_single_res(), DRRAFTER_util::extract_lowscore_decoys(), erraser_util::extract_pdb(), auto-DRRAFTER_setup_next_round::figure_out_next_round(), finalize_models::finalize(), erraser_option.erraser_option::finalize(), erraser_util::find_chi_angle(), erraser_analysis::find_chi_angle_std_pdb(), erraser_single_res_analysis::find_chi_angle_std_pdb(), binder::Context::generate(), generate_documentation_string_for_declaration(), DRRAFTER::get_coord_csts(), drrafter_rna::get_density_per_residue(), auto-DRRAFTER_setup_next_round::get_results(), get_final_ddG_scores::get_scores(), DRRAFTER_util::get_sequences(), options_class.Option::getOptionCC(), setup_for_complex_scoring_general::main(), find_lowest_scoring_relaxed_struct::main(), get_final_ddG_scores::main(), get_lowest_scoring_relaxed_models::main(), submit_jobs::make_job_files_and_submit(), mangle_type_name(), utility::file::FileName::path(), utility::file::PathName::path(), erraser_util::phenix_rna_validate(), replace_(), erraser_util::rosetta2phenix_merge_back(), self-test::run_test(), erraser_wrapper::seq_rebuild(), erraser_wrapper::seq_rebuild_new(), drrafter_rna::setup_next_round(), standard_name_raw(), submit_jobs::submit_jobs(), and erraser_wrapper::SWA_rebuild_erraser().

◆ replace_()

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 create_a3b_hbs::r, replace(), and docking::s.

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

◆ replace_reverse()

void binder::replace_reverse ( string &  r,
string const &  from,
string const &  to 
)

Replace all occurrences of string.

References create_a3b_hbs::i, and create_a3b_hbs::r.

◆ request_bindings()

void binder::request_bindings ( clang::QualType const &  qt,
Context context 
)

◆ simplify_std_class_name()

std::string binder::simplify_std_class_name ( string const &  type)

Attempt to simplify std:: name by removing unneded template arguments. Function assume that there is no 'std::' namespaces prefix at the beginning of the argument string.

Attempt to simplify std:: name by removing unneeded template arguments, assuming that there is no 'std::' namespaces prefix at the beginning of the argument string.

References create_a3b_hbs::r, and simplify_std_class_name_raw().

Referenced by class_name(), and standard_name_raw().

◆ simplify_std_class_name_raw()

string binder::simplify_std_class_name_raw ( string const &  type)

Attempt to simplify std:: name by removing unneded template arguments. Function assume that there is no 'std::' namespaces prefix at the beginning of the argument string.

References ObjexxFCL::len(), kmeans_adaptive_kernel_density_bb_dependent_rotlib::p, and res.

Referenced by simplify_std_class_name().

◆ split()

std::vector< std::string > binder::split ( string const &  buffer,
string const &  separator 
)

Split string using given separator.

References create_a3b_hbs::i, line, and solution_counts::lines.

Referenced by pyrosetta.distributed.cluster.exceptions.OutputError::__init__(), pyrosetta.distributed.viewer.core.ViewerInputError::__init__(), pyrosetta.distributed.viewer.modules.ViewerInputError::__init__(), pyrosetta.distributed::_normflags(), pyrosetta.distributed.viewer.modules::_pdbstring_to_pose(), pyrosetta.distributed.viewer.modules.setHydrogenBonds::apply(), get_junctions_from_legos::collect_junctions(), make_bindings_via_cmake::compile_sources(), build::create_package(), protocols::surface_docking::AntibodyInfoRMLoader::create_resource(), pyrosetta.distributed.dask.worker::dask_setup(), erraser_wrapper::erraser_single_res(), DRRAFTER_util::extract_lowscore_decoys(), finalize_models::finalize(), bin_torsions::find_pivots(), arls_impl::find_programs(), bin_torsions::find_title(), bin_torsions::find_y_limits(), build::generate_bindings(), build::generate_rosetta_external_cmake_files(), update_ui_project::generate_rosetta_external_project_files(), update_ui_project::generate_rosetta_libraries_project_files(), build::get_compiler_version(), erraser_util::get_fasta(), pyrosetta.protocols.h5_fragment_store_provider.H5PyFragmentStoreProvider::get_fragment_store(), enumerate_junctions.Design::get_informative_name(), options_class.Option::get_namespace(), update_ui_project::get_rosetta_external_libraries(), build::get_rosetta_include_directories(), update_ui_project::get_rosetta_include_directories(), build::get_rosetta_system_include_directories(), update_ui_project::get_rosetta_system_include_directories(), get_final_ddG_scores::get_scores(), enumerate_junctions::get_single_junction(), options_class.Option::getOptionKeysCC(), options_class.Option::getOptionKeysHH(), DRRAFTER_util::graph_from_ss(), apps::pilot::frankdt::import_motifs(), indent(), HBondReporter::load_job_data(), bin_torsions::load_torsions_from_dat(), progress_bar::main(), general_RNP_setup_script::main(), get_final_ddG_scores::main(), sphinx-doc-generator::main(), best_ifaceE::main(), get_scores::main(), prune_atdiff_top5pct::main(), main(), make_bindings_via_cmake::make_bindings_code(), bin_torsions::parse_iterations(), abbinding::partners_from_info(), erraser_util::pdb2rosetta(), erraser_util::phenix_rna_validate(), register_options(), pyrosetta.bindings.energies::residue_pair_energies_array(), erraser_util::rosetta2phenix_merge_back(), run(), run_3bpy(), self-test::run_test(), demo.D090_Ala_scan::scanning_analysis(), drrafter_rna::setup_next_round(), split_in_two(), split_string(), erraser_util::subprocess_out(), protocols::hotspot_hashing::tryParseLSMSpec(), update_source_file(), and pyrosetta::version().

◆ split_in_two()

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(), docking::s, sign::space, and split().

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

◆ standard_name()

std::string binder::standard_name ( string const &  type)

◆ standard_name_raw()

string binder::standard_name_raw ( string const &  type)

◆ template_argument_to_string()

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

Generate string representation of given TemplateArgument.

References kmeans_adaptive_kernel_density_bb_dependent_rotlib::_, create_a3b_hbs::r, docking::s, and predPRE::t.

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

◆ template_specialization() [1/2]

std::string binder::template_specialization ( clang::CXXRecordDecl const *  C)

◆ template_specialization() [2/2]

string binder::template_specialization ( FunctionDecl const *  F)

◆ trim()

std::string binder::trim ( std::string const &  s)

remove leading and trailing tabs and spaces

References begin, end, and docking::s.

◆ typename_from_type_decl() [1/2]

std::string binder::typename_from_type_decl ( clang::TypeDecl const *  decl)

◆ typename_from_type_decl() [2/2]

string binder::typename_from_type_decl ( TypeDecl const *  decl)

generate unique string representation of type represented by given declaration

References standard_name().

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

◆ update_source_file()

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.

Try to read existing file. If file content does not match given code, overwrite the file with code. Also create nested dirs starting from prefix if nessesary.

References create_a3b_hbs::f, O_verbose, outs, closure_error::path, create_a3b_hbs::prefix, and split().

Variable Documentation

◆ call_back_function_body_template

const char* binder::call_back_function_body_template
Initial value:
= R"_(
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const {0} *>(this), "{1}");
if (overload) {{
auto o = overload.operator()<pybind11::return_value_policy::reference>({2});
if (pybind11::detail::cast_is_temporary_value_reference<{3}>::value) {{
static pybind11::detail::override_caster_t<{3}> caster;
return pybind11::detail::cast_ref<{3}>(std::move(o), caster);
}}
else return pybind11::detail::cast_safe<{3}>(std::move(o));
}}
)_"

Referenced by bind_member_functions_for_call_back().

◆ constructor_template

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

Referenced by bind_constructor().

◆ constructor_template_with_py_arg

char const* binder::constructor_template_with_py_arg = "\tcl.def( pybind11::init( []({0}){{ return new {2}({1}); }} ), \"doc\" {3});"

Referenced by bind_constructor().

◆ constructor_with_trampoline_template

char const* binder::constructor_with_trampoline_template = "\tcl.def( pybind11::init( []({0}){{ return new {2}({1}); }}, []({0}){{ return new {3}({1}); }} ), \"doc\");"

Referenced by bind_constructor().