定义枚举以通过Python2.7进行增强和访问

时间:2019-01-18 21:14:55

标签: python c++ python-2.7 boost

我正在尝试从python调用C ++构造函数,并且该构造函数的变量之一是枚举。我想我已经定义了枚举来增强功能,但是似乎无法在python中访问相关的枚举模块并调用使用它的构造函数。

枚举定义为

 enum   G4FacetVertexType { ABSOLUTE, RELATIVE }

我的提升定义是

enum_<G4FacetVertexType>("VertexType")
        .value("A",ABSOLUTE)
        .value("R",RELATIVE)
        ;

,构造函数定义为

class_<G4TriangularFacet, bases<G4VFacet> , boost::noncopyable>
     ("G4TriangularFacet", "solid class")
      .def(init<G4ThreeVector,G4ThreeVector,G4ThreeVector,G4FacetVertexType>())
      // ---
     .def("SetVertex",      &G4TriangularFacet::SetVertex)

      // operators
      .def(self == self)
      ;

但是我不能锻炼如何在python2.7中设置枚举

0 个答案:

没有答案
相关问题