.. oe:namespace:: OEChem



.. meta::
   :keywords: OEMatchBase, MatchBase


.. _OEChem_OEMatchBase:

.. oe:class:: OEMatchBase

   .. oe:api::

      class OEMatchBase : public OESystem::OERoleSet

   The :ref:`OEMatchBase <OEChem_OEMatchBase>` class is the abstract interface
   for representing the equivalences or correspondences found in a
   substructure (or similar) match.
   The :ref:`OEMatchBase <OEChem_OEMatchBase>` class can represent substructure
   hits, maximal common subgraph fragments, tautomer equivalences,
   automorphisms and sequence alignments.

   The following methods are publicly inherited from :ref:`OERoleSet <OESystem_OERoleSet>`:

   ======================================================= ======================================================= =======================================================
   :oe:meth:`AddRole<OESystem::OERoleSet::AddRole>`        :oe:meth:`GetRoles<OESystem::OERoleSet::GetRoles>`                                                             
   :oe:meth:`ClearRoles<OESystem::OERoleSet::ClearRoles>`  :oe:meth:`HasRole<OESystem::OERoleSet::HasRole>`                                                               
   :oe:meth:`DeleteRole<OESystem::OERoleSet::DeleteRole>`  :oe:meth:`NumRoles<OESystem::OERoleSet::NumRoles>`                                                             
   ======================================================= ======================================================= =======================================================

   The following classes derive from this class:
    * :ref:`OEMatch <OEChem_OEMatch>`

   .. oe:method:: operator=
      :language: c++

      .. oe:api::

         OEMatchBase & operator=(const OEMatchBase & rhs)

      Assignment operator.


   .. oe:method:: operator bool

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

         .. oe:api::

            operator bool() const

      .. oe:language:: python

         .. oe:api:: python

            IsValid() -> bool

      Same as the :oe:meth:`OEChem::OEMatchBase::IsValid` method.

   .. oe:method:: Clear

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

         .. oe:api::

            void Clear()=0

      .. oe:language:: python

         .. oe:api:: python

            Clear() -> None

      Removes all atom and bond of pairs from any object derived from
      :ref:`OEMatchBase <OEChem_OEMatchBase>` and clears the :ref:`OERoleSet <OESystem_OERoleSet>`.

   .. oe:method:: CreateCopy

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

         .. oe:api::

            OEMatchBase* CreateCopy() const

      .. oe:language:: python

         .. oe:api:: python

            CreateCopy() -> OEMatchBase

      Deep copy constructor that returns a copy of the object.
      The memory for the returned object derived from
      :oe:cls:`OEMatchBase<OEChem::OEMatchBase>`
      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:: GetAtoms

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

         .. oe:api::

            OESystem::OEIterBase<OEMatchPair<OEAtomBase> >* GetAtoms() const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetAtoms() -> Iterable[OEMatchPair[OEAtomBase]]

      Returns an iterator over
      :oe:cls:`OEChem::OEMatchPairs<OEChem::OEMatchPair>` which contain
      the atom to atom correspondences in the
      :ref:`OEMatchBase <OEChem_OEMatchBase>` object.
      The returned :ref:`OEIterBase <OESystem_OEIterBase>` pointer should be
      assigned to an :ref:`OEIter <OESystem_OEIter>` object to prevent
      memory leaks.

   .. oe:method:: GetBonds

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

         .. oe:api::

            OESystem::OEIterBase<OEMatchPair<OEBondBase> >* GetBonds() const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetBonds() -> Iterable[OEMatchPair[OEBondBase]]

      Returns an iterator over
      :oe:cls:`OEChem::OEMatchPairs<OEChem::OEMatchPair>` which contain
      the bond to bond correspondences in the
      :ref:`OEMatchBase <OEChem_OEMatchBase>` object.
      The returned :ref:`OEIterBase <OESystem_OEIterBase>` pointer should be
      assigned to an :ref:`OEIter <OESystem_OEIter>` object to prevent
      memory leaks.

   .. oe:method:: GetPatternAtoms

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

         .. oe:api::

            OESystem::OEIterBase<OEAtomBase>* GetPatternAtoms() const

      .. oe:language:: python

         .. oe:api:: python

            GetPatternAtoms() -> OEAtomIter

      Returns an iterator over the match-ordered atoms of the pattern
      molecule.
      The returned :ref:`OEIterBase <OESystem_OEIterBase>` pointer should be
      assigned to an :ref:`OEIter <OESystem_OEIter>` object to prevent
      memory leaks.

   .. oe:method:: GetPatternBonds

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

         .. oe:api::

            OESystem::OEIterBase<OEBondBase>* GetPatternBonds() const

      .. oe:language:: python

         .. oe:api:: python

            GetPatternBonds() -> OEBondIter

      Returns an iterator over the match-ordered bonds of the pattern
      molecule.
      The returned :ref:`OEIterBase <OESystem_OEIterBase>` pointer should be
      assigned to an :ref:`OEIter <OESystem_OEIter>` object to prevent
      memory leaks.

   .. oe:method:: GetTargetAtoms

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

         .. oe:api::

            OESystem::OEIterBase<OEAtomBase>* GetTargetAtoms() const

      .. oe:language:: python

         .. oe:api:: python

            GetTargetAtoms() -> OEAtomIter

      Returns an iterator over the match-ordered atoms of the target
      molecule.
      The returned :ref:`OEIterBase <OESystem_OEIterBase>` pointer should be
      assigned to an :ref:`OEIter <OESystem_OEIter>` object to prevent
      memory leaks.

   .. oe:method:: GetTargetBonds

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

         .. oe:api::

            OESystem::OEIterBase<OEBondBase>* GetTargetBonds() const

      .. oe:language:: python

         .. oe:api:: python

            GetTargetBonds() -> OEBondIter

      Returns an iterator over the match-ordered bonds of the target
      molecule.
      The returned :ref:`OEIterBase <OESystem_OEIterBase>` pointer should be
      assigned to an :ref:`OEIter <OESystem_OEIter>` object to prevent
      memory leaks.

   .. oe:method:: IsValid

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

         .. oe:api::

            bool IsValid() const

      .. oe:language:: python

         .. oe:api:: python

            IsValid() -> bool

      Returns if at least one atom or one bond equivalence is stored
      in the :ref:`OEMatchBase <OEChem_OEMatchBase>` object.

   .. oe:method:: NumAtoms

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

         .. oe:api::

            unsigned int NumAtoms() const = 0

      .. oe:language:: python

         .. oe:api:: python

            NumAtoms() -> int

      Returns the number of atom equivalences in a match.

   .. oe:method:: NumBonds

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

         .. oe:api::

            unsigned int NumBonds() const = 0

      .. oe:language:: python

         .. oe:api:: python

            NumBonds() -> int

      Returns the number of bond equivalences in a match.
