.. oe:namespace:: OEChem


.. meta::
   :keywords: OEIsMember, IsMember


.. _OEChem_OEIsMember:

.. oe:class:: OEIsMember

   .. oe:api::

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

   This class represents :ref:`OEIsMember <OEChem_OEIsMember>` template functor that
   identifies all of the objects which are in an STL
   container. 

   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:method:: Constructors

      .. oe:api::

         OEIsMember()

      Default constructors.

      .. oe:api::

         OEIsMember(std::set<C>& v)
         OEIsMember(std::list<C>& v)
         OEIsMember(std::deque<C>& v)
         OEIsMember(std::vector<C>& v)

      Constructs the functor using an STL container of type 'C', which
      contains objects or pointers to objects. Any of the elements of
      the STL container will be considered to be 'a member' of the
      functor.

      .. oe:api::

         OEIsMember(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. 

      .. oe:api::

         OEIsMember(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. 

      .. oe:api::

         template<class T>
         OEIsMember(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::

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

      Assignment operator that copies the data of the 'rhs' :ref:`OEIsMember <OEChem_OEIsMember>` object
      into the right-hand side :ref:`OEIsMember <OEChem_OEIsMember>` object.

      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 the object arg (or a pointer to arg) is
      contained in the STL container passed to the functor on
      construction.

   .. oe:method:: Add

      .. oe:api::

         bool Add(C& item)

      Add a new element 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() -> OEIsMember

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

      All elements specified by the given iterators will be considered to be ‘a member’ of the functor.
