.. oe:namespace:: OESystem



.. meta::
   :keywords: OEBase


.. _OESystem_OEBase:

.. oe:class:: OEBase

   .. oe:api::


      class OEBase

   This class represents `OEBase`.

   The abstract class :ref:`OEBase <OESystem_OEBase>` defines the interface for run-time class
   extensibility and run-time type identification. Classes which
   derive from :ref:`OEBase <OESystem_OEBase>` can store and retrieve data by association with
   integer or character string 'tag' identifiers.

   .. oe:language:: c++

      All primitive data types and user-defined classes which have valid copy constructors
      and assignment operators can be stored through the mechanism
      provided by :ref:`OEBase <OESystem_OEBase>`.

   .. oe:language:: python java csharp

      All primitive data types can be stored through the mechanism provided by
      :ref:`OEBase <OESystem_OEBase>`.

   The following classes derive from this class:

    * :ref:`OEAtomBase <OEChem_OEAtomBase>`
    * :ref:`OEBondBase <OEChem_OEBondBase>`
    * :ref:`OEConfBase <OEChem_OEConfBase>`
    * :ref:`OEGraphMol <OEChem_OEGraphMol>`
    * :ref:`OEMCMolBase <OEChem_OEMCMolBase>`
    * :ref:`OEMolBase <OEChem_OEMolBase>`
    * :ref:`OEQAtomBase <OEChem_OEQAtomBase>`
    * :ref:`OEQBondBase <OEChem_OEQBondBase>`
    * :ref:`OEQMolBase <OEChem_OEQMolBase>`
    * :ref:`OEAnnotation <OESystem_OEAnnotation>`
    * :ref:`OEBinaryIOHandler <OESystem_OEBinaryIOHandler>`
    * :ref:`OEBinaryIOHandlerBase <OESystem_OEBinaryIOHandlerBase>`
    * :ref:`OEContainer <OESystem_OEContainer>`
    * :ref:`OEFixedGrid <OESystem_OEFixedGrid>`
    * :ref:`OEFixedMultiGrid <OESystem_OEFixedMultiGrid>`
    * :ref:`OEGaussian <OESystem_OEGaussian>`
    * :ref:`OEGaussianBase <OESystem_OEGaussianBase>`
    * :ref:`OEGaussianContainer <OESystem_OEGaussianContainer>`
    * :ref:`OEGaussianContainerBase <OESystem_OEGaussianContainerBase>`
    * :ref:`OEGrid <OESystem_OEGrid>`
    * :ref:`OEGridAbstractBase <OESystem_OEGridAbstractBase>`
    * :ref:`OEGridBase <OESystem_OEGridBase>`
    * :ref:`OEHeader <OESystem_OEHeader>`
    * :ref:`OEMultiGrid <OESystem_OEMultiGrid>`
    * :ref:`OEScalarGrid <OESystem_OEScalarGrid>`
    * :ref:`OESkewGrid <OESystem_OESkewGrid>`

   .. oe:method:: Constructors

      .. oe:api::

         OEBase()
         OEBase(const OEBase& rhs)

      Default and copy constructors.

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

      .. oe:api::

         OEBase& operator=(const OEBase &)

      Assignment operator.


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

      .. oe:api::

         OEBase& operator+=(const OEBase &)

   .. oe:method:: AddBaseData

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

         .. oe:api::

            bool AddBaseData(const OEBaseData *)

      .. oe:language:: python

         .. oe:api:: python

            AddBaseData(arg2: OEBaseData) -> bool

   .. oe:method:: AddData

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

         .. oe:api::

            template<typename T>
            bool AddData(const char* tag, const T t)
            template<typename T>
            bool AddData(unsigned int tag, const T t)

      .. oe:language:: python

         .. oe:api:: python

            AddData(tag: str, data: object) -> bool

      Stores and associates a copy of the data
      passed as the second argument with the 'tag' identifier given as
      the first argument. Integer tags should be allocated using the
      :oe:func:`OESystem::OEGetTag` function. Multiple calls to
      :oe:meth:`OESystem::OEBase::AddData` of a
      :ref:`OEBase <OESystem_OEBase>` derived class instance will result in multiple copies of
      data being stored. The :oe:meth:`OESystem::OEBase::AddData` method
      does not overwrite data
      stored by previous calls.

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

         .. oe:api::

            template<typename T>
            bool AddData(const char* tag, const T t, unsigned int len)
            template<typename T>
            bool AddData(unsigned int tag, const T t, unsigned int len)

      .. oe:language:: python

         .. oe:api:: python

            AddData(tag: str, data: object) -> bool


      Stores and associates a copy of the data
      pointed to by the second argument with the 'tag' identifier given
      as the first argument. The third argument passed to the method
      is used to denote the length of the array pointed to by the
      second argument. The array length must be specified so that
      data can be copied directly. Integer tags should be allocated
      using the :oe:func:`OESystem::OEGetTag` function. Multiple calls to
      :oe:meth:`OESystem::OEBase::AddData` of a :ref:`OEBase <OESystem_OEBase>`
      derived class instance will result in
      multiple copies of data being stored. The
      :oe:meth:`OESystem::OEBase::AddData` method does
      not overwrite data stored by previous calls.


   .. oe:method:: Clear

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

         .. oe:api::

            void Clear()

      .. oe:language:: python

         .. oe:api:: python

            Clear() -> None

      Clears all data stored using the :oe:meth:`OESystem::OEBase::AddData` and
      :oe:meth:`OESystem::OEBase::SetData` methods.
      When writing classes derived from :ref:`OEBase <OESystem_OEBase>` the
      :oe:meth:`OESystem::OEBase::Clear` method should be chained to call
      the parent class :oe:meth:`OESystem::OEBase::Clear` method.

   .. oe:method:: CreateCopy

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

         .. oe:api::

            OEBase* CreateCopy() const = 0

      .. oe:language:: python

         .. oe:api:: python

            CreateCopy() -> OEBase

      This pure virtual copy constructor should return a deep copy of
      the :ref:`OEBase <OESystem_OEBase>` derived object. The copy of the object returned is
      dynamically allocated and should be deallocated using the C++
      delete operator.

   .. oe:method:: DeleteData

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

         .. oe:api::

            bool DeleteData(const char* tag)
            bool DeleteData(unsigned int tag)

      .. oe:language:: python

         .. oe:api:: python

            DeleteData(tag: str) -> bool
            DeleteData(tag: int) -> bool

      Deletes all instances of data stored with the
      :oe:meth:`OESystem::OEBase::AddData` and :oe:meth:`OESystem::OEBase::SetData`
      methods which are associated with the data
      'tag' passed to the method. The method will return ``true`` if any
      data was deleted, and ``false`` if not data associated with the
      data tag was found.

   .. oe:method:: GetBoolData

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

         .. oe:api::

            bool GetBoolData(const char* tag) const
            bool GetBoolData(unsigned int tag) const

      .. oe:language:: python

         .. oe:api:: python

            GetBoolData(tag: str) -> bool
            GetBoolData(tag: int) -> bool

      Returns the first instance of boolean data stored
      previously with the associated data tag. This method is
      equivalent to calling the :oe:meth:`OESystem::OEBase::GetData`
      method with template argument bool.

   .. oe:method:: GetData

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

         .. oe:api::

            template<typename T>
            const T& GetData(const char* tag) const
            template<typename T>
            const T& GetData(unsigned int tag) const

      .. oe:language:: python

         .. oe:api:: python

            GetData() -> dict
            GetData(tag: str) -> PyObject
            GetData(t: int) -> PyObject

      Returns the first instance of data stored
      previously with the associated data tag. Integer tags should be
      allocated using the :oe:func:`OESystem::OEGetTag` function. Run-time
      type checking is performed when data is requested. A data type
      mismatch between the storage and request types will result in a
      default data instance being returned instead of the original
      data. Request for datum not present will also result in a
      default data instance being returned.

   .. oe:method:: GetDataIter

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

         .. oe:api::

            OESystem::OEIterBase<OESystem::OEBaseData>* GetDataIter() const

      .. oe:language:: python

         .. oe:api:: python

            GetDataIter() -> OEBaseDataIter

      Returns an iterator over data stored in an
      :ref:`OEBase <OESystem_OEBase>` derived class instance. Data tag identification,
      run-time type checking, and data retrieval can be performed
      using the :ref:`OEBaseData <OESystem_OEBaseData>` API.

      .. seealso::

         * :ref:`OEBaseDataT <OESystem_OEBaseDataT>` template class

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

         .. oe:api::

            OESystem::OEIterBase<OESystem::OEBaseData>* GetDataIter(unsigned int tag) const

      .. oe:language:: python

         .. oe:api:: python

            GetDataIter(tag: int) -> OEBaseDataIter

      Returns an iterator over all generic data attached to the
      :ref:`OEBase <OESystem_OEBase>` object with the given data *tag*.

      .. seealso::

         * :ref:`OEBaseDataT <OESystem_OEBaseDataT>` template class

   .. oe:method:: GetDataType

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

         .. oe:api::

            const void* GetDataType() const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetDataType() -> void

      This pure virtual function is used to perform run-time type
      identification. The value returned by the method should be
      equivalent to the value returned by :oe:func:`OESystem::OEGetDataType`
      using the derived class type as the template argument.

   .. oe:method:: GetDoubleData

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

         .. oe:api::

            double GetDoubleData(const char* tag) const
            double GetDoubleData(unsigned int tag) const

      .. oe:language:: python

         .. oe:api:: python

            GetDoubleData(tag: str) -> float
            GetDoubleData(tag: int) -> float

      Returns the first instance of double precision
      floating point data stored previously with the associated data
      tag. This method is equivalent to calling the
      :oe:meth:`OESystem::OEBase::GetData` method
      with template argument ``double``.



   .. oe:method:: GetFloatData

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

         .. oe:api::

            float GetFloatData(const char* tag) const
            float GetFloatData(unsigned int tag) const

      .. oe:language:: python

         .. oe:api:: python

            GetFloatData(tag: str) -> float
            GetFloatData(tag: int) -> float

      Returns the first instance of single precision
      floating point data stored previously with the associated data
      tag. This method is equivalent to calling the
      :oe:meth:`OESystem::OEBase::GetData` method
      with template argument ``float``.



   .. oe:method:: GetIntData

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

         .. oe:api::

            int GetIntData(const char* tag) const
            int GetIntData(unsigned int tag) const

      .. oe:language:: python

         .. oe:api:: python

            GetIntData(tag: str) -> int
            GetIntData(tag: int) -> int

      Returns the first instance of integer data stored
      previously with the associated data tag. This method is
      equivalent to calling the :oe:meth:`OESystem::OEBase::GetData`
      method with template argument ``int``.



   .. oe:method:: GetStringData

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

         .. oe:api::

            const std::string& GetStringData(const char* tag) const
            const std::string& GetStringData(unsigned int tag) const

      .. oe:language:: python

         .. oe:api:: python

            GetStringData(tag: str) -> str
            GetStringData(tag: int) -> str

      Returns the first instance of an STL string stored
      previously with the associated data tag. This method is
      equivalent to calling the :oe:meth:`OESystem::OEBase::GetData`
      method with template argument ``std::string``.



   .. oe:method:: HasData

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

         .. oe:api::

            bool HasData(const char* tag) const
            bool HasData(unsigned int tag) const

      .. oe:language:: python

         .. oe:api:: python

            HasData(tag: str) -> bool
            HasData(tag: int) -> bool

      Returns ``true`` if any data stored in an :ref:`OEBase <OESystem_OEBase>`
      derived object is associated with a particular data tag
      identifier. If no stored data is associated with the passed data
      'tag' the methods return ``false``.



   .. oe:method:: IsDataType

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

         .. oe:api::

            bool IsDataType(const void *) const = 0

      .. oe:language:: python

         .. oe:api:: python

            IsDataType(arg2: void) -> bool

      This method is used for run-time type identification of :ref:`OEBase <OESystem_OEBase>`
      derived classes. The const void pointer argument passed to the
      function should be a value returned by the template function
      :oe:func:`OESystem::OEGetDataType`. The :oe:meth:`OESystem::OEBase::IsDataType`
      method will return
      ``true`` if the data type identifier passed to the function matches
      at least one of the data types in the inheritance tree of the
      requested :ref:`OEBase <OESystem_OEBase>` derived object. The method will return ``false``
      if the data type identifier passed to the method fails to match
      any class type in the inheritance tree of the requested :ref:`OEBase <OESystem_OEBase>`
      derived object. Implementations of this pure virtual method
      should chain to their parent class' :oe:meth:`OESystem::OEBase::IsDataType`
      method.



   .. oe:method:: SetBaseData

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

         .. oe:api::

            bool SetBaseData(const OEBaseData *)

      .. oe:language:: python

         .. oe:api:: python

            SetBaseData(arg2: OEBaseData) -> bool


   .. oe:method:: SetBoolData

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

         .. oe:api::

            bool SetBoolData(const char* tag, bool t)
            bool SetBoolData(unsigned int tag, bool t)

      .. oe:language:: python

         .. oe:api:: python

            SetBoolData(tag: str, t: bool) -> bool
            SetBoolData(tag: int, t: bool) -> bool

      Stores boolean values associated with the passed data
      'tag' identifiers. The methods are equivalent to the
      :oe:meth:`OESystem::OEBase::SetData` method
      called with a boolean value.



   .. oe:method:: SetData

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

         .. oe:api::

            template<typename T>
            bool SetData(const char* tag, const T t)
            template<typename T>
            bool SetData(unsigned int tag, const T t)

      .. oe:language:: python

         .. oe:api:: python

            SetData(tag: str, data: object) -> bool

      Stores a copy of primitive or user-defined
      data passed as the second argument with a data 'tag' identifier
      passed as the first argument. If data of the same type has been
      stored using the identical tag in a previous
      :oe:meth:`OESystem::OEBase::AddData` or :oe:meth:`OESystem::OEBase::SetData`
      call, subsequent calls to :oe:meth:`OESystem::OEBase::SetData` will
      overwrite the first instance
      of data stored with the data tag. If a call to SetData succeeds in
      storing or overwriting previously stored data the method will
      return ``true``. :oe:meth:`OESystem::OEBase::SetData` will return
      ``false`` if a copy of the data cannot
      be made. If data has been stored previously associated with a data
      tag, subsequent calls to :oe:meth:`OESystem::OEBase::SetData` with
      the identical data 'tag' but
      with different data type will result in a run-time warning being
      written and a return value of ``false``. Note that these methods will
      not make copies of data passed by pointer. Values to be passed by
      pointer, or arrays, should be stored using the following
      :oe:meth:`OESystem::OEBase::SetData`
      methods.

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

         .. oe:api::

            template<typename T>
            bool SetData(const char* tag, const T t, unsigned int len)
            template<typename T>
            bool SetData(unsigned int tag, const T t, unsigned int len)

      .. oe:language:: python

         .. oe:api:: python

            SetData(tag: str, data: object) -> bool

      Stores copies of arrays of primitive or
      user-defined data passed as the second argument with a data tag
      identifier passed as the first argument. The length of the array
      (number of elements) is passed as the third argument to the
      method. If data of the same type has been stored using the
      identical 'tag' in a previous :oe:meth:`OESystem::OEBase::AddData` or
      :oe:meth:`OESystem::OEBase::SetData` call, subsequent
      calls to :oe:meth:`OESystem::OEBase::SetData` will overwrite the
      first instance of data
      stored with the data tag. The array copy stored previously will
      be deallocated and a copy of the new array will be stored. If a
      call to :oe:meth:`OESystem::OEBase::SetData` succeeds in storing
      or overwriting an array
      stored previously the method will return ``true``.
      :oe:meth:`OESystem::OEBase::SetData` will
      return ``false`` if a copy of the data cannot be made. If data has
      been stored previously associated with a data tag, subsequent
      calls to :oe:meth:`OESystem::OEBase::SetData` with the identical data
      'tag' but with different
      data type will result in a run-time warning being written and a
      return value of ``false``.



   .. oe:method:: SetDoubleData

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

         .. oe:api::

            bool SetDoubleData(const char* tag, double t)
            bool SetDoubleData(unsigned int tag, double t)

      .. oe:language:: python

         .. oe:api:: python

            SetDoubleData(tag: str, t: float) -> bool
            SetDoubleData(tag: int, t: float) -> bool

      Stores and associates double precision floating
      point values passed as the second argument with the data tag
      provided as the first argument. The methods are provided for
      convenience and are functionally equivalent to calls to
      :oe:meth:`OESystem::OEBase::SetData`
      where the template argument is a double precision floating point
      number.



   .. oe:method:: SetFloatData

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

         .. oe:api::

            bool SetFloatData(const char* tag, float t)
            bool SetFloatData(unsigned int tag, float t)

      .. oe:language:: python

         .. oe:api:: python

            SetFloatData(tag: str, t: float) -> bool
            SetFloatData(tag: int, t: float) -> bool

      Stores and associates single precision floating
      point values passed as the second argument with the data tag
      provided as the first argument. The methods are provided for
      convenience and are functionally equivalent to calls to
      :oe:meth:`OESystem::OEBase::SetData`
      where the template argument is a single precision floating point
      number.



   .. oe:method:: SetIntData

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

         .. oe:api::

            bool SetIntData(const char* tag, int t)
            bool SetIntData(unsigned int tag, int t)

      .. oe:language:: python

         .. oe:api:: python

            SetIntData(tag: str, t: int) -> bool
            SetIntData(tag: int, t: int) -> bool

      Stores and associates integer values passed as the
      second argument with the data 'tag' provided as the first
      argument. The methods are provided for convenience and are
      functionally equivalent to calls to
      :oe:meth:`OESystem::OEBase::SetData` where the template
      argument is an integer value.



   .. oe:method:: SetStringData

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

         .. oe:api::

            bool SetStringData(const char* tag, const std::string t)
            bool SetStringData(unsigned int tag, const std::string t)

      .. oe:language:: python

         .. oe:api:: python

            SetStringData(tag: str, t: str) -> bool
            SetStringData(tag: int, t: str) -> bool

      Stores and associates ``std::string`` passed as the
      second argument with the data 'tag' provided as the first
      argument. The methods are provided for convenience and are
      functionally equivalent to calls to :oe:meth:`OESystem::OEBase::SetData`
      where the template argument is a ``std::string``.

