From 3e0943d0e61b11cdd6b0b2dd7d0815a64e63725d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 1 Apr 2013 20:26:24 -0700 Subject: gras: fix from previous commit: swig element equals Just put an API call into element so its always there, and call it from swig. --- include/gras/element.hpp | 6 ++++++ include/gras/element.i | 11 +---------- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/gras/element.hpp b/include/gras/element.hpp index 0bebc14..40a24cf 100644 --- a/include/gras/element.hpp +++ b/include/gras/element.hpp @@ -31,6 +31,12 @@ struct GRAS_API Element : ElementBase, boost::enable_shared_from_this /*virtual*/ ~Element(void); + /*! + * Check if another element is the same as this one. + * \return true if the rhs is the same as *this. + */ + bool equals(const Element &rhs); + /******************************************************************* * identification interface ******************************************************************/ diff --git a/include/gras/element.i b/include/gras/element.i index be3814e..8f04a3d 100644 --- a/include/gras/element.i +++ b/include/gras/element.i @@ -34,22 +34,13 @@ //////////////////////////////////////////////////////////////////////// // Operator overloads for Element //////////////////////////////////////////////////////////////////////// -%{ - -inline bool gras_element_equal(const gras::Element &lhs, const gras::Element &rhs) -{ - return lhs.get() == rhs.get(); -} - -%} - %extend gras::Element { %insert("python") %{ def __eq__(self, rhs): if not isinstance(rhs, Element): return False - return gras_element_equal(self, rhs) + return self.equals(rhs) def __str__(self): return self.to_string() -- cgit