.. oe:namespace:: OEChem

.. meta::
   :keywords: OEIsMemberPtr, IsMemberPtr


.. _OEChem_OEIsMemberPtr:

.. oe:class:: OEIsMemberPtr

   .. oe:api::

      template<class C>
      class OEIsMemberPtr : public OESystem::OEUnaryPredicate<C>

   This class represents :ref:`OEIsMemberPtr <OEChem_OEIsMemberPtr>` template functor that
   performs set membership tests. This functor differs
   from the :ref:`OEIsMember <OEChem_OEIsMember>` functor in that the internal
   storage type differs from the test type. 
   While instances of abstract classes cannot be easily
   stored, however, pointers to abstract class instances do not pose
   the same storage problems. 
   :ref:`OEIsMemberPtr <OEChem_OEIsMemberPtr>` stores pointers to
   data types, while the template type of the class is a single
   dereferenced version of the storage type.

   .. seealso::

      .. oe:language:: c++

         * Example program :ref:`minpath.cpp<section_example_oechem_minpath>`

      .. oe:language:: python

         * Example program :ref:`minpath.py<section_example_oechem_minpath>`

      .. oe:language:: java

         * Example program :ref:`MinPath.java<section_example_oechem_minpath>`

      .. oe:language:: csharp

         * Example program :ref:`MinPath.cs<section_example_oechem_minpath>`

   The following methods are publicly inherited from :ref:`OEUnaryPredicate <OESystem_OEUnaryPredicate>`:

   ============================================================================== ============================================================================== ===============================================================================
   :oe:meth:`operator()<OESystem::OEUnaryPredicate::operator()>`                  :oe:meth:`CreateCopy<OESystem::OEUnaryPredicate::CreateCopy>`                  :oe:meth:`CreatePredicateCopy<OESystem::OEUnaryPredicate::CreatePredicateCopy>`
   ============================================================================== ============================================================================== ===============================================================================

   The following methods are publicly inherited from :ref:`OEUnaryFunction <OESystem_OEUnaryFunction>`:

   ============================================================ ============================================================ ===========================================================
   :oe:meth:`operator()<OESystem::OEUnaryFunction::operator()>` :oe:meth:`CreateCopy<OESystem::OEUnaryFunction::CreateCopy>`                                                            
   ============================================================ ============================================================ ===========================================================


   .. oe:language:: c++  python

      .. _OEChem_OEIsMemberPtr_OEIsAtomMember:
      .. _OEChem_OEIsMemberPtr_OEIsBondMember:

      The following specializations exist for this template:

      ==================== =======================================================================
      Specialized Functor  Definition                                                             
      ==================== =======================================================================
      OEIsAtomMember       :ref:`OEIsMemberPtr <OEChem_OEIsMemberPtr>` < :ref:`OEAtomBase <OEChem_OEAtomBase>` >
      OEIsBondMember       :ref:`OEIsMemberPtr <OEChem_OEIsMemberPtr>` < :ref:`OEBondBase <OEChem_OEBondBase>` >
      ==================== =======================================================================

   .. oe:method:: Constructors

      .. oe:api::

         OEIsMemberPtr()

      Default constructor.

      .. oe:api::

         OEIsMemberPtr(OESystem::OEIter<C>& i)

      Constructs the functor using an iterator (:ref:`OEIter <OESystem_OEIter>`)
      over values of the same type as the functor template argument. 
      Addresses instead of instances or references to the data are
      stored internally.

      .. oe:api::

         OEIsMemberPtr(OESystem::OEIterBase<C>* i)

      Constructs the functor using an iterator (:ref:`OEIterBase <OESystem_OEIterBase>`)
      over values of the same type as the functor template argument. 
      Addresses instead of instances or references to the data are
      stored internally.

      .. oe:api::

         template<class T>  OEIsMemberPtr(T bgn, T end)

      Constructs the functor using a sequence of values. The values
      from 'bgn' up to, but not including 'end' are used to construct the
      functor. Using this constructor, the functor may be constructed
      from arrays and STL containers.

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

      .. oe:api::

         OEIsMemberPtr<C>& operator=(const OEIsMemberPtr<C>& rhs)

      Assignment operator.


   .. oe:method:: operator()

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

         .. oe:api::

            bool operator()(const C& arg) const

      .. oe:language:: python

         .. oe:api:: python

            __call__(arg: C) -> bool

      Returns ``true`` if a pointer to the object 'arg' is contained in the
      functor.

   .. oe:method:: Add

      .. oe:api::

         bool Add(const C* item)

      Add a new pointer to be considered as ‘a member’ of the functor.

   .. oe:method:: CreateCopy

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

         .. oe:api::

            OESystem::OEUnaryPredicate<C>* CreateCopy() const

      .. oe:language:: python

         .. oe:api:: python

            CreateCopy() -> OEIsMemberPtr

      Deep copy constructor that returns a copy of the object.
      The memory for the returned :ref:`OEIsMemberPtr <OEChem_OEIsMemberPtr>`
      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:: Set

      .. oe:api::

         template<class T>
         bool Set(T bgn, T end)

