remove namespace requirement for cython wrapper

Only for unittesting wrap geometry.h, not yet tested in real python/cython
release/4.3a0
Duy-Nguyen Ta 2017-03-18 18:29:53 -04:00
parent 42deeb7bf0
commit 07b1bbfe7f
2 changed files with 11 additions and 14 deletions

View File

@ -730,8 +730,11 @@ void Class::python_wrapper(FileWriter& wrapperFile) const {
/* ************************************************************************* */
void Class::emit_cython_pxd(FileWriter& pxdFile) const {
pxdFile.oss << "cdef extern from \"" << includeFile << "\" namespace \""
<< qualifiedNamespaces("::") << "\":" << endl;
pxdFile.oss << "cdef extern from \"" << includeFile << "\"";
string ns = qualifiedNamespaces("::");
if (!ns.empty())
pxdFile.oss << " namespace \"" << ns << "\"";
pxdFile.oss << ":" << endl;
pxdFile.oss << " cdef cppclass " << pxdClassName() << " \"" << qualifiedName("::") << "\"";
if (templateArgs.size()>0) {
pxdFile.oss << "[";

View File

@ -227,18 +227,12 @@ public:
/// return the Cython class in pxd corresponding to a Python class in pyx
std::string pxd_class_in_pyx() const {
if (isNonBasicType()) {
if (namespaces_.size() > 0)
return pxdClassName();
else {
std::cerr << "Class without namespace: " << pxdClassName() << std::endl;
throw std::runtime_error("Error: User type without namespace!!");
}
}
else if (isEigen()) {
return name_ + "Xd";
} else // basic types and not Eigen
return name_;
if (isNonBasicType()) {
return pxdClassName();
} else if (isEigen()) {
return name_ + "Xd";
} else // basic types and not Eigen
return name_;
}
/// the internal Cython shared obj in a Python class wrappper