.. oe:namespace:: OEChem



.. meta::
   :keywords: OEConstCoords, ConstCoords


.. _OEChem_OEConstCoords:

.. oe:class:: OEConstCoords

   .. oe:language:: python java csharp

      .. warning:: 

         This class is only usable from the OpenEye C++ toolkits. 

   .. oe:api::

      template<class T>
      class OEConstCoords : public detail::OECoordsBase<const T, const OEConfBase>

   This class is used to provide convenient direct access to the
   memory storing coordinates for a :ref:`OEConfBase <OEChem_OEConfBase>`
   through the :oe:meth:`OEChem::OEConfBase::GetCoordsPtr` methods. If
   the data type of ``T`` does not match the implementation of
   :ref:`OEConfBase <OEChem_OEConfBase>`, this class makes a copy of the
   coordinates with :oe:meth:`OEChem::OEConfBase::GetCoords` instead.

   .. oe:language:: c++

      :oe:src:`Listing 1<SNIPPET-OEConstCoords-ConstCoords>` demonstrates how
      :ref:`OEConstCoords <OEChem_OEConstCoords>` can be used to get direct access
      to the coordinates in an :ref:`OEConfBase <OEChem_OEConfBase>` for a
      center-of-mass calculation. This can provide large efficiency
      gains due to the reduced need for temporary memory and copies
      like the :oe:meth:`OEChem::OEConfBase::GetCoords` method. 

      .. oe:source:: ConstCoords.cpp
         :language: c++
         :refnum:   1
         :frag:     SNIPPET-OEConstCoords


   .. seealso::

      This class only provides ``const`` read-only access, use
      :ref:`OEMutableCoords <OEChem_OEMutableCoords>` for write-access as well.

   .. oe:method:: Constructors

      .. oe:api::

         OEConstCoords(const OEConfBase* conf)

      Construct a read-only view of the coordinates in the conformer ``conf``. 

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

      .. oe:api::

         OEConstCoords & operator=(const OEConstCoords & rhs)

      Assignment operator.

   

   .. oe:method:: operator const T *
      :language: c++

      .. oe:api::

         operator const T *() const

      Allows implicitly casting this object into a const pointer of type
      ``T`` to the coordinates of the conformer used in the
      constructor.

   .. oe:method:: GetPtr

      .. oe:api::

         const T* GetPtr() const

      Returns a const pointer of type ``T`` to the coordinates of the
      conformer used in the constructor.

