// Copyright (C) 2005-2010 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema
// to C++ data binding compiler, in the Proprietary License mode.
// You should have received a proprietary license from Code Synthesis
// Tools CC prior to generating this code. See the license text for
// conditions.
//

// Begin prologue.
//


#define AOSLCPP_SOURCE 



//
// End prologue.

#include <xsd/cxx/pre.hxx>

#include "aosl/event_input.hpp"

#include <xsd/cxx/xml/dom/wildcard-source.hxx>

#include <xsd/cxx/xml/dom/parsing-source.hxx>

#include <xsd/cxx/tree/type-factory-map.hxx>

#include <xsd/cxx/tree/comparison-map.hxx>

namespace _xsd
{
  static
  const ::xsd::cxx::tree::type_factory_plate< 0, char >
  type_factory_plate_init;

  static
  const ::xsd::cxx::tree::comparison_plate< 0, char >
  comparison_plate_init;
}

namespace aosl
{
  // Event_input
  //

  Event_input::
  Event_input (const MoveType& move,
               const KeyType& key,
               const ValueType& value)
  : ::aosl::Event_input_base (move),
    key_ (key, ::xml_schema::Flags (), this),
    value_ (value, ::xml_schema::Flags (), this)
  {
  }

  Event_input::
  Event_input (const Event_input& x,
               ::xml_schema::Flags f,
               ::xml_schema::Container* c)
  : ::aosl::Event_input_base (x, f, c),
    key_ (x.key_, f, this),
    value_ (x.value_, f, this)
  {
  }

  Event_input::
  Event_input (const ::xercesc::DOMElement& e,
               ::xml_schema::Flags f,
               ::xml_schema::Container* c)
  : ::aosl::Event_input_base (e, f | ::xml_schema::Flags::base, c),
    key_ (f, this),
    value_ (f, this)
  {
    if ((f & ::xml_schema::Flags::base) == 0)
    {
      ::xsd::cxx::xml::dom::parser< char > p (e, false, true);
      this->parse (p, f);
    }
  }

  void Event_input::
  parse (::xsd::cxx::xml::dom::parser< char >& p,
         ::xml_schema::Flags f)
  {
    this->::aosl::Event_input_base::parse (p, f);

    p.reset_attributes ();

    while (p.more_attributes ())
    {
      const ::xercesc::DOMAttr& i (p.next_attribute ());
      const ::xsd::cxx::xml::qualified_name< char > n (
        ::xsd::cxx::xml::dom::name< char > (i));

      if (n.name () == "key" && n.namespace_ ().empty ())
      {
        ::std::auto_ptr< KeyType > r (
          KeyTraits::create (i, f, this));

        this->key_.set (r);
        continue;
      }

      if (n.name () == "value" && n.namespace_ ().empty ())
      {
        ::std::auto_ptr< ValueType > r (
          ValueTraits::create (i, f, this));

        this->value_.set (r);
        continue;
      }
    }

    if (!key_.present ())
    {
      throw ::xsd::cxx::tree::expected_attribute< char > (
        "key",
        "");
    }

    if (!value_.present ())
    {
      throw ::xsd::cxx::tree::expected_attribute< char > (
        "value",
        "");
    }
  }

  Event_input* Event_input::
  _clone (::xml_schema::Flags f,
          ::xml_schema::Container* c) const
  {
    return new class Event_input (*this, f, c);
  }

  Event_input::
  ~Event_input ()
  {
  }

  static
  const ::xsd::cxx::tree::type_factory_initializer< 0, char, Event_input >
  _xsd_Event_input_type_factory_init (
    "event_input",
    "artofsequence.org/aosl/1.0");

  static
  const ::xsd::cxx::tree::comparison_initializer< 0, char, Event_input >
  _xsd_Event_input_comparison_init;

  bool
  operator== (const Event_input& x, const Event_input& y)
  {
    if (!(static_cast< const ::aosl::Event_input_base& > (x) ==
          static_cast< const ::aosl::Event_input_base& > (y)))
      return false;

    if (!(x.key () == y.key ()))
      return false;

    if (!(x.value () == y.value ()))
      return false;

    return true;
  }

  bool
  operator!= (const Event_input& x, const Event_input& y)
  {
    return !(x == y);
  }
}

#include <ostream>

#include <xsd/cxx/tree/std-ostream-map.hxx>

namespace _xsd
{
  static
  const ::xsd::cxx::tree::std_ostream_plate< 0, char >
  std_ostream_plate_init;
}

namespace aosl
{
  ::std::ostream&
  operator<< (::std::ostream& o, const Event_input& i)
  {
    o << static_cast< const ::aosl::Event_input_base& > (i);

    o << ::std::endl << "key: " << i.key ();
    o << ::std::endl << "value: " << i.value ();
    return o;
  }

  static
  const ::xsd::cxx::tree::std_ostream_initializer< 0, char, Event_input >
  _xsd_Event_input_std_ostream_init;
}

#include <istream>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
#include <xsd/cxx/tree/error-handler.hxx>

namespace aosl
{
}

#include <ostream>
#include <xsd/cxx/tree/error-handler.hxx>
#include <xsd/cxx/xml/dom/serialization-source.hxx>

#include <xsd/cxx/tree/type-serializer-map.hxx>

namespace _xsd
{
  static
  const ::xsd::cxx::tree::type_serializer_plate< 0, char >
  type_serializer_plate_init;
}

namespace aosl
{
  void
  operator<< (::xercesc::DOMElement& e, const Event_input& i)
  {
    e << static_cast< const ::aosl::Event_input_base& > (i);

    // key
    //
    {
      ::xercesc::DOMAttr& a (
        ::xsd::cxx::xml::dom::create_attribute (
          "key",
          e));

      a << i.key ();
    }

    // value
    //
    {
      ::xercesc::DOMAttr& a (
        ::xsd::cxx::xml::dom::create_attribute (
          "value",
          e));

      a << i.value ();
    }
  }

  static
  const ::xsd::cxx::tree::type_serializer_initializer< 0, char, Event_input >
  _xsd_Event_input_type_serializer_init (
    "event_input",
    "artofsequence.org/aosl/1.0");
}

#include <xsd/cxx/post.hxx>

// Begin epilogue.
//
//
// End epilogue.

