.. oe:namespace:: OEChem


.. meta::
   :keywords: OEGroupBase, GroupBase

.. _OEChem_OEGroupBase:

.. oe:class:: OEGroupBase

   .. oe:api::

      class OEGroupBase  : public OESystem::OEBase

   The :ref:`OEGroupBase <OEChem_OEGroupBase>` class is the abstract interface for
   representing a 'group' container that can store atom and bond pointers
   of a molecule.

   The following methods are publicly inherited from :ref:`OEBase <OESystem_OEBase>`:

   ======================================================== ========================================================= =========================================================
   :oe:meth:`operator=<OESystem::OEBase::operator=>`        :oe:meth:`GetData<OESystem::OEBase::GetData>`             :oe:meth:`IsDataType<OESystem::OEBase::IsDataType>`      
   :oe:meth:`operator+=<OESystem::OEBase::operator+=>`      :oe:meth:`GetDataIter<OESystem::OEBase::GetDataIter>`     :oe:meth:`SetBaseData<OESystem::OEBase::SetBaseData>`    
   :oe:meth:`AddBaseData<OESystem::OEBase::AddBaseData>`    :oe:meth:`GetDataType<OESystem::OEBase::GetDataType>`     :oe:meth:`SetBoolData<OESystem::OEBase::SetBoolData>`    
   :oe:meth:`AddData<OESystem::OEBase::AddData>`            :oe:meth:`GetDoubleData<OESystem::OEBase::GetDoubleData>` :oe:meth:`SetData<OESystem::OEBase::SetData>`            
   :oe:meth:`Clear<OESystem::OEBase::Clear>`                :oe:meth:`GetFloatData<OESystem::OEBase::GetFloatData>`   :oe:meth:`SetDoubleData<OESystem::OEBase::SetDoubleData>`
   :oe:meth:`CreateCopy<OESystem::OEBase::CreateCopy>`      :oe:meth:`GetIntData<OESystem::OEBase::GetIntData>`       :oe:meth:`SetFloatData<OESystem::OEBase::SetFloatData>`  
   :oe:meth:`DeleteData<OESystem::OEBase::DeleteData>`      :oe:meth:`GetStringData<OESystem::OEBase::GetStringData>` :oe:meth:`SetIntData<OESystem::OEBase::SetIntData>`      
   :oe:meth:`GetBoolData<OESystem::OEBase::GetBoolData>`    :oe:meth:`HasData<OESystem::OEBase::HasData>`             :oe:meth:`SetStringData<OESystem::OEBase::SetStringData>`
   ======================================================== ========================================================= =========================================================

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

      .. oe:api::

         OEGroupBase & operator=(const OEGroupBase & rhs)

      Assignment operator.


   .. ################################################################
      # AddAtom
      ################################################################

   .. oe:method:: AddAtom

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

         .. oe:api::

            bool AddAtom(OEAtomBase* atom)=0

      .. oe:language:: python

         .. oe:api:: python

            AddAtom(atom: OEAtomBase) -> bool

      Adds an atom to the group.
      A group can hold only atoms that belong to the same
      molecule on which the group is created.

      .. seealso::

         * :oe:meth:`OEChem::OEGroupBase::GetParent` method

   .. oe:method:: AddBond

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

         .. oe:api::

            bool AddBond(OEBondBase* bond)=0

      .. oe:language:: python

         .. oe:api:: python

            AddBond(bond: OEBondBase) -> bool

      Adds a bond to the group.
      A group can hold only bonds that belong to the same
      molecule on which the group is created.

      .. seealso::

         * :oe:meth:`OEChem::OEGroupBase::GetParent` method

   .. oe:method:: Clear

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

         .. oe:api::

            void Clear()=0

      .. oe:language:: python

         .. oe:api:: python

            Clear() -> None

      This method removes all atoms (:ref:`OEAtomBase <OEChem_OEAtomBase>`) and
      bonds (:ref:`OEBondBase <OEChem_OEBondBase>`) that are stored in the group.

   .. oe:method:: DeleteAtom

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

         .. oe:api::

            bool DeleteAtom(OEAtomBase* atom)=0

      .. oe:language:: python

         .. oe:api:: python

            DeleteAtom(atom: OEAtomBase) -> bool

      Deletes an atom from a group.
      Returns ``true`` if the atom was successfully removed.

   .. oe:method:: DeleteBond

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

         .. oe:api::

            bool DeleteBond(OEBondBase* bond)=0

      .. oe:language:: python

         .. oe:api:: python

            DeleteBond(bond: OEBondBase) -> bool

      Deletes a bond from a group.
      Returns ``true`` if the bond was successfully removed.

   .. oe:method:: GetAtoms

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

         .. oe:api::

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

      .. oe:language:: python

         .. oe:api:: python

            GetAtoms() -> OEAtomIter

      Returns an iterator over all the atoms in the group.

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

         .. oe:api::

            OESystem::OEIterBase<OEAtomBase>* GetAtoms(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &) const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetAtoms(atompred: OEUnaryAtomPred) -> OEAtomIter

      Returns an iterator over all of the atoms in the group that
      match the specified atom predicate
      (:ref:`OEUnaryPredicate <OESystem_OEUnaryPredicate>`).

   .. oe:method:: GetBonds

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

         .. oe:api::

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

      .. oe:language:: python

         .. oe:api:: python

            GetBonds() -> OEBondIter

      Returns an iterator over all the bonds in the group.

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

         .. oe:api::

            OESystem::OEIterBase<OEBondBase>* GetBonds(const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &) const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetBonds(bondpred: OEUnaryBondPred) -> OEBondIter

      Returns an iterator over all bonds in the group that
      match the specified bond predicate
      (:ref:`OEUnaryPredicate <OESystem_OEUnaryPredicate>`).

   .. oe:method:: GetGroupDefinition

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

         .. oe:api::

            bool GetGroupDefinition(OEChem::OEAtomBondSet &) const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetGroupDefinition(abset: OEAtomBondSet) -> bool

      Returns the entire group definition as an :ref:`OEAtomBondSet <OEChem_OEAtomBondSet>`.

   .. oe:method:: GetParent

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

         .. oe:api::

            const OEMolBase* GetParent() const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetParent() -> OEGraphMol

      Returns the parent molecule of a group.
      All :oe:cls:`OEChem::OEGroupBases<OEChem::OEGroupBase>` are created
      as a container of an :ref:`OEMolBase <OEChem_OEMolBase>`.
      This method can be used to determine the molecule of which atoms
      and bonds the group stores.
      The 'parent molecule' property of a group cannot be altered, as its
      determined at the point the group is created.

   .. oe:method:: GetGroupType

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

         .. oe:api::

            unsigned int GetGroupType() const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetGroupType() -> int

      Returns the type of the group.

      .. seealso::

         * :oe:meth:`OEChem::OEGroupBase::SetGroupType` methods
         * :oe:constns:`OEChem::OEGroupType` namespace for the built-in group types

   .. oe:method:: HasAtom

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

         .. oe:api::

            bool HasAtom(const OEAtomBase* atom) const = 0

      .. oe:language:: python

         .. oe:api:: python

            HasAtom(atom: OEAtomBase) -> bool

      Returns ``true`` if the given atom belongs to the group.

   .. oe:method:: HasBond

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

         .. oe:api::

            bool HasBond(const OEBondBase* bond) const = 0

      .. oe:language:: python

         .. oe:api:: python

            HasBond(bond: OEBondBase) -> bool

      Returns ``true`` if the given bond belongs to the group.

   .. oe:method:: IsDeleted

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

         .. oe:api::

            bool IsDeleted() const = 0

      .. oe:language:: python

         .. oe:api:: python

            IsDeleted() -> bool

      Returns ``true`` if the group has been deleted or if all atom and bonds
      have been removed from the group i.e. if the group is empty.

   .. oe:method:: IsEmpty

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

         .. oe:api::

            bool IsEmpty() const = 0

      .. oe:language:: python

         .. oe:api:: python

            IsEmpty() -> bool

      Returns ``true`` if all atom and bonds
      have been removed from the group, i.e. if the group is empty.

   .. 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 atoms in the group.

   .. 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 bonds in the group.

   .. oe:method:: SetGroupType

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

         .. oe:api::

            void SetGroupType(unsigned int)=0

      .. oe:language:: python

         .. oe:api:: python

            SetGroupType(arg2: int) -> None

      Sets the type of the group.

      .. seealso::

         * :oe:meth:`OEChem::OEGroupBase::GetGroupType` method
         * :oe:constns:`OEChem::OEGroupType` namespace for the built-in group types

   .. oe:method:: Sweep

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

         .. oe:api::

            bool Sweep()=0

      .. oe:language:: python

         .. oe:api:: python

            Sweep() -> bool

      Removes  atoms and bonds from the group for which the
      :oe:meth:`OEChem::OEAtomBase::IsDeleted` method and the
      :oe:meth:`OEChem::OEBondBase::IsDeleted` method returns ``true``,
      respectively.
