.. include:: ../../toolkit-substitutions

.. oe:namespace:: OESaiph


.. meta::
   :keywords: OEMolFileConverter, MolFileConverter


.. _OESaiph_OEMolFileConverter:

.. oe:class:: OEMolFileConverter

   .. attention::

      |PRELIMINARY-API|

   .. oe:api::

      class OEMolFileConverter

   The :ref:`OEMolFileConverter <OESaiph_OEMolFileConverter>` class extracts data from any
   files that pass the :oe:func:`OEChem::OEIsReadable` check into OERecords. Custom data extraction based on
   :ref:`OEField <OEDataFlow_OEField>` inclusion (SD and generic data) and the addition of conformer
   tests can be set up through the :ref:`OEMolConversionOptions <OESaiph_OEMolConversionOptions>`.
   
   .. oe:method:: Constructors

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

         .. oe:api::

            OEMolFileConverter()
            OEMolFileConverter(const OEMolFileConverter &)

      .. oe:language:: python

         .. oe:api:: python

            OEMolFileConverter() -> OEMolFileConverter
            OEMolFileConverter(arg2: OEMolFileConverter) -> OEMolFileConverter

   .. oe:method:: Open

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

         .. oe:api::

            bool Open(const std::string& path,
                      const std::string& displayName = std::string()) override
            bool Open(const std::string& path,
                      const OEMolConversionOptions& options,
                      const std::string& displayName = std::string())

      .. oe:language:: python

         .. oe:api:: python

            Open(path: str, displayName: str = str()) -> bool
            Open(path: str, options: OEMolConversionOptions,
                 displayName: str = str()) -> bool

      Returns a boolean based on whether the file can be opened.
      :ref:`OEMolConversionOptions <OESaiph_OEMolConversionOptions>`
      is set at open.

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

      .. oe:api::

         OEMolFileConverter &operator=(const OEMolFileConverter &)

      Assignment operator.


   .. oe:method:: Close

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

         .. oe:api::

            void Close()

      .. oe:language:: python

         .. oe:api:: python

            Close() -> None

      Closes the stream.

   .. oe:method:: GetNextRecord

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

         .. oe:api::

            unsigned int GetNextRecord(OEDataFlow::OEMolRecord& record) override

      .. oe:language:: python

         .. oe:api:: python

            GetNextRecord(record: OEMolRecord) -> int

      Steps through each row of the file adding to the :ref:`OEMolRecord <OEDataFlow_OEMolRecord>`
      passed into the function. The function returns constants based on each pass.
      Return codes: ``SaiphReturnCode::Success``, ``SaiphReturnCode::Fail``, ``SaiphReturnCode::EndOfFile``

   .. oe:method:: GetProgress

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

         .. oe:api::

            float GetProgress()

      .. oe:language:: python

         .. oe:api:: python

            GetProgress() -> float

      Returns the percentage of the file that has been traversed.

   .. oe:method:: GetSchemaRecord

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

         .. oe:api::

            OEDataFlow::OEMolRecord GetSchemaRecord() const

      .. oe:language:: python

         .. oe:api:: python

            GetSchemaRecord() -> OEMolRecord

      Returns an :ref:`OEMolRecord <OEDataFlow_OEMolRecord>` schema of the :ref:`OERecord <OEDataFlow_OERecord>` produced in each 
      :oe:meth:`OESaiph::OEMolFileConverter::GetNextRecord` iteration. If a schema record was not given to the
      :ref:`OEMolConversionOptions <OESaiph_OEMolConversionOptions>`, one is produced after running
      :oe:meth:`OESaiph::OEMolFileConverter::Open` with a valid file.

