/*
 * #%L
 * OME-XML C++ library for working with OME-XML metadata structures.
 * %%
 * Copyright © 2006 - 2016 Open Microscopy Environment:
 *   - Massachusetts Institute of Technology
 *   - National Institutes of Health
 *   - University of Dundee
 *   - Board of Regents of the University of Wisconsin-Madison
 *   - Glencoe Software, Inc.
 * %%
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * The views and conclusions contained in the software and documentation are
 * those of the authors and should not be interpreted as representing official
 * policies, either expressed or implied, of any organization.
 * #L%
 */

/*─────────────────────────────────────────────────────────────────────────────
 *
 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY.
 *
 *─────────────────────────────────────────────────────────────────────────────
 */

#ifndef OME_XML_MODEL_MICROBEAMMANIPULATION_H
#define OME_XML_MODEL_MICROBEAMMANIPULATION_H

#include <algorithm>
#include <list>
#include <stdexcept>
#include <string>
#include <vector>

#include <ome/common/log.h>

#include <ome/common/xml/dom/Document.h>
#include <ome/common/xml/dom/Element.h>
#include <ome/common/xml/dom/Node.h>
#include <ome/common/xml/dom/NodeList.h>

#include <ome/xml/model/Experiment.h>
#include <ome/xml/model/Experimenter.h>
#include <ome/xml/model/detail/OMEModelObject.h>
#include <ome/xml/model/enums/MicrobeamManipulationType.h>

namespace ome
{
  namespace xml
  {
    namespace model
    {

      // Forward declarations.
      class Image;
      class LightSourceSettings;
      class OMEModel;
      class ROI;

      /**
       * MicrobeamManipulation model object.
       */
      class MicrobeamManipulation : public detail::OMEModelObject
      {
      private:
        class Impl;
        /// Private implementation details.
        ome::compat::shared_ptr<Impl> impl;

      public:
        /// Default constructor.
        MicrobeamManipulation();

        /**
         * Copy constructor.
         *
         * @param copy the MicrobeamManipulation to copy.
         */
        MicrobeamManipulation (const MicrobeamManipulation& copy);

        /// Destructor.
        virtual
        ~MicrobeamManipulation ();

        /**
         * Create a MicrobeamManipulation model object from DOM element.
         *
         * @param element root of the XML DOM tree to from which to
         * construct the model object graph.
         * @param model handler for the OME model used to track
         * instances and references seen during the update.
         * @throws EnumerationException if there is an error
         * instantiating an enumeration during model object creation,
         * or ModelException if there are any consistency or validity
         * errors found during processing.
         *
         * @returns a new model object.
         */
        static ome::compat::shared_ptr< MicrobeamManipulation>
        create(const common::xml::dom::Element& element,
               ome::xml::model::OMEModel& model);

        // Documented in superclass.
        const std::string&
        elementName() const;

        // Documented in superclass.
        bool
        validElementName(const std::string& name) const;


        // -- OMEModelObject API methods --

        /// @copydoc ome::xml::model::OMEModelObject::update
        virtual void
        update(const common::xml::dom::Element&  element,
               ome::xml::model::OMEModel& model);

      public:
        // -- MicrobeamManipulation API methods --

        /// @copydoc ome::xml::model::OMEModelObject::link
        bool
        link (ome::compat::shared_ptr<Reference>& reference,
              ome::compat::shared_ptr< ome::xml::model::OMEModelObject>& object);

        /**
         * Get the Type property.
         *
         * @returns the Type property.
         */
        ome::compat::shared_ptr<ome::xml::model::enums::MicrobeamManipulationType>
        getType ();

        /**
         * Get the Type property.
         *
         * @returns the Type property.
         */
        const ome::compat::shared_ptr<ome::xml::model::enums::MicrobeamManipulationType>
        getType () const;

        /**
         * Set the Type property.
         *
         * @param type the value to set.
         */
        void
        setType (ome::compat::shared_ptr<ome::xml::model::enums::MicrobeamManipulationType>& type);

        /**
         * Get the ID property.
         *
         * @returns the ID property.
         */
        const std::string&
        getID () const;

        /**
         * Set the ID property.
         *
         * @param id the value to set.
         */
        void
        setID (const std::string& id);

        /**
         * Get the Description property.
         *
         * @returns the Description property.
         */
        ome::compat::shared_ptr<std::string>
        getDescription ();

        /**
         * Get the Description property.
         *
         * @returns the Description property.
         */
        const ome::compat::shared_ptr<std::string>
        getDescription () const;

        /**
         * Set the Description property.
         *
         * @param description the value to set.
         */
        void
        setDescription (ome::compat::shared_ptr<std::string>& description);

        /**
         * Get size of linked ROI list.
         *
         * @returns the size of the list.
         */
        OMEModelObject::indexed_container<ome::xml::model::ROI, ome::compat::weak_ptr>::type::size_type
        sizeOfLinkedROIList () const;

        /**
         * Get the linked ROI list.
         *
         * @returns a reference to the list.
         */
        OMEModelObject::indexed_container<ome::xml::model::ROI, ome::compat::weak_ptr>::type
        getLinkedROIList () const;

        /**
         * Get linked ROI.
         *
         * @param index the index number of the ROI.
         * @returns a weak pointer to the ROI.
         * @throws std::out_of_range if the index is invalid.
         */
        const ome::compat::weak_ptr<ome::xml::model::ROI>&
        getLinkedROI (OMEModelObject::indexed_container<ome::xml::model::ROI, ome::compat::weak_ptr>::type::size_type index) const;

        /**
         * Set linked ROI.
         *
         * @note The index must be valid.
         *
         * @param index the index number of the ROI.
         * @param roi the ROI to set.
         * @returns a weak pointer to the ROI.
         * @throws std::out_of_range if the index is invalid.
         */
        const ome::compat::weak_ptr<ome::xml::model::ROI>&
        setLinkedROI (OMEModelObject::indexed_container<ome::xml::model::ROI, ome::compat::weak_ptr>::type::size_type index,
                                     const ome::compat::shared_ptr<ome::xml::model::ROI>& roi);

        /**
         * Link ROI.
         *
         * @param roi the ROI to link.
         * @returns @c true if the object was added to the internal
         * roiLinks list, otherwise @c false.
         *
         * @todo Why have a return value here; what is it used for?
         * Is this an artifact of the Java API?
         */
        bool
        linkROI (const ome::compat::shared_ptr<ome::xml::model::ROI>& roi);

        /**
         * Unlink ROI.
         *
         * @param roi the ROI to unlink.
         *
         * @returns @c true if the ROI was unlinked, otherwise
         * @c false if the ROI was not linked and could hence not be
         * unlinked.
         *
         * @todo Does the return value serve any useful purpose?  Is
         * this also inherited Java API?
         * @todo Doesn't the removal break the indexing?
         * @todo Does the removal deal with multiple instances; we
         * aren't preventing duplicates on insertion.
         */
        bool
        unlinkROI (const ome::compat::shared_ptr<ome::xml::model::ROI>& roi);

        /**
         * Get linked Experimenter.
         *
         * @returns the linked Experimenter.  The pointer may be
         * null.
         */
        ome::compat::weak_ptr<ome::xml::model::Experimenter>
        getLinkedExperimenter ();

        /**
         * Get linked Experimenter.
         *
         * @returns the linked Experimenter.  The pointer may be
         * null.
         */
        const ome::compat::weak_ptr<ome::xml::model::Experimenter>
        getLinkedExperimenter () const;

        /**
         * Link Experimenter.
         *
         * @param experimenter the Experimenter to link.
         */
        void
        linkExperimenter (ome::compat::shared_ptr<ome::xml::model::Experimenter>& experimenter);

        /**
         * Unlink Experimenter.
         *
         * @param experimenter the Experimenter to unlink.
         *
         * @todo This method is fairly pointless since it's equivalent
         * to linking a null pointer.  It could call @c link(0)
         * internally.
         */
        void
        unlinkExperimenter (ome::compat::shared_ptr<ome::xml::model::Experimenter>& experimenter);

        /**
         * Get size of linked LightSourceSettings list.
         *
         * @returns the size of the list.
         */
        std::vector<ome::compat::shared_ptr<ome::xml::model::LightSourceSettings> >::size_type
        sizeOfLightSourceSettingsList () const;

        /**
         * Get the LightSourceSettings list.
         *
         * @returns a reference to the list.
         *
         */
        std::vector<ome::compat::shared_ptr<ome::xml::model::LightSourceSettings> >&
        getLightSourceSettingsList ();

        /**
         * Get the LightSourceSettings list.
         *
         * @returns a reference to the list.
         *
         */
        const std::vector<ome::compat::shared_ptr<ome::xml::model::LightSourceSettings> >&
        getLightSourceSettingsList () const;

        /**
         * Get LightSourceSettings.
         *
         * @param index the index number of the LightSourceSettings.
         * @returns the LightSourceSettings.
         * @throws std::out_of_range if the index is invalid.
         */
        ome::compat::shared_ptr<ome::xml::model::LightSourceSettings>&
        getLightSourceSettings (std::vector<ome::compat::shared_ptr<ome::xml::model::LightSourceSettings> >::size_type index);

        /**
         * Get LightSourceSettings.
         *
         * @param index the index number of the LightSourceSettings.
         * @returns the LightSourceSettings.
         * @throws std::out_of_range if the index is invalid.
         */
        const ome::compat::shared_ptr<ome::xml::model::LightSourceSettings>&
        getLightSourceSettings (std::vector<ome::compat::shared_ptr<ome::xml::model::LightSourceSettings> >::size_type index) const;

        /**
         * Set LightSourceSettings.
         *
         * @param index the index number of the LightSourceSettings.
         * @param lightSourceSettings the LightSourceSettings to set.
         * @throws std::out_of_range if the index is invalid.
         */
        void
        setLightSourceSettings (std::vector<ome::compat::shared_ptr<ome::xml::model::LightSourceSettings> >::size_type index,
                               ome::compat::shared_ptr<ome::xml::model::LightSourceSettings>& lightSourceSettings);

        /**
         * Add LightSourceSettings.
         *
         * @param lightSourceSettings the LightSourceSettings to add.
         *
         * @todo Return list position?
         * @todo Detect and handle duplicates?
         */
        void
        addLightSourceSettings (ome::compat::shared_ptr<ome::xml::model::LightSourceSettings>& lightSourceSettings);

        /**
         * Remove LightSourceSettings.
         *
         * @param lightSourceSettings the LightSourceSettings to remove.
         *
         * @todo Doesn't the removal break the indexing?
         * @todo Does the removal deal with multiple instances; we
         * aren't preventing duplicates on insertion.
         */
        void
        removeLightSourceSettings (ome::compat::shared_ptr<ome::xml::model::LightSourceSettings>& lightSourceSettings);

        /**
         * Get size of linked Image list.
         *
         * @returns the size of the list.
         */
        OMEModelObject::indexed_container<ome::xml::model::Image, ome::compat::weak_ptr>::type::size_type
        sizeOfLinkedImageList () const;

        /**
         * Get the linked Image list.
         *
         * @returns a reference to the list.
         */
        OMEModelObject::indexed_container<ome::xml::model::Image, ome::compat::weak_ptr>::type
        getLinkedImageList () const;

        /**
         * Get linked Image.
         *
         * @param index the index number of the Image.
         * @returns a weak pointer to the Image.
         * @throws std::out_of_range if the index is invalid.
         */
        const ome::compat::weak_ptr<ome::xml::model::Image>&
        getLinkedImage (OMEModelObject::indexed_container<ome::xml::model::Image, ome::compat::weak_ptr>::type::size_type index) const;

        /**
         * Set linked Image.
         *
         * @note The index must be valid.
         *
         * @param index the index number of the Image.
         * @param image_BackReference the Image to set.
         * @returns a weak pointer to the Image.
         * @throws std::out_of_range if the index is invalid.
         */
        const ome::compat::weak_ptr<ome::xml::model::Image>&
        setLinkedImage (OMEModelObject::indexed_container<ome::xml::model::Image, ome::compat::weak_ptr>::type::size_type index,
                                     const ome::compat::shared_ptr<ome::xml::model::Image>& image_BackReference);

        /**
         * Link Image.
         *
         * @param image_BackReference the Image to link.
         * @returns @c true if the object was added to the internal
         * imageLinks list, otherwise @c false.
         *
         * @todo Why have a return value here; what is it used for?
         * Is this an artifact of the Java API?
         */
        bool
        linkImage (const ome::compat::shared_ptr<ome::xml::model::Image>& image_BackReference);

        /**
         * Unlink Image.
         *
         * @param image_BackReference the Image to unlink.
         *
         * @returns @c true if the Image was unlinked, otherwise
         * @c false if the Image was not linked and could hence not be
         * unlinked.
         *
         * @todo Does the return value serve any useful purpose?  Is
         * this also inherited Java API?
         * @todo Doesn't the removal break the indexing?
         * @todo Does the removal deal with multiple instances; we
         * aren't preventing duplicates on insertion.
         */
        bool
        unlinkImage (const ome::compat::shared_ptr<ome::xml::model::Image>& image_BackReference);

        /**
         * Get the Experiment property.
         *
         * @returns the Experiment property.
         */
        ome::compat::weak_ptr<ome::xml::model::Experiment>
        getExperiment ();

        /**
         * Get the Experiment property.
         *
         * @returns the Experiment property.
         */
        const ome::compat::weak_ptr<ome::xml::model::Experiment>
        getExperiment () const;

        /**
         * Set the Experiment property.
         *
         * @param experiment_BackReference the value to set.
         */
        void
        setExperiment (ome::compat::weak_ptr<ome::xml::model::Experiment>& experiment_BackReference);


        /// @copydoc ome::xml::model::OMEModelObject::asXMLElement
        virtual common::xml::dom::Element
        asXMLElement (common::xml::dom::Document& document) const;


      protected:
        // Documented in base class.
        virtual common::xml::dom::Element
        asXMLElementInternal (common::xml::dom::Document& document,
                              common::xml::dom::Element&  element) const;

      public:
       // Documented in superclass.
       const std::string&
       getXMLNamespace() const;
      };

    }
  }
}

#endif // OME_XML_MODEL_MICROBEAMMANIPULATION_H

/*
 * Local Variables:
 * mode:C++
 * End:
 */
