Adding Name's operators binding

This commit is contained in:
Damien Dupuis 2010-06-15 14:18:05 +00:00
parent 0a06335e15
commit 685dde710f
2 changed files with 15 additions and 10 deletions

View File

@ -10,18 +10,18 @@ SET ( cpps Techno.cpp
SET ( pycpps PyDtr.cpp ${cpps})
ADD_LIBRARY(dtr ${cpps})
ADD_LIBRARY(dtr ${cpps})
TARGET_LINK_LIBRARIES(dtr ${LIBXML2_LIBRARIES})
INSTALL(TARGETS dtr DESTINATION lib${LIB_SUFFIX})
IF (Boost_FOUND)
ADD_LIBRARY(pyDTR MODULE ${pycpps})
SET_TARGET_PROPERTIES(pyDTR PROPERTIES
SET_TARGET_PROPERTIES(pyDTR PROPERTIES
COMPILE_FLAGS "${COMPILE_FLAGS} -D__PYTHON_MODULE__=1"
PREFIX ""
)
TARGET_LINK_LIBRARIES(pyDTR dtr ${LIBXML2_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
INSTALL(TARGETS pyDTR DESTINATION ${PYTHON_SITE_PACKAGES})
TARGET_LINK_LIBRARIES(pyDTR dtr ${LIBXML2_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
INSTALL(TARGETS pyDTR DESTINATION ${PYTHON_SITE_PACKAGES})
ENDIF(Boost_FOUND)
INSTALL(FILES ${hpps} DESTINATION include/vlsisapd/dtr)

View File

@ -24,6 +24,11 @@ BOOST_PYTHON_MODULE(pyDTR) {
// class DTR::Name
class_<Name>("Name", init<std::string>())
.def("getString", &Name::getString, return_value_policy<copy_const_reference>()) // return_value_policy because this method return a refenrce on string
.def(self == self)
.def(self == std::string())
.def(self != self)
.def(self != std::string())
.def(self < self)
;
// class DTR::Rule