#include <xsd/cxx/pre.hxx>

#include "ElectricPowerUsageSummary.hxx"

#include "DateTimeInterval.hxx"

#include "Int48.hxx"

#include "LineItem.hxx"

#include "Currency.hxx"

#include "SummaryMeasurement.hxx"

#include "QualityOfReading.hxx"

#include "TimeType.hxx"

namespace espi
{

  const ElectricPowerUsageSummary::billingPeriod_optional& ElectricPowerUsageSummary::
  billingPeriod () const
  {
    return this->billingPeriod_;
  }

  ElectricPowerUsageSummary::billingPeriod_optional& ElectricPowerUsageSummary::
  billingPeriod ()
  {
    return this->billingPeriod_;
  }

  void ElectricPowerUsageSummary::
  billingPeriod (const billingPeriod_type& x)
  {
    this->billingPeriod_.set (x);
  }

  void ElectricPowerUsageSummary::
  billingPeriod (const billingPeriod_optional& x)
  {
    this->billingPeriod_ = x;
  }

  void ElectricPowerUsageSummary::
  billingPeriod (::std::unique_ptr< billingPeriod_type > x)
  {
    this->billingPeriod_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::billLastPeriod_optional& ElectricPowerUsageSummary::
  billLastPeriod () const
  {
    return this->billLastPeriod_;
  }

  ElectricPowerUsageSummary::billLastPeriod_optional& ElectricPowerUsageSummary::
  billLastPeriod ()
  {
    return this->billLastPeriod_;
  }

  void ElectricPowerUsageSummary::
  billLastPeriod (const billLastPeriod_type& x)
  {
    this->billLastPeriod_.set (x);
  }

  void ElectricPowerUsageSummary::
  billLastPeriod (const billLastPeriod_optional& x)
  {
    this->billLastPeriod_ = x;
  }

  void ElectricPowerUsageSummary::
  billLastPeriod (::std::unique_ptr< billLastPeriod_type > x)
  {
    this->billLastPeriod_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::billToDate_optional& ElectricPowerUsageSummary::
  billToDate () const
  {
    return this->billToDate_;
  }

  ElectricPowerUsageSummary::billToDate_optional& ElectricPowerUsageSummary::
  billToDate ()
  {
    return this->billToDate_;
  }

  void ElectricPowerUsageSummary::
  billToDate (const billToDate_type& x)
  {
    this->billToDate_.set (x);
  }

  void ElectricPowerUsageSummary::
  billToDate (const billToDate_optional& x)
  {
    this->billToDate_ = x;
  }

  void ElectricPowerUsageSummary::
  billToDate (::std::unique_ptr< billToDate_type > x)
  {
    this->billToDate_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::costAdditionalLastPeriod_optional& ElectricPowerUsageSummary::
  costAdditionalLastPeriod () const
  {
    return this->costAdditionalLastPeriod_;
  }

  ElectricPowerUsageSummary::costAdditionalLastPeriod_optional& ElectricPowerUsageSummary::
  costAdditionalLastPeriod ()
  {
    return this->costAdditionalLastPeriod_;
  }

  void ElectricPowerUsageSummary::
  costAdditionalLastPeriod (const costAdditionalLastPeriod_type& x)
  {
    this->costAdditionalLastPeriod_.set (x);
  }

  void ElectricPowerUsageSummary::
  costAdditionalLastPeriod (const costAdditionalLastPeriod_optional& x)
  {
    this->costAdditionalLastPeriod_ = x;
  }

  void ElectricPowerUsageSummary::
  costAdditionalLastPeriod (::std::unique_ptr< costAdditionalLastPeriod_type > x)
  {
    this->costAdditionalLastPeriod_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::costAdditionalDetailLastPeriod_sequence& ElectricPowerUsageSummary::
  costAdditionalDetailLastPeriod () const
  {
    return this->costAdditionalDetailLastPeriod_;
  }

  ElectricPowerUsageSummary::costAdditionalDetailLastPeriod_sequence& ElectricPowerUsageSummary::
  costAdditionalDetailLastPeriod ()
  {
    return this->costAdditionalDetailLastPeriod_;
  }

  void ElectricPowerUsageSummary::
  costAdditionalDetailLastPeriod (const costAdditionalDetailLastPeriod_sequence& s)
  {
    this->costAdditionalDetailLastPeriod_ = s;
  }

  const ElectricPowerUsageSummary::currency_optional& ElectricPowerUsageSummary::
  currency () const
  {
    return this->currency_;
  }

  ElectricPowerUsageSummary::currency_optional& ElectricPowerUsageSummary::
  currency ()
  {
    return this->currency_;
  }

  void ElectricPowerUsageSummary::
  currency (const currency_type& x)
  {
    this->currency_.set (x);
  }

  void ElectricPowerUsageSummary::
  currency (const currency_optional& x)
  {
    this->currency_ = x;
  }

  void ElectricPowerUsageSummary::
  currency (::std::unique_ptr< currency_type > x)
  {
    this->currency_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::overallConsumptionLastPeriod_optional& ElectricPowerUsageSummary::
  overallConsumptionLastPeriod () const
  {
    return this->overallConsumptionLastPeriod_;
  }

  ElectricPowerUsageSummary::overallConsumptionLastPeriod_optional& ElectricPowerUsageSummary::
  overallConsumptionLastPeriod ()
  {
    return this->overallConsumptionLastPeriod_;
  }

  void ElectricPowerUsageSummary::
  overallConsumptionLastPeriod (const overallConsumptionLastPeriod_type& x)
  {
    this->overallConsumptionLastPeriod_.set (x);
  }

  void ElectricPowerUsageSummary::
  overallConsumptionLastPeriod (const overallConsumptionLastPeriod_optional& x)
  {
    this->overallConsumptionLastPeriod_ = x;
  }

  void ElectricPowerUsageSummary::
  overallConsumptionLastPeriod (::std::unique_ptr< overallConsumptionLastPeriod_type > x)
  {
    this->overallConsumptionLastPeriod_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::currentBillingPeriodOverAllConsumption_optional& ElectricPowerUsageSummary::
  currentBillingPeriodOverAllConsumption () const
  {
    return this->currentBillingPeriodOverAllConsumption_;
  }

  ElectricPowerUsageSummary::currentBillingPeriodOverAllConsumption_optional& ElectricPowerUsageSummary::
  currentBillingPeriodOverAllConsumption ()
  {
    return this->currentBillingPeriodOverAllConsumption_;
  }

  void ElectricPowerUsageSummary::
  currentBillingPeriodOverAllConsumption (const currentBillingPeriodOverAllConsumption_type& x)
  {
    this->currentBillingPeriodOverAllConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  currentBillingPeriodOverAllConsumption (const currentBillingPeriodOverAllConsumption_optional& x)
  {
    this->currentBillingPeriodOverAllConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  currentBillingPeriodOverAllConsumption (::std::unique_ptr< currentBillingPeriodOverAllConsumption_type > x)
  {
    this->currentBillingPeriodOverAllConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::currentDayLastYearNetConsumption_optional& ElectricPowerUsageSummary::
  currentDayLastYearNetConsumption () const
  {
    return this->currentDayLastYearNetConsumption_;
  }

  ElectricPowerUsageSummary::currentDayLastYearNetConsumption_optional& ElectricPowerUsageSummary::
  currentDayLastYearNetConsumption ()
  {
    return this->currentDayLastYearNetConsumption_;
  }

  void ElectricPowerUsageSummary::
  currentDayLastYearNetConsumption (const currentDayLastYearNetConsumption_type& x)
  {
    this->currentDayLastYearNetConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  currentDayLastYearNetConsumption (const currentDayLastYearNetConsumption_optional& x)
  {
    this->currentDayLastYearNetConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  currentDayLastYearNetConsumption (::std::unique_ptr< currentDayLastYearNetConsumption_type > x)
  {
    this->currentDayLastYearNetConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::currentDayNetConsumption_optional& ElectricPowerUsageSummary::
  currentDayNetConsumption () const
  {
    return this->currentDayNetConsumption_;
  }

  ElectricPowerUsageSummary::currentDayNetConsumption_optional& ElectricPowerUsageSummary::
  currentDayNetConsumption ()
  {
    return this->currentDayNetConsumption_;
  }

  void ElectricPowerUsageSummary::
  currentDayNetConsumption (const currentDayNetConsumption_type& x)
  {
    this->currentDayNetConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  currentDayNetConsumption (const currentDayNetConsumption_optional& x)
  {
    this->currentDayNetConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  currentDayNetConsumption (::std::unique_ptr< currentDayNetConsumption_type > x)
  {
    this->currentDayNetConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::currentDayOverallConsumption_optional& ElectricPowerUsageSummary::
  currentDayOverallConsumption () const
  {
    return this->currentDayOverallConsumption_;
  }

  ElectricPowerUsageSummary::currentDayOverallConsumption_optional& ElectricPowerUsageSummary::
  currentDayOverallConsumption ()
  {
    return this->currentDayOverallConsumption_;
  }

  void ElectricPowerUsageSummary::
  currentDayOverallConsumption (const currentDayOverallConsumption_type& x)
  {
    this->currentDayOverallConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  currentDayOverallConsumption (const currentDayOverallConsumption_optional& x)
  {
    this->currentDayOverallConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  currentDayOverallConsumption (::std::unique_ptr< currentDayOverallConsumption_type > x)
  {
    this->currentDayOverallConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::peakDemand_optional& ElectricPowerUsageSummary::
  peakDemand () const
  {
    return this->peakDemand_;
  }

  ElectricPowerUsageSummary::peakDemand_optional& ElectricPowerUsageSummary::
  peakDemand ()
  {
    return this->peakDemand_;
  }

  void ElectricPowerUsageSummary::
  peakDemand (const peakDemand_type& x)
  {
    this->peakDemand_.set (x);
  }

  void ElectricPowerUsageSummary::
  peakDemand (const peakDemand_optional& x)
  {
    this->peakDemand_ = x;
  }

  void ElectricPowerUsageSummary::
  peakDemand (::std::unique_ptr< peakDemand_type > x)
  {
    this->peakDemand_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::previousDayLastYearOverallConsumption_optional& ElectricPowerUsageSummary::
  previousDayLastYearOverallConsumption () const
  {
    return this->previousDayLastYearOverallConsumption_;
  }

  ElectricPowerUsageSummary::previousDayLastYearOverallConsumption_optional& ElectricPowerUsageSummary::
  previousDayLastYearOverallConsumption ()
  {
    return this->previousDayLastYearOverallConsumption_;
  }

  void ElectricPowerUsageSummary::
  previousDayLastYearOverallConsumption (const previousDayLastYearOverallConsumption_type& x)
  {
    this->previousDayLastYearOverallConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  previousDayLastYearOverallConsumption (const previousDayLastYearOverallConsumption_optional& x)
  {
    this->previousDayLastYearOverallConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  previousDayLastYearOverallConsumption (::std::unique_ptr< previousDayLastYearOverallConsumption_type > x)
  {
    this->previousDayLastYearOverallConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::previousDayNetConsumption_optional& ElectricPowerUsageSummary::
  previousDayNetConsumption () const
  {
    return this->previousDayNetConsumption_;
  }

  ElectricPowerUsageSummary::previousDayNetConsumption_optional& ElectricPowerUsageSummary::
  previousDayNetConsumption ()
  {
    return this->previousDayNetConsumption_;
  }

  void ElectricPowerUsageSummary::
  previousDayNetConsumption (const previousDayNetConsumption_type& x)
  {
    this->previousDayNetConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  previousDayNetConsumption (const previousDayNetConsumption_optional& x)
  {
    this->previousDayNetConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  previousDayNetConsumption (::std::unique_ptr< previousDayNetConsumption_type > x)
  {
    this->previousDayNetConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::previousDayOverallConsumption_optional& ElectricPowerUsageSummary::
  previousDayOverallConsumption () const
  {
    return this->previousDayOverallConsumption_;
  }

  ElectricPowerUsageSummary::previousDayOverallConsumption_optional& ElectricPowerUsageSummary::
  previousDayOverallConsumption ()
  {
    return this->previousDayOverallConsumption_;
  }

  void ElectricPowerUsageSummary::
  previousDayOverallConsumption (const previousDayOverallConsumption_type& x)
  {
    this->previousDayOverallConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  previousDayOverallConsumption (const previousDayOverallConsumption_optional& x)
  {
    this->previousDayOverallConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  previousDayOverallConsumption (::std::unique_ptr< previousDayOverallConsumption_type > x)
  {
    this->previousDayOverallConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::qualityOfReading_optional& ElectricPowerUsageSummary::
  qualityOfReading () const
  {
    return this->qualityOfReading_;
  }

  ElectricPowerUsageSummary::qualityOfReading_optional& ElectricPowerUsageSummary::
  qualityOfReading ()
  {
    return this->qualityOfReading_;
  }

  void ElectricPowerUsageSummary::
  qualityOfReading (const qualityOfReading_type& x)
  {
    this->qualityOfReading_.set (x);
  }

  void ElectricPowerUsageSummary::
  qualityOfReading (const qualityOfReading_optional& x)
  {
    this->qualityOfReading_ = x;
  }

  void ElectricPowerUsageSummary::
  qualityOfReading (::std::unique_ptr< qualityOfReading_type > x)
  {
    this->qualityOfReading_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::ratchetDemand_optional& ElectricPowerUsageSummary::
  ratchetDemand () const
  {
    return this->ratchetDemand_;
  }

  ElectricPowerUsageSummary::ratchetDemand_optional& ElectricPowerUsageSummary::
  ratchetDemand ()
  {
    return this->ratchetDemand_;
  }

  void ElectricPowerUsageSummary::
  ratchetDemand (const ratchetDemand_type& x)
  {
    this->ratchetDemand_.set (x);
  }

  void ElectricPowerUsageSummary::
  ratchetDemand (const ratchetDemand_optional& x)
  {
    this->ratchetDemand_ = x;
  }

  void ElectricPowerUsageSummary::
  ratchetDemand (::std::unique_ptr< ratchetDemand_type > x)
  {
    this->ratchetDemand_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::ratchetDemandPeriod_optional& ElectricPowerUsageSummary::
  ratchetDemandPeriod () const
  {
    return this->ratchetDemandPeriod_;
  }

  ElectricPowerUsageSummary::ratchetDemandPeriod_optional& ElectricPowerUsageSummary::
  ratchetDemandPeriod ()
  {
    return this->ratchetDemandPeriod_;
  }

  void ElectricPowerUsageSummary::
  ratchetDemandPeriod (const ratchetDemandPeriod_type& x)
  {
    this->ratchetDemandPeriod_.set (x);
  }

  void ElectricPowerUsageSummary::
  ratchetDemandPeriod (const ratchetDemandPeriod_optional& x)
  {
    this->ratchetDemandPeriod_ = x;
  }

  void ElectricPowerUsageSummary::
  ratchetDemandPeriod (::std::unique_ptr< ratchetDemandPeriod_type > x)
  {
    this->ratchetDemandPeriod_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::statusTimeStamp_type& ElectricPowerUsageSummary::
  statusTimeStamp () const
  {
    return this->statusTimeStamp_.get ();
  }

  ElectricPowerUsageSummary::statusTimeStamp_type& ElectricPowerUsageSummary::
  statusTimeStamp ()
  {
    return this->statusTimeStamp_.get ();
  }

  void ElectricPowerUsageSummary::
  statusTimeStamp (const statusTimeStamp_type& x)
  {
    this->statusTimeStamp_.set (x);
  }

  void ElectricPowerUsageSummary::
  statusTimeStamp (::std::unique_ptr< statusTimeStamp_type > x)
  {
    this->statusTimeStamp_.set (std::move (x));
  }
}

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

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

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

namespace espi
{

  ElectricPowerUsageSummary::
  ElectricPowerUsageSummary (const statusTimeStamp_type& statusTimeStamp)
  : ::espi::IdentifiedObject (),
    billingPeriod_ (this),
    billLastPeriod_ (this),
    billToDate_ (this),
    costAdditionalLastPeriod_ (this),
    costAdditionalDetailLastPeriod_ (this),
    currency_ (this),
    overallConsumptionLastPeriod_ (this),
    currentBillingPeriodOverAllConsumption_ (this),
    currentDayLastYearNetConsumption_ (this),
    currentDayNetConsumption_ (this),
    currentDayOverallConsumption_ (this),
    peakDemand_ (this),
    previousDayLastYearOverallConsumption_ (this),
    previousDayNetConsumption_ (this),
    previousDayOverallConsumption_ (this),
    qualityOfReading_ (this),
    ratchetDemand_ (this),
    ratchetDemandPeriod_ (this),
    statusTimeStamp_ (statusTimeStamp, this)
  {
  }

  ElectricPowerUsageSummary::
  ElectricPowerUsageSummary (const ElectricPowerUsageSummary& x,
                             ::xml_schema::flags f,
                             ::xml_schema::container* c)
  : ::espi::IdentifiedObject (x, f, c),
    billingPeriod_ (x.billingPeriod_, f, this),
    billLastPeriod_ (x.billLastPeriod_, f, this),
    billToDate_ (x.billToDate_, f, this),
    costAdditionalLastPeriod_ (x.costAdditionalLastPeriod_, f, this),
    costAdditionalDetailLastPeriod_ (x.costAdditionalDetailLastPeriod_, f, this),
    currency_ (x.currency_, f, this),
    overallConsumptionLastPeriod_ (x.overallConsumptionLastPeriod_, f, this),
    currentBillingPeriodOverAllConsumption_ (x.currentBillingPeriodOverAllConsumption_, f, this),
    currentDayLastYearNetConsumption_ (x.currentDayLastYearNetConsumption_, f, this),
    currentDayNetConsumption_ (x.currentDayNetConsumption_, f, this),
    currentDayOverallConsumption_ (x.currentDayOverallConsumption_, f, this),
    peakDemand_ (x.peakDemand_, f, this),
    previousDayLastYearOverallConsumption_ (x.previousDayLastYearOverallConsumption_, f, this),
    previousDayNetConsumption_ (x.previousDayNetConsumption_, f, this),
    previousDayOverallConsumption_ (x.previousDayOverallConsumption_, f, this),
    qualityOfReading_ (x.qualityOfReading_, f, this),
    ratchetDemand_ (x.ratchetDemand_, f, this),
    ratchetDemandPeriod_ (x.ratchetDemandPeriod_, f, this),
    statusTimeStamp_ (x.statusTimeStamp_, f, this)
  {
  }

  ElectricPowerUsageSummary::
  ElectricPowerUsageSummary (const ::xercesc::DOMElement& e,
                             ::xml_schema::flags f,
                             ::xml_schema::container* c)
  : ::espi::IdentifiedObject (e, f | ::xml_schema::flags::base, c),
    billingPeriod_ (this),
    billLastPeriod_ (this),
    billToDate_ (this),
    costAdditionalLastPeriod_ (this),
    costAdditionalDetailLastPeriod_ (this),
    currency_ (this),
    overallConsumptionLastPeriod_ (this),
    currentBillingPeriodOverAllConsumption_ (this),
    currentDayLastYearNetConsumption_ (this),
    currentDayNetConsumption_ (this),
    currentDayOverallConsumption_ (this),
    peakDemand_ (this),
    previousDayLastYearOverallConsumption_ (this),
    previousDayNetConsumption_ (this),
    previousDayOverallConsumption_ (this),
    qualityOfReading_ (this),
    ratchetDemand_ (this),
    ratchetDemandPeriod_ (this),
    statusTimeStamp_ (this)
  {
    if ((f & ::xml_schema::flags::base) == 0)
    {
      ::xsd::cxx::xml::dom::parser< char > p (e, true, false, false);
      this->parse (p, f);
    }
  }

  void ElectricPowerUsageSummary::
  parse (::xsd::cxx::xml::dom::parser< char >& p,
         ::xml_schema::flags f)
  {
    this->::espi::IdentifiedObject::parse (p, f);

    for (; p.more_content (); p.next_content (false))
    {
      const ::xercesc::DOMElement& i (p.cur_element ());
      const ::xsd::cxx::xml::qualified_name< char > n (
        ::xsd::cxx::xml::dom::name< char > (i));

      if (n.name () == "billingPeriod" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< billingPeriod_type > r (
          billingPeriod_traits::create (i, f, this));

        if (!this->billingPeriod_)
        {
          this->billingPeriod_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "billLastPeriod" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< billLastPeriod_type > r (
          billLastPeriod_traits::create (i, f, this));

        if (!this->billLastPeriod_)
        {
          this->billLastPeriod_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "billToDate" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< billToDate_type > r (
          billToDate_traits::create (i, f, this));

        if (!this->billToDate_)
        {
          this->billToDate_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "costAdditionalLastPeriod" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< costAdditionalLastPeriod_type > r (
          costAdditionalLastPeriod_traits::create (i, f, this));

        if (!this->costAdditionalLastPeriod_)
        {
          this->costAdditionalLastPeriod_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "costAdditionalDetailLastPeriod" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< costAdditionalDetailLastPeriod_type > r (
          costAdditionalDetailLastPeriod_traits::create (i, f, this));

        this->costAdditionalDetailLastPeriod_.push_back (::std::move (r));
        continue;
      }

      if (n.name () == "currency" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< currency_type > r (
          currency_traits::create (i, f, this));

        if (!this->currency_)
        {
          this->currency_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "overallConsumptionLastPeriod" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< overallConsumptionLastPeriod_type > r (
          overallConsumptionLastPeriod_traits::create (i, f, this));

        if (!this->overallConsumptionLastPeriod_)
        {
          this->overallConsumptionLastPeriod_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "currentBillingPeriodOverAllConsumption" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< currentBillingPeriodOverAllConsumption_type > r (
          currentBillingPeriodOverAllConsumption_traits::create (i, f, this));

        if (!this->currentBillingPeriodOverAllConsumption_)
        {
          this->currentBillingPeriodOverAllConsumption_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "currentDayLastYearNetConsumption" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< currentDayLastYearNetConsumption_type > r (
          currentDayLastYearNetConsumption_traits::create (i, f, this));

        if (!this->currentDayLastYearNetConsumption_)
        {
          this->currentDayLastYearNetConsumption_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "currentDayNetConsumption" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< currentDayNetConsumption_type > r (
          currentDayNetConsumption_traits::create (i, f, this));

        if (!this->currentDayNetConsumption_)
        {
          this->currentDayNetConsumption_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "currentDayOverallConsumption" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< currentDayOverallConsumption_type > r (
          currentDayOverallConsumption_traits::create (i, f, this));

        if (!this->currentDayOverallConsumption_)
        {
          this->currentDayOverallConsumption_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "peakDemand" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< peakDemand_type > r (
          peakDemand_traits::create (i, f, this));

        if (!this->peakDemand_)
        {
          this->peakDemand_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "previousDayLastYearOverallConsumption" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< previousDayLastYearOverallConsumption_type > r (
          previousDayLastYearOverallConsumption_traits::create (i, f, this));

        if (!this->previousDayLastYearOverallConsumption_)
        {
          this->previousDayLastYearOverallConsumption_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "previousDayNetConsumption" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< previousDayNetConsumption_type > r (
          previousDayNetConsumption_traits::create (i, f, this));

        if (!this->previousDayNetConsumption_)
        {
          this->previousDayNetConsumption_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "previousDayOverallConsumption" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< previousDayOverallConsumption_type > r (
          previousDayOverallConsumption_traits::create (i, f, this));

        if (!this->previousDayOverallConsumption_)
        {
          this->previousDayOverallConsumption_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "qualityOfReading" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< qualityOfReading_type > r (
          qualityOfReading_traits::create (i, f, this));

        if (!this->qualityOfReading_)
        {
          this->qualityOfReading_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "ratchetDemand" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< ratchetDemand_type > r (
          ratchetDemand_traits::create (i, f, this));

        if (!this->ratchetDemand_)
        {
          this->ratchetDemand_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "ratchetDemandPeriod" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< ratchetDemandPeriod_type > r (
          ratchetDemandPeriod_traits::create (i, f, this));

        if (!this->ratchetDemandPeriod_)
        {
          this->ratchetDemandPeriod_.set (::std::move (r));
          continue;
        }
      }

      if (n.name () == "statusTimeStamp" && n.namespace_ () == "http:
      {
        ::std::unique_ptr< statusTimeStamp_type > r (
          statusTimeStamp_traits::create (i, f, this));

        if (!statusTimeStamp_.present ())
        {
          this->statusTimeStamp_.set (::std::move (r));
          continue;
        }
      }

      break;
    }

    if (!statusTimeStamp_.present ())
    {
      throw ::xsd::cxx::tree::expected_element< char > (
        "statusTimeStamp",
        "http:
    }
  }

  ElectricPowerUsageSummary* ElectricPowerUsageSummary::
  _clone (::xml_schema::flags f,
          ::xml_schema::container* c) const
  {
    return new class ElectricPowerUsageSummary (*this, f, c);
  }

  ElectricPowerUsageSummary& ElectricPowerUsageSummary::
  operator= (const ElectricPowerUsageSummary& x)
  {
    if (this != &x)
    {
      static_cast< ::espi::IdentifiedObject& > (*this) = x;
      this->billingPeriod_ = x.billingPeriod_;
      this->billLastPeriod_ = x.billLastPeriod_;
      this->billToDate_ = x.billToDate_;
      this->costAdditionalLastPeriod_ = x.costAdditionalLastPeriod_;
      this->costAdditionalDetailLastPeriod_ = x.costAdditionalDetailLastPeriod_;
      this->currency_ = x.currency_;
      this->overallConsumptionLastPeriod_ = x.overallConsumptionLastPeriod_;
      this->currentBillingPeriodOverAllConsumption_ = x.currentBillingPeriodOverAllConsumption_;
      this->currentDayLastYearNetConsumption_ = x.currentDayLastYearNetConsumption_;
      this->currentDayNetConsumption_ = x.currentDayNetConsumption_;
      this->currentDayOverallConsumption_ = x.currentDayOverallConsumption_;
      this->peakDemand_ = x.peakDemand_;
      this->previousDayLastYearOverallConsumption_ = x.previousDayLastYearOverallConsumption_;
      this->previousDayNetConsumption_ = x.previousDayNetConsumption_;
      this->previousDayOverallConsumption_ = x.previousDayOverallConsumption_;
      this->qualityOfReading_ = x.qualityOfReading_;
      this->ratchetDemand_ = x.ratchetDemand_;
      this->ratchetDemandPeriod_ = x.ratchetDemandPeriod_;
      this->statusTimeStamp_ = x.statusTimeStamp_;
    }

    return *this;
  }

  ElectricPowerUsageSummary::
  ~ElectricPowerUsageSummary ()
  {
  }
}

#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 espi
{
  ::std::ostream&
  operator<< (::std::ostream& o, const ElectricPowerUsageSummary& i)
  {
    o << static_cast< const ::espi::IdentifiedObject& > (i);

    if (i.billingPeriod ())
    {
      o << ::std::endl << "billingPeriod: " << *i.billingPeriod ();
    }

    if (i.billLastPeriod ())
    {
      o << ::std::endl << "billLastPeriod: " << *i.billLastPeriod ();
    }

    if (i.billToDate ())
    {
      o << ::std::endl << "billToDate: " << *i.billToDate ();
    }

    if (i.costAdditionalLastPeriod ())
    {
      o << ::std::endl << "costAdditionalLastPeriod: " << *i.costAdditionalLastPeriod ();
    }

    for (ElectricPowerUsageSummary::costAdditionalDetailLastPeriod_const_iterator
         b (i.costAdditionalDetailLastPeriod ().begin ()), e (i.costAdditionalDetailLastPeriod ().end ());
         b != e; ++b)
    {
      o << ::std::endl << "costAdditionalDetailLastPeriod: " << *b;
    }

    if (i.currency ())
    {
      o << ::std::endl << "currency: " << *i.currency ();
    }

    if (i.overallConsumptionLastPeriod ())
    {
      o << ::std::endl << "overallConsumptionLastPeriod: " << *i.overallConsumptionLastPeriod ();
    }

    if (i.currentBillingPeriodOverAllConsumption ())
    {
      o << ::std::endl << "currentBillingPeriodOverAllConsumption: " << *i.currentBillingPeriodOverAllConsumption ();
    }

    if (i.currentDayLastYearNetConsumption ())
    {
      o << ::std::endl << "currentDayLastYearNetConsumption: " << *i.currentDayLastYearNetConsumption ();
    }

    if (i.currentDayNetConsumption ())
    {
      o << ::std::endl << "currentDayNetConsumption: " << *i.currentDayNetConsumption ();
    }

    if (i.currentDayOverallConsumption ())
    {
      o << ::std::endl << "currentDayOverallConsumption: " << *i.currentDayOverallConsumption ();
    }

    if (i.peakDemand ())
    {
      o << ::std::endl << "peakDemand: " << *i.peakDemand ();
    }

    if (i.previousDayLastYearOverallConsumption ())
    {
      o << ::std::endl << "previousDayLastYearOverallConsumption: " << *i.previousDayLastYearOverallConsumption ();
    }

    if (i.previousDayNetConsumption ())
    {
      o << ::std::endl << "previousDayNetConsumption: " << *i.previousDayNetConsumption ();
    }

    if (i.previousDayOverallConsumption ())
    {
      o << ::std::endl << "previousDayOverallConsumption: " << *i.previousDayOverallConsumption ();
    }

    if (i.qualityOfReading ())
    {
      o << ::std::endl << "qualityOfReading: " << *i.qualityOfReading ();
    }

    if (i.ratchetDemand ())
    {
      o << ::std::endl << "ratchetDemand: " << *i.ratchetDemand ();
    }

    if (i.ratchetDemandPeriod ())
    {
      o << ::std::endl << "ratchetDemandPeriod: " << *i.ratchetDemandPeriod ();
    }

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

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

namespace espi
{
}

#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 espi
{
  void
  operator<< (::xercesc::DOMElement& e, const ElectricPowerUsageSummary& i)
  {
    e << static_cast< const ::espi::IdentifiedObject& > (i);

    if (i.billingPeriod ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "billingPeriod",
          "http:
          e));

      s << *i.billingPeriod ();
    }

    if (i.billLastPeriod ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "billLastPeriod",
          "http:
          e));

      s << *i.billLastPeriod ();
    }

    if (i.billToDate ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "billToDate",
          "http:
          e));

      s << *i.billToDate ();
    }

    if (i.costAdditionalLastPeriod ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "costAdditionalLastPeriod",
          "http:
          e));

      s << *i.costAdditionalLastPeriod ();
    }

    for (ElectricPowerUsageSummary::costAdditionalDetailLastPeriod_const_iterator
         b (i.costAdditionalDetailLastPeriod ().begin ()), n (i.costAdditionalDetailLastPeriod ().end ());
         b != n; ++b)
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "costAdditionalDetailLastPeriod",
          "http:
          e));

      s << *b;
    }

    if (i.currency ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "currency",
          "http:
          e));

      s << *i.currency ();
    }

    if (i.overallConsumptionLastPeriod ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "overallConsumptionLastPeriod",
          "http:
          e));

      s << *i.overallConsumptionLastPeriod ();
    }

    if (i.currentBillingPeriodOverAllConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "currentBillingPeriodOverAllConsumption",
          "http:
          e));

      s << *i.currentBillingPeriodOverAllConsumption ();
    }

    if (i.currentDayLastYearNetConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "currentDayLastYearNetConsumption",
          "http:
          e));

      s << *i.currentDayLastYearNetConsumption ();
    }

    if (i.currentDayNetConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "currentDayNetConsumption",
          "http:
          e));

      s << *i.currentDayNetConsumption ();
    }

    if (i.currentDayOverallConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "currentDayOverallConsumption",
          "http:
          e));

      s << *i.currentDayOverallConsumption ();
    }

    if (i.peakDemand ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "peakDemand",
          "http:
          e));

      s << *i.peakDemand ();
    }

    if (i.previousDayLastYearOverallConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "previousDayLastYearOverallConsumption",
          "http:
          e));

      s << *i.previousDayLastYearOverallConsumption ();
    }

    if (i.previousDayNetConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "previousDayNetConsumption",
          "http:
          e));

      s << *i.previousDayNetConsumption ();
    }

    if (i.previousDayOverallConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "previousDayOverallConsumption",
          "http:
          e));

      s << *i.previousDayOverallConsumption ();
    }

    if (i.qualityOfReading ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "qualityOfReading",
          "http:
          e));

      s << *i.qualityOfReading ();
    }

    if (i.ratchetDemand ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "ratchetDemand",
          "http:
          e));

      s << *i.ratchetDemand ();
    }

    if (i.ratchetDemandPeriod ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "ratchetDemandPeriod",
          "http:
          e));

      s << *i.ratchetDemandPeriod ();
    }

    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "statusTimeStamp",
          "http:
          e));

      s << i.statusTimeStamp ();
    }
  }
}

#include <xsd/cxx/post.hxx>
// Copyright (c) 2005-2014 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//

// Begin prologue.
//
//
// End prologue.

#include <xsd/cxx/pre.hxx>

#include "ElectricPowerUsageSummary.hxx"

#include "DateTimeInterval.hxx"

#include "Int48.hxx"

#include "LineItem.hxx"

#include "Currency.hxx"

#include "SummaryMeasurement.hxx"

#include "QualityOfReading.hxx"

#include "TimeType.hxx"

namespace espi
{
  // ElectricPowerUsageSummary
  // 

  const ElectricPowerUsageSummary::billingPeriod_optional& ElectricPowerUsageSummary::
  billingPeriod () const
  {
    return this->billingPeriod_;
  }

  ElectricPowerUsageSummary::billingPeriod_optional& ElectricPowerUsageSummary::
  billingPeriod ()
  {
    return this->billingPeriod_;
  }

  void ElectricPowerUsageSummary::
  billingPeriod (const billingPeriod_type& x)
  {
    this->billingPeriod_.set (x);
  }

  void ElectricPowerUsageSummary::
  billingPeriod (const billingPeriod_optional& x)
  {
    this->billingPeriod_ = x;
  }

  void ElectricPowerUsageSummary::
  billingPeriod (::std::unique_ptr< billingPeriod_type > x)
  {
    this->billingPeriod_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::billLastPeriod_optional& ElectricPowerUsageSummary::
  billLastPeriod () const
  {
    return this->billLastPeriod_;
  }

  ElectricPowerUsageSummary::billLastPeriod_optional& ElectricPowerUsageSummary::
  billLastPeriod ()
  {
    return this->billLastPeriod_;
  }

  void ElectricPowerUsageSummary::
  billLastPeriod (const billLastPeriod_type& x)
  {
    this->billLastPeriod_.set (x);
  }

  void ElectricPowerUsageSummary::
  billLastPeriod (const billLastPeriod_optional& x)
  {
    this->billLastPeriod_ = x;
  }

  void ElectricPowerUsageSummary::
  billLastPeriod (::std::unique_ptr< billLastPeriod_type > x)
  {
    this->billLastPeriod_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::billToDate_optional& ElectricPowerUsageSummary::
  billToDate () const
  {
    return this->billToDate_;
  }

  ElectricPowerUsageSummary::billToDate_optional& ElectricPowerUsageSummary::
  billToDate ()
  {
    return this->billToDate_;
  }

  void ElectricPowerUsageSummary::
  billToDate (const billToDate_type& x)
  {
    this->billToDate_.set (x);
  }

  void ElectricPowerUsageSummary::
  billToDate (const billToDate_optional& x)
  {
    this->billToDate_ = x;
  }

  void ElectricPowerUsageSummary::
  billToDate (::std::unique_ptr< billToDate_type > x)
  {
    this->billToDate_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::costAdditionalLastPeriod_optional& ElectricPowerUsageSummary::
  costAdditionalLastPeriod () const
  {
    return this->costAdditionalLastPeriod_;
  }

  ElectricPowerUsageSummary::costAdditionalLastPeriod_optional& ElectricPowerUsageSummary::
  costAdditionalLastPeriod ()
  {
    return this->costAdditionalLastPeriod_;
  }

  void ElectricPowerUsageSummary::
  costAdditionalLastPeriod (const costAdditionalLastPeriod_type& x)
  {
    this->costAdditionalLastPeriod_.set (x);
  }

  void ElectricPowerUsageSummary::
  costAdditionalLastPeriod (const costAdditionalLastPeriod_optional& x)
  {
    this->costAdditionalLastPeriod_ = x;
  }

  void ElectricPowerUsageSummary::
  costAdditionalLastPeriod (::std::unique_ptr< costAdditionalLastPeriod_type > x)
  {
    this->costAdditionalLastPeriod_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::costAdditionalDetailLastPeriod_sequence& ElectricPowerUsageSummary::
  costAdditionalDetailLastPeriod () const
  {
    return this->costAdditionalDetailLastPeriod_;
  }

  ElectricPowerUsageSummary::costAdditionalDetailLastPeriod_sequence& ElectricPowerUsageSummary::
  costAdditionalDetailLastPeriod ()
  {
    return this->costAdditionalDetailLastPeriod_;
  }

  void ElectricPowerUsageSummary::
  costAdditionalDetailLastPeriod (const costAdditionalDetailLastPeriod_sequence& s)
  {
    this->costAdditionalDetailLastPeriod_ = s;
  }

  const ElectricPowerUsageSummary::currency_optional& ElectricPowerUsageSummary::
  currency () const
  {
    return this->currency_;
  }

  ElectricPowerUsageSummary::currency_optional& ElectricPowerUsageSummary::
  currency ()
  {
    return this->currency_;
  }

  void ElectricPowerUsageSummary::
  currency (const currency_type& x)
  {
    this->currency_.set (x);
  }

  void ElectricPowerUsageSummary::
  currency (const currency_optional& x)
  {
    this->currency_ = x;
  }

  void ElectricPowerUsageSummary::
  currency (::std::unique_ptr< currency_type > x)
  {
    this->currency_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::overallConsumptionLastPeriod_optional& ElectricPowerUsageSummary::
  overallConsumptionLastPeriod () const
  {
    return this->overallConsumptionLastPeriod_;
  }

  ElectricPowerUsageSummary::overallConsumptionLastPeriod_optional& ElectricPowerUsageSummary::
  overallConsumptionLastPeriod ()
  {
    return this->overallConsumptionLastPeriod_;
  }

  void ElectricPowerUsageSummary::
  overallConsumptionLastPeriod (const overallConsumptionLastPeriod_type& x)
  {
    this->overallConsumptionLastPeriod_.set (x);
  }

  void ElectricPowerUsageSummary::
  overallConsumptionLastPeriod (const overallConsumptionLastPeriod_optional& x)
  {
    this->overallConsumptionLastPeriod_ = x;
  }

  void ElectricPowerUsageSummary::
  overallConsumptionLastPeriod (::std::unique_ptr< overallConsumptionLastPeriod_type > x)
  {
    this->overallConsumptionLastPeriod_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::currentBillingPeriodOverAllConsumption_optional& ElectricPowerUsageSummary::
  currentBillingPeriodOverAllConsumption () const
  {
    return this->currentBillingPeriodOverAllConsumption_;
  }

  ElectricPowerUsageSummary::currentBillingPeriodOverAllConsumption_optional& ElectricPowerUsageSummary::
  currentBillingPeriodOverAllConsumption ()
  {
    return this->currentBillingPeriodOverAllConsumption_;
  }

  void ElectricPowerUsageSummary::
  currentBillingPeriodOverAllConsumption (const currentBillingPeriodOverAllConsumption_type& x)
  {
    this->currentBillingPeriodOverAllConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  currentBillingPeriodOverAllConsumption (const currentBillingPeriodOverAllConsumption_optional& x)
  {
    this->currentBillingPeriodOverAllConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  currentBillingPeriodOverAllConsumption (::std::unique_ptr< currentBillingPeriodOverAllConsumption_type > x)
  {
    this->currentBillingPeriodOverAllConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::currentDayLastYearNetConsumption_optional& ElectricPowerUsageSummary::
  currentDayLastYearNetConsumption () const
  {
    return this->currentDayLastYearNetConsumption_;
  }

  ElectricPowerUsageSummary::currentDayLastYearNetConsumption_optional& ElectricPowerUsageSummary::
  currentDayLastYearNetConsumption ()
  {
    return this->currentDayLastYearNetConsumption_;
  }

  void ElectricPowerUsageSummary::
  currentDayLastYearNetConsumption (const currentDayLastYearNetConsumption_type& x)
  {
    this->currentDayLastYearNetConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  currentDayLastYearNetConsumption (const currentDayLastYearNetConsumption_optional& x)
  {
    this->currentDayLastYearNetConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  currentDayLastYearNetConsumption (::std::unique_ptr< currentDayLastYearNetConsumption_type > x)
  {
    this->currentDayLastYearNetConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::currentDayNetConsumption_optional& ElectricPowerUsageSummary::
  currentDayNetConsumption () const
  {
    return this->currentDayNetConsumption_;
  }

  ElectricPowerUsageSummary::currentDayNetConsumption_optional& ElectricPowerUsageSummary::
  currentDayNetConsumption ()
  {
    return this->currentDayNetConsumption_;
  }

  void ElectricPowerUsageSummary::
  currentDayNetConsumption (const currentDayNetConsumption_type& x)
  {
    this->currentDayNetConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  currentDayNetConsumption (const currentDayNetConsumption_optional& x)
  {
    this->currentDayNetConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  currentDayNetConsumption (::std::unique_ptr< currentDayNetConsumption_type > x)
  {
    this->currentDayNetConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::currentDayOverallConsumption_optional& ElectricPowerUsageSummary::
  currentDayOverallConsumption () const
  {
    return this->currentDayOverallConsumption_;
  }

  ElectricPowerUsageSummary::currentDayOverallConsumption_optional& ElectricPowerUsageSummary::
  currentDayOverallConsumption ()
  {
    return this->currentDayOverallConsumption_;
  }

  void ElectricPowerUsageSummary::
  currentDayOverallConsumption (const currentDayOverallConsumption_type& x)
  {
    this->currentDayOverallConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  currentDayOverallConsumption (const currentDayOverallConsumption_optional& x)
  {
    this->currentDayOverallConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  currentDayOverallConsumption (::std::unique_ptr< currentDayOverallConsumption_type > x)
  {
    this->currentDayOverallConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::peakDemand_optional& ElectricPowerUsageSummary::
  peakDemand () const
  {
    return this->peakDemand_;
  }

  ElectricPowerUsageSummary::peakDemand_optional& ElectricPowerUsageSummary::
  peakDemand ()
  {
    return this->peakDemand_;
  }

  void ElectricPowerUsageSummary::
  peakDemand (const peakDemand_type& x)
  {
    this->peakDemand_.set (x);
  }

  void ElectricPowerUsageSummary::
  peakDemand (const peakDemand_optional& x)
  {
    this->peakDemand_ = x;
  }

  void ElectricPowerUsageSummary::
  peakDemand (::std::unique_ptr< peakDemand_type > x)
  {
    this->peakDemand_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::previousDayLastYearOverallConsumption_optional& ElectricPowerUsageSummary::
  previousDayLastYearOverallConsumption () const
  {
    return this->previousDayLastYearOverallConsumption_;
  }

  ElectricPowerUsageSummary::previousDayLastYearOverallConsumption_optional& ElectricPowerUsageSummary::
  previousDayLastYearOverallConsumption ()
  {
    return this->previousDayLastYearOverallConsumption_;
  }

  void ElectricPowerUsageSummary::
  previousDayLastYearOverallConsumption (const previousDayLastYearOverallConsumption_type& x)
  {
    this->previousDayLastYearOverallConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  previousDayLastYearOverallConsumption (const previousDayLastYearOverallConsumption_optional& x)
  {
    this->previousDayLastYearOverallConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  previousDayLastYearOverallConsumption (::std::unique_ptr< previousDayLastYearOverallConsumption_type > x)
  {
    this->previousDayLastYearOverallConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::previousDayNetConsumption_optional& ElectricPowerUsageSummary::
  previousDayNetConsumption () const
  {
    return this->previousDayNetConsumption_;
  }

  ElectricPowerUsageSummary::previousDayNetConsumption_optional& ElectricPowerUsageSummary::
  previousDayNetConsumption ()
  {
    return this->previousDayNetConsumption_;
  }

  void ElectricPowerUsageSummary::
  previousDayNetConsumption (const previousDayNetConsumption_type& x)
  {
    this->previousDayNetConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  previousDayNetConsumption (const previousDayNetConsumption_optional& x)
  {
    this->previousDayNetConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  previousDayNetConsumption (::std::unique_ptr< previousDayNetConsumption_type > x)
  {
    this->previousDayNetConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::previousDayOverallConsumption_optional& ElectricPowerUsageSummary::
  previousDayOverallConsumption () const
  {
    return this->previousDayOverallConsumption_;
  }

  ElectricPowerUsageSummary::previousDayOverallConsumption_optional& ElectricPowerUsageSummary::
  previousDayOverallConsumption ()
  {
    return this->previousDayOverallConsumption_;
  }

  void ElectricPowerUsageSummary::
  previousDayOverallConsumption (const previousDayOverallConsumption_type& x)
  {
    this->previousDayOverallConsumption_.set (x);
  }

  void ElectricPowerUsageSummary::
  previousDayOverallConsumption (const previousDayOverallConsumption_optional& x)
  {
    this->previousDayOverallConsumption_ = x;
  }

  void ElectricPowerUsageSummary::
  previousDayOverallConsumption (::std::unique_ptr< previousDayOverallConsumption_type > x)
  {
    this->previousDayOverallConsumption_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::qualityOfReading_optional& ElectricPowerUsageSummary::
  qualityOfReading () const
  {
    return this->qualityOfReading_;
  }

  ElectricPowerUsageSummary::qualityOfReading_optional& ElectricPowerUsageSummary::
  qualityOfReading ()
  {
    return this->qualityOfReading_;
  }

  void ElectricPowerUsageSummary::
  qualityOfReading (const qualityOfReading_type& x)
  {
    this->qualityOfReading_.set (x);
  }

  void ElectricPowerUsageSummary::
  qualityOfReading (const qualityOfReading_optional& x)
  {
    this->qualityOfReading_ = x;
  }

  void ElectricPowerUsageSummary::
  qualityOfReading (::std::unique_ptr< qualityOfReading_type > x)
  {
    this->qualityOfReading_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::ratchetDemand_optional& ElectricPowerUsageSummary::
  ratchetDemand () const
  {
    return this->ratchetDemand_;
  }

  ElectricPowerUsageSummary::ratchetDemand_optional& ElectricPowerUsageSummary::
  ratchetDemand ()
  {
    return this->ratchetDemand_;
  }

  void ElectricPowerUsageSummary::
  ratchetDemand (const ratchetDemand_type& x)
  {
    this->ratchetDemand_.set (x);
  }

  void ElectricPowerUsageSummary::
  ratchetDemand (const ratchetDemand_optional& x)
  {
    this->ratchetDemand_ = x;
  }

  void ElectricPowerUsageSummary::
  ratchetDemand (::std::unique_ptr< ratchetDemand_type > x)
  {
    this->ratchetDemand_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::ratchetDemandPeriod_optional& ElectricPowerUsageSummary::
  ratchetDemandPeriod () const
  {
    return this->ratchetDemandPeriod_;
  }

  ElectricPowerUsageSummary::ratchetDemandPeriod_optional& ElectricPowerUsageSummary::
  ratchetDemandPeriod ()
  {
    return this->ratchetDemandPeriod_;
  }

  void ElectricPowerUsageSummary::
  ratchetDemandPeriod (const ratchetDemandPeriod_type& x)
  {
    this->ratchetDemandPeriod_.set (x);
  }

  void ElectricPowerUsageSummary::
  ratchetDemandPeriod (const ratchetDemandPeriod_optional& x)
  {
    this->ratchetDemandPeriod_ = x;
  }

  void ElectricPowerUsageSummary::
  ratchetDemandPeriod (::std::unique_ptr< ratchetDemandPeriod_type > x)
  {
    this->ratchetDemandPeriod_.set (std::move (x));
  }

  const ElectricPowerUsageSummary::statusTimeStamp_type& ElectricPowerUsageSummary::
  statusTimeStamp () const
  {
    return this->statusTimeStamp_.get ();
  }

  ElectricPowerUsageSummary::statusTimeStamp_type& ElectricPowerUsageSummary::
  statusTimeStamp ()
  {
    return this->statusTimeStamp_.get ();
  }

  void ElectricPowerUsageSummary::
  statusTimeStamp (const statusTimeStamp_type& x)
  {
    this->statusTimeStamp_.set (x);
  }

  void ElectricPowerUsageSummary::
  statusTimeStamp (::std::unique_ptr< statusTimeStamp_type > x)
  {
    this->statusTimeStamp_.set (std::move (x));
  }
}

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

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

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

namespace espi
{
  // ElectricPowerUsageSummary
  //

  ElectricPowerUsageSummary::
  ElectricPowerUsageSummary (const statusTimeStamp_type& statusTimeStamp)
  : ::espi::IdentifiedObject (),
    billingPeriod_ (this),
    billLastPeriod_ (this),
    billToDate_ (this),
    costAdditionalLastPeriod_ (this),
    costAdditionalDetailLastPeriod_ (this),
    currency_ (this),
    overallConsumptionLastPeriod_ (this),
    currentBillingPeriodOverAllConsumption_ (this),
    currentDayLastYearNetConsumption_ (this),
    currentDayNetConsumption_ (this),
    currentDayOverallConsumption_ (this),
    peakDemand_ (this),
    previousDayLastYearOverallConsumption_ (this),
    previousDayNetConsumption_ (this),
    previousDayOverallConsumption_ (this),
    qualityOfReading_ (this),
    ratchetDemand_ (this),
    ratchetDemandPeriod_ (this),
    statusTimeStamp_ (statusTimeStamp, this)
  {
  }

  ElectricPowerUsageSummary::
  ElectricPowerUsageSummary (const ElectricPowerUsageSummary& x,
                             ::xml_schema::flags f,
                             ::xml_schema::container* c)
  : ::espi::IdentifiedObject (x, f, c),
    billingPeriod_ (x.billingPeriod_, f, this),
    billLastPeriod_ (x.billLastPeriod_, f, this),
    billToDate_ (x.billToDate_, f, this),
    costAdditionalLastPeriod_ (x.costAdditionalLastPeriod_, f, this),
    costAdditionalDetailLastPeriod_ (x.costAdditionalDetailLastPeriod_, f, this),
    currency_ (x.currency_, f, this),
    overallConsumptionLastPeriod_ (x.overallConsumptionLastPeriod_, f, this),
    currentBillingPeriodOverAllConsumption_ (x.currentBillingPeriodOverAllConsumption_, f, this),
    currentDayLastYearNetConsumption_ (x.currentDayLastYearNetConsumption_, f, this),
    currentDayNetConsumption_ (x.currentDayNetConsumption_, f, this),
    currentDayOverallConsumption_ (x.currentDayOverallConsumption_, f, this),
    peakDemand_ (x.peakDemand_, f, this),
    previousDayLastYearOverallConsumption_ (x.previousDayLastYearOverallConsumption_, f, this),
    previousDayNetConsumption_ (x.previousDayNetConsumption_, f, this),
    previousDayOverallConsumption_ (x.previousDayOverallConsumption_, f, this),
    qualityOfReading_ (x.qualityOfReading_, f, this),
    ratchetDemand_ (x.ratchetDemand_, f, this),
    ratchetDemandPeriod_ (x.ratchetDemandPeriod_, f, this),
    statusTimeStamp_ (x.statusTimeStamp_, f, this)
  {
  }

  ElectricPowerUsageSummary::
  ElectricPowerUsageSummary (const ::xercesc::DOMElement& e,
                             ::xml_schema::flags f,
                             ::xml_schema::container* c)
  : ::espi::IdentifiedObject (e, f | ::xml_schema::flags::base, c),
    billingPeriod_ (this),
    billLastPeriod_ (this),
    billToDate_ (this),
    costAdditionalLastPeriod_ (this),
    costAdditionalDetailLastPeriod_ (this),
    currency_ (this),
    overallConsumptionLastPeriod_ (this),
    currentBillingPeriodOverAllConsumption_ (this),
    currentDayLastYearNetConsumption_ (this),
    currentDayNetConsumption_ (this),
    currentDayOverallConsumption_ (this),
    peakDemand_ (this),
    previousDayLastYearOverallConsumption_ (this),
    previousDayNetConsumption_ (this),
    previousDayOverallConsumption_ (this),
    qualityOfReading_ (this),
    ratchetDemand_ (this),
    ratchetDemandPeriod_ (this),
    statusTimeStamp_ (this)
  {
    if ((f & ::xml_schema::flags::base) == 0)
    {
      ::xsd::cxx::xml::dom::parser< char > p (e, true, false, false);
      this->parse (p, f);
    }
  }

  void ElectricPowerUsageSummary::
  parse (::xsd::cxx::xml::dom::parser< char >& p,
         ::xml_schema::flags f)
  {
    this->::espi::IdentifiedObject::parse (p, f);

    for (; p.more_content (); p.next_content (false))
    {
      const ::xercesc::DOMElement& i (p.cur_element ());
      const ::xsd::cxx::xml::qualified_name< char > n (
        ::xsd::cxx::xml::dom::name< char > (i));

      // billingPeriod
      //
      if (n.name () == "billingPeriod" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< billingPeriod_type > r (
          billingPeriod_traits::create (i, f, this));

        if (!this->billingPeriod_)
        {
          this->billingPeriod_.set (::std::move (r));
          continue;
        }
      }

      // billLastPeriod
      //
      if (n.name () == "billLastPeriod" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< billLastPeriod_type > r (
          billLastPeriod_traits::create (i, f, this));

        if (!this->billLastPeriod_)
        {
          this->billLastPeriod_.set (::std::move (r));
          continue;
        }
      }

      // billToDate
      //
      if (n.name () == "billToDate" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< billToDate_type > r (
          billToDate_traits::create (i, f, this));

        if (!this->billToDate_)
        {
          this->billToDate_.set (::std::move (r));
          continue;
        }
      }

      // costAdditionalLastPeriod
      //
      if (n.name () == "costAdditionalLastPeriod" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< costAdditionalLastPeriod_type > r (
          costAdditionalLastPeriod_traits::create (i, f, this));

        if (!this->costAdditionalLastPeriod_)
        {
          this->costAdditionalLastPeriod_.set (::std::move (r));
          continue;
        }
      }

      // costAdditionalDetailLastPeriod
      //
      if (n.name () == "costAdditionalDetailLastPeriod" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< costAdditionalDetailLastPeriod_type > r (
          costAdditionalDetailLastPeriod_traits::create (i, f, this));

        this->costAdditionalDetailLastPeriod_.push_back (::std::move (r));
        continue;
      }

      // currency
      //
      if (n.name () == "currency" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< currency_type > r (
          currency_traits::create (i, f, this));

        if (!this->currency_)
        {
          this->currency_.set (::std::move (r));
          continue;
        }
      }

      // overallConsumptionLastPeriod
      //
      if (n.name () == "overallConsumptionLastPeriod" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< overallConsumptionLastPeriod_type > r (
          overallConsumptionLastPeriod_traits::create (i, f, this));

        if (!this->overallConsumptionLastPeriod_)
        {
          this->overallConsumptionLastPeriod_.set (::std::move (r));
          continue;
        }
      }

      // currentBillingPeriodOverAllConsumption
      //
      if (n.name () == "currentBillingPeriodOverAllConsumption" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< currentBillingPeriodOverAllConsumption_type > r (
          currentBillingPeriodOverAllConsumption_traits::create (i, f, this));

        if (!this->currentBillingPeriodOverAllConsumption_)
        {
          this->currentBillingPeriodOverAllConsumption_.set (::std::move (r));
          continue;
        }
      }

      // currentDayLastYearNetConsumption
      //
      if (n.name () == "currentDayLastYearNetConsumption" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< currentDayLastYearNetConsumption_type > r (
          currentDayLastYearNetConsumption_traits::create (i, f, this));

        if (!this->currentDayLastYearNetConsumption_)
        {
          this->currentDayLastYearNetConsumption_.set (::std::move (r));
          continue;
        }
      }

      // currentDayNetConsumption
      //
      if (n.name () == "currentDayNetConsumption" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< currentDayNetConsumption_type > r (
          currentDayNetConsumption_traits::create (i, f, this));

        if (!this->currentDayNetConsumption_)
        {
          this->currentDayNetConsumption_.set (::std::move (r));
          continue;
        }
      }

      // currentDayOverallConsumption
      //
      if (n.name () == "currentDayOverallConsumption" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< currentDayOverallConsumption_type > r (
          currentDayOverallConsumption_traits::create (i, f, this));

        if (!this->currentDayOverallConsumption_)
        {
          this->currentDayOverallConsumption_.set (::std::move (r));
          continue;
        }
      }

      // peakDemand
      //
      if (n.name () == "peakDemand" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< peakDemand_type > r (
          peakDemand_traits::create (i, f, this));

        if (!this->peakDemand_)
        {
          this->peakDemand_.set (::std::move (r));
          continue;
        }
      }

      // previousDayLastYearOverallConsumption
      //
      if (n.name () == "previousDayLastYearOverallConsumption" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< previousDayLastYearOverallConsumption_type > r (
          previousDayLastYearOverallConsumption_traits::create (i, f, this));

        if (!this->previousDayLastYearOverallConsumption_)
        {
          this->previousDayLastYearOverallConsumption_.set (::std::move (r));
          continue;
        }
      }

      // previousDayNetConsumption
      //
      if (n.name () == "previousDayNetConsumption" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< previousDayNetConsumption_type > r (
          previousDayNetConsumption_traits::create (i, f, this));

        if (!this->previousDayNetConsumption_)
        {
          this->previousDayNetConsumption_.set (::std::move (r));
          continue;
        }
      }

      // previousDayOverallConsumption
      //
      if (n.name () == "previousDayOverallConsumption" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< previousDayOverallConsumption_type > r (
          previousDayOverallConsumption_traits::create (i, f, this));

        if (!this->previousDayOverallConsumption_)
        {
          this->previousDayOverallConsumption_.set (::std::move (r));
          continue;
        }
      }

      // qualityOfReading
      //
      if (n.name () == "qualityOfReading" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< qualityOfReading_type > r (
          qualityOfReading_traits::create (i, f, this));

        if (!this->qualityOfReading_)
        {
          this->qualityOfReading_.set (::std::move (r));
          continue;
        }
      }

      // ratchetDemand
      //
      if (n.name () == "ratchetDemand" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< ratchetDemand_type > r (
          ratchetDemand_traits::create (i, f, this));

        if (!this->ratchetDemand_)
        {
          this->ratchetDemand_.set (::std::move (r));
          continue;
        }
      }

      // ratchetDemandPeriod
      //
      if (n.name () == "ratchetDemandPeriod" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< ratchetDemandPeriod_type > r (
          ratchetDemandPeriod_traits::create (i, f, this));

        if (!this->ratchetDemandPeriod_)
        {
          this->ratchetDemandPeriod_.set (::std::move (r));
          continue;
        }
      }

      // statusTimeStamp
      //
      if (n.name () == "statusTimeStamp" && n.namespace_ () == "http://naesb.org/espi")
      {
        ::std::unique_ptr< statusTimeStamp_type > r (
          statusTimeStamp_traits::create (i, f, this));

        if (!statusTimeStamp_.present ())
        {
          this->statusTimeStamp_.set (::std::move (r));
          continue;
        }
      }

      break;
    }

    if (!statusTimeStamp_.present ())
    {
      throw ::xsd::cxx::tree::expected_element< char > (
        "statusTimeStamp",
        "http://naesb.org/espi");
    }
  }

  ElectricPowerUsageSummary* ElectricPowerUsageSummary::
  _clone (::xml_schema::flags f,
          ::xml_schema::container* c) const
  {
    return new class ElectricPowerUsageSummary (*this, f, c);
  }

  ElectricPowerUsageSummary& ElectricPowerUsageSummary::
  operator= (const ElectricPowerUsageSummary& x)
  {
    if (this != &x)
    {
      static_cast< ::espi::IdentifiedObject& > (*this) = x;
      this->billingPeriod_ = x.billingPeriod_;
      this->billLastPeriod_ = x.billLastPeriod_;
      this->billToDate_ = x.billToDate_;
      this->costAdditionalLastPeriod_ = x.costAdditionalLastPeriod_;
      this->costAdditionalDetailLastPeriod_ = x.costAdditionalDetailLastPeriod_;
      this->currency_ = x.currency_;
      this->overallConsumptionLastPeriod_ = x.overallConsumptionLastPeriod_;
      this->currentBillingPeriodOverAllConsumption_ = x.currentBillingPeriodOverAllConsumption_;
      this->currentDayLastYearNetConsumption_ = x.currentDayLastYearNetConsumption_;
      this->currentDayNetConsumption_ = x.currentDayNetConsumption_;
      this->currentDayOverallConsumption_ = x.currentDayOverallConsumption_;
      this->peakDemand_ = x.peakDemand_;
      this->previousDayLastYearOverallConsumption_ = x.previousDayLastYearOverallConsumption_;
      this->previousDayNetConsumption_ = x.previousDayNetConsumption_;
      this->previousDayOverallConsumption_ = x.previousDayOverallConsumption_;
      this->qualityOfReading_ = x.qualityOfReading_;
      this->ratchetDemand_ = x.ratchetDemand_;
      this->ratchetDemandPeriod_ = x.ratchetDemandPeriod_;
      this->statusTimeStamp_ = x.statusTimeStamp_;
    }

    return *this;
  }

  ElectricPowerUsageSummary::
  ~ElectricPowerUsageSummary ()
  {
  }
}

#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 espi
{
  ::std::ostream&
  operator<< (::std::ostream& o, const ElectricPowerUsageSummary& i)
  {
    o << static_cast< const ::espi::IdentifiedObject& > (i);

    if (i.billingPeriod ())
    {
      o << ::std::endl << "billingPeriod: " << *i.billingPeriod ();
    }

    if (i.billLastPeriod ())
    {
      o << ::std::endl << "billLastPeriod: " << *i.billLastPeriod ();
    }

    if (i.billToDate ())
    {
      o << ::std::endl << "billToDate: " << *i.billToDate ();
    }

    if (i.costAdditionalLastPeriod ())
    {
      o << ::std::endl << "costAdditionalLastPeriod: " << *i.costAdditionalLastPeriod ();
    }

    for (ElectricPowerUsageSummary::costAdditionalDetailLastPeriod_const_iterator
         b (i.costAdditionalDetailLastPeriod ().begin ()), e (i.costAdditionalDetailLastPeriod ().end ());
         b != e; ++b)
    {
      o << ::std::endl << "costAdditionalDetailLastPeriod: " << *b;
    }

    if (i.currency ())
    {
      o << ::std::endl << "currency: " << *i.currency ();
    }

    if (i.overallConsumptionLastPeriod ())
    {
      o << ::std::endl << "overallConsumptionLastPeriod: " << *i.overallConsumptionLastPeriod ();
    }

    if (i.currentBillingPeriodOverAllConsumption ())
    {
      o << ::std::endl << "currentBillingPeriodOverAllConsumption: " << *i.currentBillingPeriodOverAllConsumption ();
    }

    if (i.currentDayLastYearNetConsumption ())
    {
      o << ::std::endl << "currentDayLastYearNetConsumption: " << *i.currentDayLastYearNetConsumption ();
    }

    if (i.currentDayNetConsumption ())
    {
      o << ::std::endl << "currentDayNetConsumption: " << *i.currentDayNetConsumption ();
    }

    if (i.currentDayOverallConsumption ())
    {
      o << ::std::endl << "currentDayOverallConsumption: " << *i.currentDayOverallConsumption ();
    }

    if (i.peakDemand ())
    {
      o << ::std::endl << "peakDemand: " << *i.peakDemand ();
    }

    if (i.previousDayLastYearOverallConsumption ())
    {
      o << ::std::endl << "previousDayLastYearOverallConsumption: " << *i.previousDayLastYearOverallConsumption ();
    }

    if (i.previousDayNetConsumption ())
    {
      o << ::std::endl << "previousDayNetConsumption: " << *i.previousDayNetConsumption ();
    }

    if (i.previousDayOverallConsumption ())
    {
      o << ::std::endl << "previousDayOverallConsumption: " << *i.previousDayOverallConsumption ();
    }

    if (i.qualityOfReading ())
    {
      o << ::std::endl << "qualityOfReading: " << *i.qualityOfReading ();
    }

    if (i.ratchetDemand ())
    {
      o << ::std::endl << "ratchetDemand: " << *i.ratchetDemand ();
    }

    if (i.ratchetDemandPeriod ())
    {
      o << ::std::endl << "ratchetDemandPeriod: " << *i.ratchetDemandPeriod ();
    }

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

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

namespace espi
{
}

#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 espi
{
  void
  operator<< (::xercesc::DOMElement& e, const ElectricPowerUsageSummary& i)
  {
    e << static_cast< const ::espi::IdentifiedObject& > (i);

    // billingPeriod
    //
    if (i.billingPeriod ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "billingPeriod",
          "http://naesb.org/espi",
          e));

      s << *i.billingPeriod ();
    }

    // billLastPeriod
    //
    if (i.billLastPeriod ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "billLastPeriod",
          "http://naesb.org/espi",
          e));

      s << *i.billLastPeriod ();
    }

    // billToDate
    //
    if (i.billToDate ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "billToDate",
          "http://naesb.org/espi",
          e));

      s << *i.billToDate ();
    }

    // costAdditionalLastPeriod
    //
    if (i.costAdditionalLastPeriod ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "costAdditionalLastPeriod",
          "http://naesb.org/espi",
          e));

      s << *i.costAdditionalLastPeriod ();
    }

    // costAdditionalDetailLastPeriod
    //
    for (ElectricPowerUsageSummary::costAdditionalDetailLastPeriod_const_iterator
         b (i.costAdditionalDetailLastPeriod ().begin ()), n (i.costAdditionalDetailLastPeriod ().end ());
         b != n; ++b)
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "costAdditionalDetailLastPeriod",
          "http://naesb.org/espi",
          e));

      s << *b;
    }

    // currency
    //
    if (i.currency ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "currency",
          "http://naesb.org/espi",
          e));

      s << *i.currency ();
    }

    // overallConsumptionLastPeriod
    //
    if (i.overallConsumptionLastPeriod ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "overallConsumptionLastPeriod",
          "http://naesb.org/espi",
          e));

      s << *i.overallConsumptionLastPeriod ();
    }

    // currentBillingPeriodOverAllConsumption
    //
    if (i.currentBillingPeriodOverAllConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "currentBillingPeriodOverAllConsumption",
          "http://naesb.org/espi",
          e));

      s << *i.currentBillingPeriodOverAllConsumption ();
    }

    // currentDayLastYearNetConsumption
    //
    if (i.currentDayLastYearNetConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "currentDayLastYearNetConsumption",
          "http://naesb.org/espi",
          e));

      s << *i.currentDayLastYearNetConsumption ();
    }

    // currentDayNetConsumption
    //
    if (i.currentDayNetConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "currentDayNetConsumption",
          "http://naesb.org/espi",
          e));

      s << *i.currentDayNetConsumption ();
    }

    // currentDayOverallConsumption
    //
    if (i.currentDayOverallConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "currentDayOverallConsumption",
          "http://naesb.org/espi",
          e));

      s << *i.currentDayOverallConsumption ();
    }

    // peakDemand
    //
    if (i.peakDemand ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "peakDemand",
          "http://naesb.org/espi",
          e));

      s << *i.peakDemand ();
    }

    // previousDayLastYearOverallConsumption
    //
    if (i.previousDayLastYearOverallConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "previousDayLastYearOverallConsumption",
          "http://naesb.org/espi",
          e));

      s << *i.previousDayLastYearOverallConsumption ();
    }

    // previousDayNetConsumption
    //
    if (i.previousDayNetConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "previousDayNetConsumption",
          "http://naesb.org/espi",
          e));

      s << *i.previousDayNetConsumption ();
    }

    // previousDayOverallConsumption
    //
    if (i.previousDayOverallConsumption ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "previousDayOverallConsumption",
          "http://naesb.org/espi",
          e));

      s << *i.previousDayOverallConsumption ();
    }

    // qualityOfReading
    //
    if (i.qualityOfReading ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "qualityOfReading",
          "http://naesb.org/espi",
          e));

      s << *i.qualityOfReading ();
    }

    // ratchetDemand
    //
    if (i.ratchetDemand ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "ratchetDemand",
          "http://naesb.org/espi",
          e));

      s << *i.ratchetDemand ();
    }

    // ratchetDemandPeriod
    //
    if (i.ratchetDemandPeriod ())
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "ratchetDemandPeriod",
          "http://naesb.org/espi",
          e));

      s << *i.ratchetDemandPeriod ();
    }

    // statusTimeStamp
    //
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "statusTimeStamp",
          "http://naesb.org/espi",
          e));

      s << i.statusTimeStamp ();
    }
  }
}

#include <xsd/cxx/post.hxx>

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

