You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the very nice features of cpp2py is the conversion of python dictionaries into a cpp class (e.g. for passing parameters). As far as I can tell, the only way to specifying that such a converter should be generated is with the keyword CPP2PY_ARG_AS_DICT.
This is somewhat inconvenient, since it is a keyword that applies to a function (rather then the parameter class itself) and that function is only allowed to take one parameter (the paramter class).
The CPP2PY_IGNORE keyword on the parameter_list class stops cpp2py from directly wrapping the class in python. The my_wrapped_fuction is what we want to use, but it takes two arguments and therefore the CPP2PY_ARG_AS_DICT can't be applied. So we are left with defining the fake function whose only purpose is to trick cpp2py to make a converter.
I propose adding a new keyword that is applied to the data class itself. E.g. CPP2PY_CONVERT_TO_DICT. This seems to be the right place to put it logically (why does it matter which and how many functions in cpp we pass the class to?) and avoids the issues mentioned above.
Thoughts? Concerns?
The text was updated successfully, but these errors were encountered:
Hi,
One of the very nice features of cpp2py is the conversion of python dictionaries into a cpp class (e.g. for passing parameters). As far as I can tell, the only way to specifying that such a converter should be generated is with the keyword CPP2PY_ARG_AS_DICT.
This is somewhat inconvenient, since it is a keyword that applies to a function (rather then the parameter class itself) and that function is only allowed to take one parameter (the paramter class).
Consider an example:
The
CPP2PY_IGNORE
keyword on theparameter_list
class stops cpp2py from directly wrapping the class in python. Themy_wrapped_fuction
is what we want to use, but it takes two arguments and therefore theCPP2PY_ARG_AS_DICT
can't be applied. So we are left with defining thefake
function whose only purpose is to trick cpp2py to make a converter.I propose adding a new keyword that is applied to the data class itself. E.g.
CPP2PY_CONVERT_TO_DICT
. This seems to be the right place to put it logically (why does it matter which and how many functions in cpp we pass the class to?) and avoids the issues mentioned above.Thoughts? Concerns?
The text was updated successfully, but these errors were encountered: