// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#include <PlotInfoAttributes.h>
#include <DataNode.h>

// ****************************************************************************
// Method: PlotInfoAttributes::PlotInfoAttributes
//
// Purpose:
//   Init utility for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

void PlotInfoAttributes::Init()
{

    PlotInfoAttributes::SelectAll();
}

// ****************************************************************************
// Method: PlotInfoAttributes::PlotInfoAttributes
//
// Purpose:
//   Copy utility for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

void PlotInfoAttributes::Copy(const PlotInfoAttributes &obj)
{
    data = obj.data;

    PlotInfoAttributes::SelectAll();
}

// Type map format string
const char *PlotInfoAttributes::TypeMapFormatString = PLOTINFOATTRIBUTES_TMFS;
const AttributeGroup::private_tmfs_t PlotInfoAttributes::TmfsStruct = {PLOTINFOATTRIBUTES_TMFS};


// ****************************************************************************
// Method: PlotInfoAttributes::PlotInfoAttributes
//
// Purpose:
//   Default constructor for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

PlotInfoAttributes::PlotInfoAttributes() :
    AttributeSubject(PlotInfoAttributes::TypeMapFormatString)
{
    PlotInfoAttributes::Init();
}

// ****************************************************************************
// Method: PlotInfoAttributes::PlotInfoAttributes
//
// Purpose:
//   Constructor for the derived classes of PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

PlotInfoAttributes::PlotInfoAttributes(private_tmfs_t tmfs) :
    AttributeSubject(tmfs.tmfs)
{
    PlotInfoAttributes::Init();
}

// ****************************************************************************
// Method: PlotInfoAttributes::PlotInfoAttributes
//
// Purpose:
//   Copy constructor for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

PlotInfoAttributes::PlotInfoAttributes(const PlotInfoAttributes &obj) :
    AttributeSubject(PlotInfoAttributes::TypeMapFormatString)
{
    PlotInfoAttributes::Copy(obj);
}

// ****************************************************************************
// Method: PlotInfoAttributes::PlotInfoAttributes
//
// Purpose:
//   Copy constructor for derived classes of the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

PlotInfoAttributes::PlotInfoAttributes(const PlotInfoAttributes &obj, private_tmfs_t tmfs) :
    AttributeSubject(tmfs.tmfs)
{
    PlotInfoAttributes::Copy(obj);
}

// ****************************************************************************
// Method: PlotInfoAttributes::~PlotInfoAttributes
//
// Purpose:
//   Destructor for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

PlotInfoAttributes::~PlotInfoAttributes()
{
    // nothing here
}

// ****************************************************************************
// Method: PlotInfoAttributes::operator =
//
// Purpose:
//   Assignment operator for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

PlotInfoAttributes&
PlotInfoAttributes::operator = (const PlotInfoAttributes &obj)
{
    if (this == &obj) return *this;

    PlotInfoAttributes::Copy(obj);

    return *this;
}

// ****************************************************************************
// Method: PlotInfoAttributes::operator ==
//
// Purpose:
//   Comparison operator == for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

bool
PlotInfoAttributes::operator == (const PlotInfoAttributes &obj) const
{
    // Create the return value
    return ((data == obj.data));
}

// ****************************************************************************
// Method: PlotInfoAttributes::operator !=
//
// Purpose:
//   Comparison operator != for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

bool
PlotInfoAttributes::operator != (const PlotInfoAttributes &obj) const
{
    return !(this->operator == (obj));
}

// ****************************************************************************
// Method: PlotInfoAttributes::TypeName
//
// Purpose:
//   Type name method for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

const std::string
PlotInfoAttributes::TypeName() const
{
    return "PlotInfoAttributes";
}

// ****************************************************************************
// Method: PlotInfoAttributes::CopyAttributes
//
// Purpose:
//   CopyAttributes method for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

bool
PlotInfoAttributes::CopyAttributes(const AttributeGroup *atts)
{
    if(TypeName() != atts->TypeName())
        return false;

    // Call assignment operator.
    const PlotInfoAttributes *tmp = (const PlotInfoAttributes *)atts;
    *this = *tmp;

    return true;
}

// ****************************************************************************
// Method: PlotInfoAttributes::CreateCompatible
//
// Purpose:
//   CreateCompatible method for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

AttributeSubject *
PlotInfoAttributes::CreateCompatible(const std::string &tname) const
{
    AttributeSubject *retval = 0;
    if(TypeName() == tname)
        retval = new PlotInfoAttributes(*this);
    // Other cases could go here too.

    return retval;
}

// ****************************************************************************
// Method: PlotInfoAttributes::NewInstance
//
// Purpose:
//   NewInstance method for the PlotInfoAttributes class.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

AttributeSubject *
PlotInfoAttributes::NewInstance(bool copy) const
{
    AttributeSubject *retval = 0;
    if(copy)
        retval = new PlotInfoAttributes(*this);
    else
        retval = new PlotInfoAttributes;

    return retval;
}

// ****************************************************************************
// Method: PlotInfoAttributes::SelectAll
//
// Purpose:
//   Selects all attributes.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

void
PlotInfoAttributes::SelectAll()
{
    Select(ID_data, (void *)&data);
}

///////////////////////////////////////////////////////////////////////////////
// Set property methods
///////////////////////////////////////////////////////////////////////////////

void
PlotInfoAttributes::SetData(const MapNode &data_)
{
    data = data_;
    Select(ID_data, (void *)&data);
}

///////////////////////////////////////////////////////////////////////////////
// Get property methods
///////////////////////////////////////////////////////////////////////////////

const MapNode &
PlotInfoAttributes::GetData() const
{
    return data;
}

MapNode &
PlotInfoAttributes::GetData()
{
    return data;
}

///////////////////////////////////////////////////////////////////////////////
// Select property methods
///////////////////////////////////////////////////////////////////////////////

void
PlotInfoAttributes::SelectData()
{
    Select(ID_data, (void *)&data);
}

///////////////////////////////////////////////////////////////////////////////
// Keyframing methods
///////////////////////////////////////////////////////////////////////////////

// ****************************************************************************
// Method: PlotInfoAttributes::GetFieldName
//
// Purpose:
//   This method returns the name of a field given its index.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

std::string
PlotInfoAttributes::GetFieldName(int index) const
{
    switch (index)
    {
    case ID_data: return "data";
    default:  return "invalid index";
    }
}

// ****************************************************************************
// Method: PlotInfoAttributes::GetFieldType
//
// Purpose:
//   This method returns the type of a field given its index.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

AttributeGroup::FieldType
PlotInfoAttributes::GetFieldType(int index) const
{
    switch (index)
    {
    case ID_data: return FieldType_MapNode;
    default:  return FieldType_unknown;
    }
}

// ****************************************************************************
// Method: PlotInfoAttributes::GetFieldTypeName
//
// Purpose:
//   This method returns the name of a field type given its index.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

std::string
PlotInfoAttributes::GetFieldTypeName(int index) const
{
    switch (index)
    {
    case ID_data: return "MapNode";
    default:  return "invalid index";
    }
}

// ****************************************************************************
// Method: PlotInfoAttributes::FieldsEqual
//
// Purpose:
//   This method compares two fields and return true if they are equal.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

bool
PlotInfoAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
{
    const PlotInfoAttributes &obj = *((const PlotInfoAttributes*)rhs);
    bool retval = false;
    switch (index_)
    {
    case ID_data:
        {  // new scope
        retval = (data == obj.data);
        }
        break;
    default: retval = false;
    }

    return retval;
}

///////////////////////////////////////////////////////////////////////////////
// User-defined methods.
///////////////////////////////////////////////////////////////////////////////

void
PlotInfoAttributes::PrintSelf(ostream &os)
{
    os << "Data:\n" ;
    os << data.ToXML();
}

void
PlotInfoAttributes::Reset()
{
    data.Reset();
    SelectData();
}

void
PlotInfoAttributes::Merge(const PlotInfoAttributes &obj)
{
    data.Merge(obj.GetData());
    SelectData();
}

