/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is  part of VisIt. For  details, see https://visit.llnl.gov/.  The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution  and  use  in  source  and  binary  forms,  with  or  without
* modification, are permitted provided that the following conditions are met:
*
*  - Redistributions of  source code must  retain the above  copyright notice,
*    this list of conditions and the disclaimer below.
*  - Redistributions in binary form must reproduce the above copyright notice,
*    this  list of  conditions  and  the  disclaimer (as noted below)  in  the
*    documentation and/or other materials provided with the distribution.
*  - Neither the name of  the LLNS/LLNL nor the names of  its contributors may
*    be used to endorse or promote products derived from this software without
*    specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR  IMPLIED WARRANTIES, INCLUDING,  BUT NOT  LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND  FITNESS FOR A PARTICULAR  PURPOSE
* ARE  DISCLAIMED. IN  NO EVENT  SHALL LAWRENCE  LIVERMORE NATIONAL  SECURITY,
* LLC, THE  U.S.  DEPARTMENT OF  ENERGY  OR  CONTRIBUTORS BE  LIABLE  FOR  ANY
* DIRECT,  INDIRECT,   INCIDENTAL,   SPECIAL,   EXEMPLARY,  OR   CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT  LIMITED TO, PROCUREMENT OF  SUBSTITUTE GOODS OR
* SERVICES; LOSS OF  USE, DATA, OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER
* CAUSED  AND  ON  ANY  THEORY  OF  LIABILITY,  WHETHER  IN  CONTRACT,  STRICT
* LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY  WAY
* OUT OF THE  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/

#include <avtMatSpeciesMetaData.h>
#include <DataNode.h>

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

void avtMatSpeciesMetaData::Init()
{
    numSpecies = 0;
    validVariable = true;

    avtMatSpeciesMetaData::SelectAll();
}

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

void avtMatSpeciesMetaData::Copy(const avtMatSpeciesMetaData &obj)
{
    numSpecies = obj.numSpecies;
    speciesNames = obj.speciesNames;
    validVariable = obj.validVariable;

    avtMatSpeciesMetaData::SelectAll();
}

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


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

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

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

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

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

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

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

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

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

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

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

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

    avtMatSpeciesMetaData::Copy(obj);

    return *this;
}

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

bool
avtMatSpeciesMetaData::operator == (const avtMatSpeciesMetaData &obj) const
{
    // Create the return value
    return ((numSpecies == obj.numSpecies) &&
            (speciesNames == obj.speciesNames) &&
            (validVariable == obj.validVariable));
}

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

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

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

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

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

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

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

    return true;
}

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

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

    return retval;
}

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

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

    return retval;
}

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

void
avtMatSpeciesMetaData::SelectAll()
{
    Select(ID_numSpecies,    (void *)&numSpecies);
    Select(ID_speciesNames,  (void *)&speciesNames);
    Select(ID_validVariable, (void *)&validVariable);
}

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

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

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

// ****************************************************************************
//  Method: avtMatSpeciesMetaData constructor
//
//  Arguments:
//      ns           The number of species for this material.
//      sn           The name of each species for this material.
//
//  Programmer: Jeremy Meredith
//  Creation:   December 13, 2001
//
//  Modifications:
//
//    Hank Childs, Mon Dec  9 17:04:39 PST 2002
//    Initialized validVariable.
//
// ****************************************************************************

avtMatSpeciesMetaData::avtMatSpeciesMetaData(int ns, const stringVector &sn)
    : AttributeSubject(avtMatSpeciesMetaData::TypeMapFormatString)
{
    numSpecies    = ns;
    speciesNames  = sn;
    validVariable = true;
}

