//
// h46019.cxx
//
// Code automatically generated by asnparse.
//

#ifdef P_USE_PRAGMA
#pragma implementation "h46019.h"
#endif

#include <ptlib.h>

#include <opal/buildopts.h>

#include "h460/h46019.h"

#if OPAL_H460

#define new PNEW


//
// TraversalParameters
//

H46019_TraversalParameters::H46019_TraversalParameters(unsigned tag, PASN_Object::TagClass tagClass)
  : PASN_Sequence(tag, tagClass, 6, TRUE, 0)
{
  m_multiplexID.SetConstraints(PASN_Object::FixedConstraint, 0, 4294967295U);
  m_keepAlivePayloadType.SetConstraints(PASN_Object::FixedConstraint, 0, 127);
}


#ifndef PASN_NOPRINTON
void H46019_TraversalParameters::PrintOn(ostream & strm) const
{
  std::streamsize indent = strm.precision() + 2;
  strm << "{\n";
  if (HasOptionalField(e_multiplexedMediaChannel))
    strm << setw(indent+26) << "multiplexedMediaChannel = " << setprecision(indent) << m_multiplexedMediaChannel << '\n';
  if (HasOptionalField(e_multiplexedMediaControlChannel))
    strm << setw(indent+33) << "multiplexedMediaControlChannel = " << setprecision(indent) << m_multiplexedMediaControlChannel << '\n';
  if (HasOptionalField(e_multiplexID))
    strm << setw(indent+14) << "multiplexID = " << setprecision(indent) << m_multiplexID << '\n';
  if (HasOptionalField(e_keepAliveChannel))
    strm << setw(indent+19) << "keepAliveChannel = " << setprecision(indent) << m_keepAliveChannel << '\n';
  if (HasOptionalField(e_keepAlivePayloadType))
    strm << setw(indent+23) << "keepAlivePayloadType = " << setprecision(indent) << m_keepAlivePayloadType << '\n';
  if (HasOptionalField(e_keepAliveInterval))
    strm << setw(indent+20) << "keepAliveInterval = " << setprecision(indent) << m_keepAliveInterval << '\n';
  strm << setw(indent-1) << setprecision(indent-2) << "}";
}
#endif


PObject::Comparison H46019_TraversalParameters::Compare(const PObject & obj) const
{
#ifndef PASN_LEANANDMEAN
  PAssert(PIsDescendant(&obj, H46019_TraversalParameters), PInvalidCast);
#endif
  const H46019_TraversalParameters & other = (const H46019_TraversalParameters &)obj;

  Comparison result;

  if ((result = m_multiplexedMediaChannel.Compare(other.m_multiplexedMediaChannel)) != EqualTo)
    return result;
  if ((result = m_multiplexedMediaControlChannel.Compare(other.m_multiplexedMediaControlChannel)) != EqualTo)
    return result;
  if ((result = m_multiplexID.Compare(other.m_multiplexID)) != EqualTo)
    return result;
  if ((result = m_keepAliveChannel.Compare(other.m_keepAliveChannel)) != EqualTo)
    return result;
  if ((result = m_keepAlivePayloadType.Compare(other.m_keepAlivePayloadType)) != EqualTo)
    return result;
  if ((result = m_keepAliveInterval.Compare(other.m_keepAliveInterval)) != EqualTo)
    return result;

  return PASN_Sequence::Compare(other);
}


PINDEX H46019_TraversalParameters::GetDataLength() const
{
  PINDEX length = 0;
  if (HasOptionalField(e_multiplexedMediaChannel))
    length += m_multiplexedMediaChannel.GetObjectLength();
  if (HasOptionalField(e_multiplexedMediaControlChannel))
    length += m_multiplexedMediaControlChannel.GetObjectLength();
  if (HasOptionalField(e_multiplexID))
    length += m_multiplexID.GetObjectLength();
  if (HasOptionalField(e_keepAliveChannel))
    length += m_keepAliveChannel.GetObjectLength();
  if (HasOptionalField(e_keepAlivePayloadType))
    length += m_keepAlivePayloadType.GetObjectLength();
  if (HasOptionalField(e_keepAliveInterval))
    length += m_keepAliveInterval.GetObjectLength();
  return length;
}


PBoolean H46019_TraversalParameters::Decode(PASN_Stream & strm)
{
  if (!PreambleDecode(strm))
    return FALSE;

  if (HasOptionalField(e_multiplexedMediaChannel) && !m_multiplexedMediaChannel.Decode(strm))
    return FALSE;
  if (HasOptionalField(e_multiplexedMediaControlChannel) && !m_multiplexedMediaControlChannel.Decode(strm))
    return FALSE;
  if (HasOptionalField(e_multiplexID) && !m_multiplexID.Decode(strm))
    return FALSE;
  if (HasOptionalField(e_keepAliveChannel) && !m_keepAliveChannel.Decode(strm))
    return FALSE;
  if (HasOptionalField(e_keepAlivePayloadType) && !m_keepAlivePayloadType.Decode(strm))
    return FALSE;
  if (HasOptionalField(e_keepAliveInterval) && !m_keepAliveInterval.Decode(strm))
    return FALSE;

  return UnknownExtensionsDecode(strm);
}


void H46019_TraversalParameters::Encode(PASN_Stream & strm) const
{
  PreambleEncode(strm);

  if (HasOptionalField(e_multiplexedMediaChannel))
    m_multiplexedMediaChannel.Encode(strm);
  if (HasOptionalField(e_multiplexedMediaControlChannel))
    m_multiplexedMediaControlChannel.Encode(strm);
  if (HasOptionalField(e_multiplexID))
    m_multiplexID.Encode(strm);
  if (HasOptionalField(e_keepAliveChannel))
    m_keepAliveChannel.Encode(strm);
  if (HasOptionalField(e_keepAlivePayloadType))
    m_keepAlivePayloadType.Encode(strm);
  if (HasOptionalField(e_keepAliveInterval))
    m_keepAliveInterval.Encode(strm);

  UnknownExtensionsEncode(strm);
}


PObject * H46019_TraversalParameters::Clone() const
{
#ifndef PASN_LEANANDMEAN
  PAssert(IsClass(H46019_TraversalParameters::Class()), PInvalidCast);
#endif
  return new H46019_TraversalParameters(*this);
}


#endif // OPAL_H460


// End of h46019.cxx
