.. oe:namespace:: OEChem



.. meta::
   :keywords: OEVectorBindings, VectorBindings


.. _OEChem_OEVectorBindings:

.. oe:class:: OEVectorBindings

   .. oe:api::


      class OEVectorBindings

   This class represents `OEVectorBindings`.

   The :ref:`OEVectorBindings <OEChem_OEVectorBindings>` class is used to store a set of
   vector bindings or lexigraphic replacements that may appear in a
   :term:`SMARTS` pattern.
 
   A vector binding is a :term:`SMARTS` pattern bound to a name. 
   For example, the name ``[$HALO]`` can be used to represent the
   pattern ``[$(F,Cl,Br,I)]`` in order to make a pattern more human
   readable.
   The :ref:`OEVectorBindings <OEChem_OEVectorBindings>` class converts :term:`SMARTS`
   patterns written using vector bindings (human readable form) to the
   corresponding machine readable form by performing a name to pattern
   replacement.

   .. oe:method:: Constructors

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

         .. oe:api::

            OEVectorBindings()
            OEVectorBindings(const OEVectorBindings &)

      .. oe:language:: python

         .. oe:api:: python

            OEVectorBindings() -> OEVectorBindings
            OEVectorBindings(arg2: OEVectorBindings) -> OEVectorBindings

      Default and copy constructors.

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

      .. oe:api::

         OEVectorBindings &operator=(const OEVectorBindings &)

      Assignment operator.


   .. oe:method:: Add

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

         .. oe:api::

            bool Add(const char* label, const char* pattern)

      .. oe:language:: python

         .. oe:api:: python

            Add(label: str, pattern: str) -> bool

      Adds one vector binding to an :ref:`OEVectorBindings <OEChem_OEVectorBindings>`
      object.
      The 'label' given as the first method argument is the name that
      appears in the human readable version of a :term:`SMARTS`, while
      the 'pattern' given as the second method argument is the
      :term:`SMARTS` that should be used to replace the ''label''.
      If the 'pattern' is parsed correctly and the association is made
      in the :ref:`OEVectorBindings <OEChem_OEVectorBindings>` object, the method will return
      ``true``.
      If the 'pattern' is invalid or the association cannot be made
      the method will return ``false``.
      All attempts to associate a :term:`SMARTS` pattern with a
      particular 'label' after the first association succeeds will
      result subsequent failures to create new associations.

   .. oe:method:: Get

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

         .. oe:api::

            bool Get(const OEExprBase *&expr, const char *&label,
                     const char* smarts) const

      .. oe:language:: python

         .. oe:api:: python

            Get(expr: OEExprBase, label: str, smarts: str) -> bool

      Retrieves the 'label' and corresponding
      :ref:`OEExprBase <OEChem_OEExprBase>` pointer reference as the first and
      second method arguments, respectively, given a pointer to a
      position within a `smarts` string given as the final
      argument.
      If the 'smarts' string position points to the beginning of a
      vector bound 'label' contained in the
      :ref:`OEVectorBindings <OEChem_OEVectorBindings>` object then the method will
      return ``true``.
      If the vector binding cannot be identified then the method will
      return ``false``.
