summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJosh Blum2013-04-01 20:26:24 -0700
committerJosh Blum2013-04-01 20:26:24 -0700
commit3e0943d0e61b11cdd6b0b2dd7d0815a64e63725d (patch)
treecbebd5b2ef1525e1799521aa60c39b2b26c40310 /include
parenta6cfe0fc89473d6f39d3376147f1de1658b47c46 (diff)
downloadsandhi-3e0943d0e61b11cdd6b0b2dd7d0815a64e63725d.tar.gz
sandhi-3e0943d0e61b11cdd6b0b2dd7d0815a64e63725d.tar.bz2
sandhi-3e0943d0e61b11cdd6b0b2dd7d0815a64e63725d.zip
gras: fix from previous commit: swig element equals
Just put an API call into element so its always there, and call it from swig.
Diffstat (limited to 'include')
-rw-r--r--include/gras/element.hpp6
-rw-r--r--include/gras/element.i11
2 files changed, 7 insertions, 10 deletions
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<Element>
/*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()