.. oe:namespace:: OEChem



.. meta::
   :keywords: OEExprBase, ExprBase


.. _OEChem_OEExprBase:

.. oe:class:: OEExprBase

   .. oe:api::


      class OEExprBase

   This class represents `OEExprBase`.

   The :ref:`OEExprBase <OEChem_OEExprBase>` is an abstract class which defines
   an interface through which boolean expressions can test equivalence
   of nodes (atoms) and edges (bonds) during graph match processes.
   The expression class interface simplifies what is normally a binary
   tree representation of attributes which atoms and bonds must (not)
   have in order to be called equivalent to a corresponding node or
   edge.
   Derived classes may be used to extend the graph matching algorithms
   in *OEChem* to compare attributes beyond the pre-defined
   expressions in *OEChem*.
   In addition, user-defined expression classes may take full
   advantage of the arbitrary data storage mechanism which is part of
   the :ref:`OEBase <OESystem_OEBase>` class.
   Expression equivalence could then be performed on dynamic
   user-defined data extensions to atoms and bonds.

   .. oe:method:: Constructors

      .. oe:api::

         OEExprBase()

      Default and copy constructors.

   .. oe:method:: CreateCopy

      .. oe:language:: c++ java csharp

         .. oe:api::

            OEExprBase* CreateCopy() const = 0

      .. oe:language:: python

         .. oe:api:: python

            CreateCopy() -> OEExprBase

      Deep copy constructor that returns a copy of the object.
      The memory for the returned :ref:`OEExprBase <OEChem_OEExprBase>`
      object is dynamically allocated  and owned by the caller.

      .. oe:language:: c++ 

         The returned copy should be deallocated using C++
         delete operator in order to prevent a memory leak. 

   .. oe:method:: GetType

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int GetType() const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetType() -> int

      This pure virtual method is designed to return a unique
      identifier for each :ref:`OEExprBase <OEChem_OEExprBase>` implementation.
      A listing of type identifiers returned by classes in *OEChem*
      which are derived from the :ref:`OEExprBase <OEChem_OEExprBase>` class can
      be found in the :oe:constns:`OEChem::OEExprType` namespace.
      User-defined implementations of the :ref:`OEExprBase <OEChem_OEExprBase>`
      class should return value for this method which does not collide
      with types returned by implementations provided by *OEChem*.
 
   .. oe:method:: IsEquivalent

      .. oe:language:: c++ java csharp

         .. oe:api::

            const OEFuzzy& IsEquivalent(const OEBondBase *) const = 0
            const OEFuzzy& IsEquivalent(const OEAtomBase *) const = 0

      .. oe:language:: python

         .. oe:api:: python

            IsEquivalent(arg2: OEBondBase) -> OEFuzzy
            IsEquivalent(arg2: OEAtomBase) -> OEFuzzy

      These pure virtual methods provide a common interface for
      testing attributes of atoms (:ref:`OEAtomBase <OEChem_OEAtomBase>`) and
      bonds (:ref:`OEBondBase <OEChem_OEBondBase>`).
      Any method which does not modify an atom or bond may be called
      in an implementation of an
      :oe:meth:`OEChem::OEExprBase::IsEquivalent` method.
      The return value must be one of the :ref:`OEFuzzy <OEChem_OEFuzzy>`
      predefined instances of 
      true (:oe:const:`OEChem::OEFuzzVal::True`), 
      false (:oe:const:`OEChem::OEFuzzVal::False`), or 
      maybe (:oe:const:`OEChem::OEFuzzVal::Maybe`).
