.. oe:namespace:: OEChem



.. meta::
   :keywords: OEMutableCoords, MutableCoords


.. _OEChem_OEMutableCoords:

.. oe:class:: OEMutableCoords

   .. oe:language:: python java csharp

      .. warning:: 

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

   .. oe:api::

      template<class T>
      class OEMutableCoords : public detail::OECoordsBase<T, 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.
   If a copy of the coordinates are made with
   :oe:meth:`OEChem::OEConfBase::GetCoords`, the destructor of this
   class will copy the changes made back into the conformer with
   :oe:meth:`OEChem::OEConfBase::SetCoords`. 

   .. note::

      This class can incur unnecessary copies if ``T`` does not match
      the implementation of the :ref:`OEConfBase <OEChem_OEConfBase>` and no
      modifications were actually made. Use :ref:`OEConstCoords <OEChem_OEConstCoords>`
      whenever read-only access to coordinates is acceptable. 

   .. oe:language:: c++

      :oe:src:`Listing 1<SNIPPET-OEMutableCoords-MutableCoords>` demonstrates the quickest way
      to zero all the coordinates in a conformer using the ``memset``
      function.  :ref:`OEMutableCoords <OEChem_OEMutableCoords>` it used to get
      direct access to the coordinates in an
      :ref:`OEConfBase <OEChem_OEConfBase>`. This can provide large efficiency
      gains due to the reduced need for temporary memory and copies
      like the :oe:meth:`OEChem::OEConfBase::SetCoords` method.

      .. oe:source:: MutableCoords.cpp
         :language: c++
         :refnum:   1
         :frag:     SNIPPET-OEMutableCoords

   .. oe:method:: Constructors

      .. oe:api::

         OEMutableCoords(OEConfBase* conf)

      Construct a mutable view of the coordinates in the conformer ``conf``. 

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

      .. oe:api::

         OEMutableCoords & operator=(const OEMutableCoords & rhs)

      Assignment operator.

   

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

      .. oe:api::

         operator T *()

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

   .. oe:method:: GetPtr

      .. oe:api::

         T* GetPtr()

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