remove namespace requirement for cython wrapper
Only for unittesting wrap geometry.h, not yet tested in real python/cythonrelease/4.3a0
parent
42deeb7bf0
commit
07b1bbfe7f
|
@ -730,8 +730,11 @@ void Class::python_wrapper(FileWriter& wrapperFile) const {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void Class::emit_cython_pxd(FileWriter& pxdFile) const {
|
void Class::emit_cython_pxd(FileWriter& pxdFile) const {
|
||||||
pxdFile.oss << "cdef extern from \"" << includeFile << "\" namespace \""
|
pxdFile.oss << "cdef extern from \"" << includeFile << "\"";
|
||||||
<< qualifiedNamespaces("::") << "\":" << endl;
|
string ns = qualifiedNamespaces("::");
|
||||||
|
if (!ns.empty())
|
||||||
|
pxdFile.oss << " namespace \"" << ns << "\"";
|
||||||
|
pxdFile.oss << ":" << endl;
|
||||||
pxdFile.oss << " cdef cppclass " << pxdClassName() << " \"" << qualifiedName("::") << "\"";
|
pxdFile.oss << " cdef cppclass " << pxdClassName() << " \"" << qualifiedName("::") << "\"";
|
||||||
if (templateArgs.size()>0) {
|
if (templateArgs.size()>0) {
|
||||||
pxdFile.oss << "[";
|
pxdFile.oss << "[";
|
||||||
|
|
|
@ -227,18 +227,12 @@ public:
|
||||||
|
|
||||||
/// return the Cython class in pxd corresponding to a Python class in pyx
|
/// return the Cython class in pxd corresponding to a Python class in pyx
|
||||||
std::string pxd_class_in_pyx() const {
|
std::string pxd_class_in_pyx() const {
|
||||||
if (isNonBasicType()) {
|
if (isNonBasicType()) {
|
||||||
if (namespaces_.size() > 0)
|
return pxdClassName();
|
||||||
return pxdClassName();
|
} else if (isEigen()) {
|
||||||
else {
|
return name_ + "Xd";
|
||||||
std::cerr << "Class without namespace: " << pxdClassName() << std::endl;
|
} else // basic types and not Eigen
|
||||||
throw std::runtime_error("Error: User type without namespace!!");
|
return name_;
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isEigen()) {
|
|
||||||
return name_ + "Xd";
|
|
||||||
} else // basic types and not Eigen
|
|
||||||
return name_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// the internal Cython shared obj in a Python class wrappper
|
/// the internal Cython shared obj in a Python class wrappper
|
||||||
|
|
Loading…
Reference in New Issue