Hi,

I am trying to wrap methods like this:


  void SetMac (std::string type,
           std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
           std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
           std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
           std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
           std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
           std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
           std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
           std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());

The problem I am having is that class AttributeValue is abstract and cannot be instantiated.  Normally in pybindgen I handle default values like this:

PyParameter *pyParam = NULL;
PyArg_ParseTupleAndKeywords("...|O!", ..., &PyParameter_Type, &pyParam);
[...]
CallMyMethod ((pyParam? pyParam->obj : <Param Default Value>));

For instance,, if <Param Default> is ns3::EmptyAttributeValue(), I get a compilation error:

debug/bindings/python/ns3_module_helper.cc:83: error: cannot allocate an object of abstract type 'ns3::AttributeValue'
debug/ns3/attribute.h:52: note:   since type 'ns3::AttributeValue' has pure virtual functions

One solution to this problem would be the following:

PyParameter *pyParam = NULL;
<Param Default Type>  paramDefault = <Param Default Value>;
PyArg_ParseTupleAndKeywords("...|O!", ..., &PyParameter_Type, &pyParam);
[...]
CallMyMethod ((pyParam? pyParam->obj : paramDefault));

The above code would compile; I tested.  The problem is that pygccxml does not give me the type of the default parameter value, and of course the type of the parameter itself is useless in these cases (it is abstract).

Any suggestion would be welcome.

--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert