#include <interfaceMaker.h>
Inheritance diagram for InterfaceMaker:
Public Member Functions | |
InterfaceMaker (InterrogateModuleDef *def) | |
virtual | ~InterfaceMaker () |
virtual void | generate_wrappers () |
Walks through the set of functions in the database and generates wrappers for each function, storing these in the database. | |
virtual void | write_includes (ostream &out) |
Generates the list of #include ... | |
virtual void | write_prototypes (ostream &out) |
Generates the list of function prototypes corresponding to the functions that will be output in write_functions(). | |
virtual void | write_functions (ostream &out) |
Generates the list of functions that are appropriate for this interface. | |
virtual void | write_module (ostream &out, InterrogateModuleDef *def) |
Generates whatever additional code is required to support a module file. | |
virtual ParameterRemap * | remap_parameter (CPPType *struct_type, CPPType *param_type) |
Allocates a new ParameterRemap object suitable to the indicated parameter type. | |
virtual bool | synthesize_this_parameter () |
This method should be overridden and redefined to return true for interfaces that require the implicit "this" parameter, if present, to be passed as the first parameter to any wrapper functions. | |
virtual bool | separate_overloading () |
This method should be overridden and redefined to return true for interfaces that require overloaded instances of a function to be defined as separate functions (each with its own hashed name), or false for interfaces that can support overloading natively, and thus only require one wrapper function per each overloaded input function. | |
void | get_function_remaps (vector< FunctionRemap * > &remaps) |
Fills up the indicated vector with all of the FunctionRemap pointers created by this InterfaceMaker. | |
Static Public Member Functions | |
ostream & | indent (ostream &out, int indent_level) |
Protected Types | |
typedef vector< Function * > | Functions |
typedef map< TypeIndex, Object * > | Objects |
typedef map< string, FunctionRemap * > | WrappersByHash |
Protected Member Functions | |
virtual FunctionRemap * | make_function_remap (const InterrogateType &itype, const InterrogateFunction &ifunc, CPPInstance *cppfunc, int num_default_parameters) |
Creates a FunctionRemap object corresponding to the particular function wrapper. | |
virtual string | get_wrapper_name (const InterrogateType &itype, const InterrogateFunction &ifunc, FunctionIndex func_index) |
Returns the function name that will be used to wrap the indicated function. | |
virtual string | get_wrapper_prefix () |
Returns the prefix string used to generate wrapper function names. | |
virtual string | get_unique_prefix () |
Returns the prefix string used to generate unique symbolic names, which are not necessarily C-callable function names. | |
Function * | record_function (const InterrogateType &itype, FunctionIndex func_index) |
Records the indicated function, along with all of its FunctionRemap flavors and FunctionWriter helpers, for future output. | |
virtual void | record_function_wrapper (InterrogateFunction &ifunc, FunctionWrapperIndex wrapper_index) |
Associates the function wrapper with its function in the appropriate structures in the database. | |
Object * | record_object (TypeIndex type_index) |
Records the indicated type, which may be a struct type, along with all of its associated methods, if any. | |
void | hash_function_signature (FunctionRemap *remap) |
Generates a unique string that corresponds to the function signature for the indicated FunctionRemap object, and stores the generated string in the _hash member of the FunctionRemap. | |
string | manage_return_value (ostream &out, int indent_level, FunctionRemap *remap, const string &return_expr) const |
Does any additional processing that we might want to do on the return value for the function, just before we return it. | |
void | output_ref (ostream &out, int indent_level, FunctionRemap *remap, const string &varname) const |
Outputs the code to increment the reference count for the indicated variable name. | |
void | write_spam_message (ostream &out, FunctionRemap *remap) const |
Generates a string to output a spammy message to notify indicating we have just called this function. | |
Protected Attributes | |
Functions | _functions |
Objects | _objects |
WrappersByHash | _wrappers_by_hash |
InterrogateModuleDef * | _def |
FunctionWriters | _function_writers |
The specializations of this class like InterfaceMakerPython and InterfaceMakerC will generate the actual wrappers for the various language calling conventions.
Definition at line 65 of file interfaceMaker.h.
|
Definition at line 103 of file interfaceMaker.h. |
|
Definition at line 118 of file interfaceMaker.h. |
|
Definition at line 121 of file interfaceMaker.h. |
|
Definition at line 115 of file interfaceMaker.cxx. |
|
|
Walks through the set of functions in the database and generates wrappers for each function, storing these in the database. No actual code should be output yet; this just updates the database with the wrapper information. Definition at line 157 of file interfaceMaker.cxx. References FunctionIndex. |
|
Fills up the indicated vector with all of the FunctionRemap pointers created by this InterfaceMaker. It is the user's responsibility to empty the vector before calling this function; the new pointers will simply be added to the end. Definition at line 408 of file interfaceMaker.cxx. |
|
Returns the prefix string used to generate unique symbolic names, which are not necessarily C-callable function names.
Reimplemented in InterfaceMakerC, and InterfaceMakerPythonSimple. Definition at line 529 of file interfaceMaker.cxx. References _objects, InterrogateDatabase::get_ptr(), and NULL. Referenced by synthesize_this_parameter(). |
|
Returns the function name that will be used to wrap the indicated function. This is the name for the overall wrapper function, including all of the overloaded instances. Interfaces that must define a different wrapper for each FunctionRemap object (i.e. for each instance of an overloaded function) need not define a name here. Definition at line 490 of file interfaceMaker.cxx. References InterfaceMaker::Function::_has_this, FunctionRemap::_has_this, InterfaceMaker::Function::_remaps, FunctionWrapperIndex, FunctionRemap::make_wrapper_entry(), NULL, record_function_wrapper(), and InterrogateDatabase::update_function(). |
|
Returns the prefix string used to generate wrapper function names.
Reimplemented in InterfaceMakerC, InterfaceMakerPythonObj, and InterfaceMakerPythonSimple. Definition at line 512 of file interfaceMaker.cxx. Referenced by synthesize_this_parameter(). |
|
Generates a unique string that corresponds to the function signature for the indicated FunctionRemap object, and stores the generated string in the _hash member of the FunctionRemap.
Definition at line 824 of file interfaceMaker.cxx. Referenced by synthesize_this_parameter(). |
|
Definition at line 428 of file interfaceMaker.cxx. Referenced by FunctionRemap::get_parameter_name(), ParameterRemapBasicStringToString::pass_parameter(), InterfaceMakerPythonObj::write_function_for(), and InterfaceMakerPython::write_includes(). |
|
Creates a FunctionRemap object corresponding to the particular function wrapper.
Definition at line 446 of file interfaceMaker.cxx. References _functions, InterrogateFunction::Instances, and NULL. |
|
Does any additional processing that we might want to do on the return value for the function, just before we return it. Returns the string representing the new return value after processing. Definition at line 740 of file interfaceMaker.cxx. References _wrappers_by_hash, and nout. |
|
Outputs the code to increment the reference count for the indicated variable name.
Definition at line 786 of file interfaceMaker.cxx. Referenced by record_function_wrapper(). |
|
Records the indicated function, along with all of its FunctionRemap flavors and FunctionWriter helpers, for future output. Returns the new Function pointer. Definition at line 546 of file interfaceMaker.cxx. References _objects. Referenced by ~InterfaceMaker(). |
|
Associates the function wrapper with its function in the appropriate structures in the database.
Reimplemented in InterfaceMakerC, and InterfaceMakerPythonSimple. Definition at line 628 of file interfaceMaker.cxx. References output_ref(). Referenced by get_wrapper_name(). |
|
Records the indicated type, which may be a struct type, along with all of its associated methods, if any.
Definition at line 644 of file interfaceMaker.cxx. Referenced by ~InterfaceMaker(). |
|
Allocates a new ParameterRemap object suitable to the indicated parameter type. If struct_type is non-NULL, it is the type of the enclosing class for the function (method) in question. The return value is a newly-allocated ParameterRemap object, if the parameter type is acceptable, or NULL if the parameter type cannot be handled. Definition at line 287 of file interfaceMaker.cxx. |
|
This method should be overridden and redefined to return true for interfaces that require overloaded instances of a function to be defined as separate functions (each with its own hashed name), or false for interfaces that can support overloading natively, and thus only require one wrapper function per each overloaded input function.
Definition at line 387 of file interfaceMaker.cxx. Referenced by synthesize_this_parameter(). |
|
This method should be overridden and redefined to return true for interfaces that require the implicit "this" parameter, if present, to be passed as the first parameter to any wrapper functions.
Reimplemented in InterfaceMakerC, InterfaceMakerPythonObj, and InterfaceMakerPythonSimple. Definition at line 362 of file interfaceMaker.cxx. References _def, FunctionRemap::_hash, FunctionRemap::_is_valid, FunctionRemap::_unique_name, FunctionRemap::_wrapper_name, get_unique_prefix(), get_wrapper_prefix(), hash_function_signature(), InterrogateModuleDef::library_hash_name, NULL, and separate_overloading(). |
|
Generates the list of functions that are appropriate for this interface.
Reimplemented in InterfaceMakerC, InterfaceMakerPythonObj, and InterfaceMakerPythonSimple. Definition at line 245 of file interfaceMaker.cxx. References TypeManager::is_basic_string_char(), TypeManager::is_const_ref_to_basic_string_char(), and NULL. Referenced by InterfaceMakerPythonSimple::write_prototypes(), InterfaceMakerPythonObj::write_prototypes(), and InterfaceMakerC::write_prototypes(). |
|
Generates the list of #include ... whatever that's required by this particular interface to the indicated output stream. Reimplemented in InterfaceMakerPython. Definition at line 214 of file interfaceMaker.cxx. Referenced by InterfaceMakerPython::InterfaceMakerPython(). |
|
Generates whatever additional code is required to support a module file.
Reimplemented in InterfaceMakerPythonObj, and InterfaceMakerPythonSimple. Definition at line 260 of file interfaceMaker.cxx. References NULL. Referenced by InterfaceMakerPythonSimple::write_functions(), and InterfaceMakerPythonObj::write_functions(). |
|
Generates the list of function prototypes corresponding to the functions that will be output in write_functions().
Reimplemented in InterfaceMakerC, InterfaceMakerPythonObj, and InterfaceMakerPythonSimple. Definition at line 230 of file interfaceMaker.cxx. References TypeManager::is_char_pointer(). Referenced by InterfaceMakerC::~InterfaceMakerC(), InterfaceMakerPythonObj::~InterfaceMakerPythonObj(), and InterfaceMakerPythonSimple::~InterfaceMakerPythonSimple(). |
|
Generates a string to output a spammy message to notify indicating we have just called this function.
Definition at line 896 of file interfaceMaker.cxx. |
|
Definition at line 158 of file interfaceMaker.h. Referenced by synthesize_this_parameter(). |
|
Definition at line 160 of file interfaceMaker.h. |
|
|
Definition at line 119 of file interfaceMaker.h. Referenced by get_unique_prefix(), record_function(), InterfaceMakerPythonObj::write_functions(), and InterfaceMakerPythonObj::write_prototypes(). |
|
Definition at line 122 of file interfaceMaker.h. Referenced by manage_return_value(). |