.. oe:namespace:: OEGraphSim

.. meta::
   :keywords: OEFPDatabaseOptions, FPDatabaseOptions


.. _OEGraphSim_OEFPDatabaseOptions:

.. oe:class:: OEFPDatabaseOptions

   .. oe:api::

      class OEFPDatabaseOptions

   The :ref:`OEFPDatabaseOptions <OEGraphSim_OEFPDatabaseOptions>` class  allows setting options on a per-search basis.
   This class is used to control the behavior of:

   * the following methods of the :ref:`OEFPDatabase <OEGraphSim_OEFPDatabase>` class

     * :oe:meth:`OEGraphSim::OEFPDatabase::GetScores`
     * :oe:meth:`OEGraphSim::OEFPDatabase::GetSortedScores`

   * the following methods of the :ref:`OEFastFPDatabase <OEGraphSim_OEFastFPDatabase>` class

     * :oe:meth:`OEGraphSim::OEFastFPDatabase::GetAllScores`
     * :oe:meth:`OEGraphSim::OEFastFPDatabase::GetHistogram`
     * :oe:meth:`OEGraphSim::OEFastFPDatabase::GetSortedScores`
     * :oe:meth:`OEGraphSim::OEFastFPDatabase::GetRawScores`
     * :oe:meth:`OEGraphSim::OEFastFPDatabase::SortedSearch`

   .. seealso::

      * Example code in :ref:`Similarity calculation with an option class<api_OEFPDatabase_GetScores_OEFPDatabaseOptions>` section
      * Example code in :ref:`Sorted similarity calculation with an option class<api_OEFPDatabase_GetSortedScores_OEFPDatabaseOptions>` section
      * Example code in :ref:`section_examples_summary_searchfastfp` section

   The :ref:`OEFPDatabaseOptions <OEGraphSim_OEFPDatabaseOptions>` class stores the following properties:

   .. list-table::
      :widths: 100 100 100 150
      :header-rows: 1

      * - Property
        - Get method
        - Set method
        - Corresponding namespace / type

      * - cutoff value
        - :oe:meth:`GetCutoff<OEGraphSim::OEFPDatabaseOptions::GetCutoff>`
        - :oe:meth:`SetCutoff<OEGraphSim::OEFPDatabaseOptions::SetCutoff>` /
          :oe:meth:`HasCutoff<OEGraphSim::OEFPDatabaseOptions::HasCutoff>`
        - floating point number

      * - order of sorting
        - :oe:meth:`GetDescendingOrder<OEGraphSim::OEFPDatabaseOptions::GetDescendingOrder>`
        - :oe:meth:`SetDescendingOrder<OEGraphSim::OEFPDatabaseOptions::SetDescendingOrder>`
        - boolean

      * - max number of scores
        - :oe:meth:`GetLimit<OEGraphSim::OEFPDatabaseOptions::GetLimit>`
        - :oe:meth:`SetLimit<OEGraphSim::OEFPDatabaseOptions::SetLimit>`
        - integer ``0`` means no limit

      * - similarity method
        - :oe:meth:`GetSimFunc<OEGraphSim::OEFPDatabaseOptions::GetSimFunc>`
        - :oe:meth:`SetSimFunc<OEGraphSim::OEFPDatabaseOptions::SetSimFunc>`
        - :oe:constns:`OEGraphSim::OESimMeasure`

      * - :math:`\alpha` and :math:`\beta` for :oe:cls:`Tversky<OEGraphSim::OETverskySim>`
        - :oe:meth:`GetTverskyAlpha<OEGraphSim::OEFPDatabaseOptions::GetTverskyAlpha>` /
          :oe:meth:`GetTverskyBeta<OEGraphSim::OEFPDatabaseOptions::GetTverskyBeta>`
        - :oe:meth:`SetTverskyCoeffs<OEGraphSim::OEFPDatabaseOptions::SetTverskyCoeffs>`
        - floating point number

      * - numper of processors
        - :oe:meth:`GetNumProcessors<OEGraphSim::OEFPDatabaseOptions::GetNumProcessors>`
        - :oe:meth:`SetNumProcessors<OEGraphSim::OEFPDatabaseOptions::SetNumProcessors>`
        - integer ``0`` means :oe:func:`OEPlatform::OEGetNumProcessors`

   .. oe:method:: Constructors

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

         .. oe:api::

            OEFPDatabaseOptions()

      .. oe:language:: python

         .. oe:api:: python

            OEFPDatabaseOptions() -> OEFPDatabaseOptions

      Default constructor.

      .. list-table::  **Default parameters of OEFPDatabaseOptions**
         :widths: 100 100
         :header-rows: 1

         * - Property
           - Default value

         * - cutoff value
           - no cutoff set

         * - order of sorting
           - true (means descending order)

         * - max number of scores
           - 0 (means no limit)

         * - similarity method
           - :oe:const:`OEGraphSim::OESimMeasure::Tanimoto`

         * - :math:`\alpha` and :math:`\beta` for :oe:cls:`Tversky<OEGraphSim::OETverskySim>`
           - :math:`\alpha = 0.95,  \beta = 0.05`

         * - number of processors
           - 1

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

         .. oe:api::

            OEFPDatabaseOptions(const unsigned limit,
                                const unsigned simfunc = OESimMeasure::Tanimoto)

      .. oe:language:: python

         .. oe:api:: python

            OEFPDatabaseOptions(limit: int, simfunc: int) -> OEFPDatabaseOptions

      Constructs an :ref:`OEFPDatabaseOptions <OEGraphSim_OEFPDatabaseOptions>` object with
      a limit on the number of similarity scores returned and a similarity
      method from the :oe:constns:`OEGraphSim::OESimMeasure` namespace.
      The returned scores will be in descending order and applying no
      cutoff value.

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

         .. oe:api::

            OEFPDatabaseOptions(const OEFPDatabaseOptions& rhs)

      .. oe:language:: python

         .. oe:api:: python

            OEFPDatabaseOptions(arg2: OEFPDatabaseOptions) -> OEFPDatabaseOptions

      Copy constructors.


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

      .. oe:api::

         OEFPDatabaseOptions &operator=(const OEFPDatabaseOptions &rhs)

      Assignment operator.


   .. oe:method:: ClearCutoff

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

         .. oe:api::

            void ClearCutoff()

      .. oe:language:: python

         .. oe:api:: python

            ClearCutoff() -> None

      Removes the cutoff value previously set by the
      :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetCutoff` method.
      After clearing the cutoff value, :oe:meth:`OEGraphSim::OEFPDatabaseOptions::HasCutoff`
      method will return ``false``.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::HasCutoff` method
         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::GetCutoff` method
         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetCutoff` method


   .. oe:method:: GetCutoff

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

         .. oe:api::

            float GetCutoff() const

      .. oe:language:: python

         .. oe:api:: python

            GetCutoff() -> float

      Returns the cutoff value previously set by the
      :oe:meth:`OEGraphSim::OEFPDatabase::SetCutoff` method.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::ClearCutoff` method
         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::HasCutoff` method
         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetCutoff` method


   .. oe:method:: GetDescendingOrder

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

         .. oe:api::

            bool GetDescendingOrder() const

      .. oe:language:: python

         .. oe:api:: python

            GetDescendingOrder() -> bool

      Returns whether the similarity scores will be returned in descending
      or in ascending order.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetDescendingOrder` method


   .. oe:method:: GetLimit

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

         .. oe:api::

            unsigned GetLimit() const

      .. oe:language:: python

         .. oe:api:: python

            GetLimit() -> int

      Returns the maximum number of similarity scores returned.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetLimit` method


   .. oe:method:: GetSimFunc

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

         .. oe:api::

            unsigned GetSimFunc() const

      .. oe:language:: python

         .. oe:api:: python

            GetSimFunc() -> int

      Returns the similarity measure used to evaluate fingerprint
      similarities.
      The return value is taken from the :oe:constns:`OEGraphSim::OESimMeasure`
      namespace.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetSimFunc` method

   .. oe:method:: GetNumProcessors

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

         .. oe:api::

            unsigned GetNumProcessors() const

      .. oe:language:: python

         .. oe:api:: python

            GetNumProcessors() -> int

      Returns the number of threads that are used to search
      fingerprints when calling the
      :oe:meth:`OEGraphSim::OEFastFPDatabase::SortedSearch` method.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetNumProcessors` method

   .. oe:method:: GetTverskyAlpha

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

         .. oe:api::

            float GetTverskyAlpha() const

      .. oe:language:: python

         .. oe:api:: python

            GetTverskyAlpha() -> float

      Returns the :math:`\alpha` parameter of the
      :oe:cls:`Tversky<OEGraphSim::OETverskySim>` similarity.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetTverskyCoeffs` method
         * :ref:`OETverskySim <OEGraphSim_OETverskySim>` class


   .. oe:method:: GetTverskyBeta

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

         .. oe:api::

            float GetTverskyBeta() const

      .. oe:language:: python

         .. oe:api:: python

            GetTverskyBeta() -> float

      Returns the :math:`\beta` parameter of the
      :oe:cls:`Tversky<OEGraphSim::OETverskySim>` similarity.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetTverskyCoeffs` method
         * :ref:`OETverskySim <OEGraphSim_OETverskySim>` class


   .. oe:method:: HasCutoff

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

         .. oe:api::

            bool HasCutoff() const

      .. oe:language:: python

         .. oe:api:: python

            HasCutoff() -> bool

      Returns whether the cutoff value of the :ref:`OEFPDatabaseOptions <OEGraphSim_OEFPDatabaseOptions>`
      object has been set by the :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetCutoff` method.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::ClearCutoff` method
         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::GetCutoff` method
         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::SetCutoff` method


   .. oe:method:: SetCutoff

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

         .. oe:api::

            void SetCutoff(const float cutoff)

      .. oe:language:: python

         .. oe:api:: python

            SetCutoff(cutoff: float) -> None

      Sets the cutoff value of the :ref:`OEFPDatabaseOptions <OEGraphSim_OEFPDatabaseOptions>`
      object.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::ClearCutoff` method
         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::GetCutoff` method
         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::HasCutoff` method


   .. oe:method:: SetDescendingOrder

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

         .. oe:api::

            void SetDescendingOrder(const bool descending = true)

      .. oe:language:: python

         .. oe:api:: python

            SetDescendingOrder(descending: bool = True) -> None

      Sets whether the similarity scores will be returned in descending
      or in ascending order.

      .. note::

         This method has no effect on the
         :oe:meth:`OEGraphSim::OEFPDatabase::GetScores` method.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::GetDescendingOrder` method


   .. oe:method:: SetLimit

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

         .. oe:api::

            void SetLimit(const unsigned limit)

      .. oe:language:: python

         .. oe:api:: python

            SetLimit(limit: int) -> None

      Sets the maximum number of similarity scores returned.

      **limit**
         If it is set to zero, then all similarity scores are returned.

      .. note::

         This method has no effect on the
         :oe:meth:`OEGraphSim::OEFPDatabase::GetScores` method.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::GetLimit` method


   .. oe:method:: SetSimFunc

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

         .. oe:api::

            void SetSimFunc(const unsigned simtype)

      .. oe:language:: python

         .. oe:api:: python

            SetSimFunc(simfunc: int) -> None

      Sets the similarity measure used to evaluate fingerprint
      similarities.

      **simtype**
         This value has to be from the :oe:constns:`OEGraphSim::OESimMeasure`
         namespace.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::GetSimFunc` method


   .. oe:method:: SetNumProcessors

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

         .. oe:api::

            void SetNumProcessors(const unsigned nrps)

      .. oe:language:: python

         .. oe:api:: python

            SetNumProcessors(nrps: int) -> None

      Sets the number of threads that are used to search
      fingerprints when calling the
      :oe:meth:`OEGraphSim::OEFastFPDatabase::SortedSearch` method.
      When set to ``0``, the number of processors used will be the number
      returned by the :oe:func:`OEPlatform::OEGetNumProcessors` function.

      Multi-threaded fingerprint search is currently only available in
      :oe:const:`OEGraphSim::OEFastFPDatabaseMemoryType::MemoryMapped` and
      :oe:const:`OEGraphSim::OEFastFPDatabaseMemoryType::InMemory` modes.

   .. oe:method:: SetTverskyCoeffs

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

         .. oe:api::

            void SetTverskyCoeffs(const float alpha = 0.95f,
                                  const float beta = 0.05f)

      .. oe:language:: python

         .. oe:api:: python

            SetTverskyCoeffs(alpha: float = 0.95, beta: float = 0.05) -> None

      Sets :math:`\alpha` and :math:`\beta` parameters for the
      :oe:cls:`Tversky<OEGraphSim::OETverskySim>` similarity.

      .. seealso::

         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::GetTverskyAlpha` method
         * :oe:meth:`OEGraphSim::OEFPDatabaseOptions::GetTverskyBeta` method
         * :ref:`OETverskySim <OEGraphSim_OETverskySim>` class
