Files
src_old/visit_plugins/operators/RandomSample/H5PartRandomSampleAttributes.C
T

471 lines
12 KiB
C++

#include <H5PartRandomSampleAttributes.h>
#include <DataNode.h>
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::H5PartRandomSampleAttributes
//
// Purpose:
// Constructor for the H5PartRandomSampleAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
H5PartRandomSampleAttributes::H5PartRandomSampleAttributes() : AttributeSubject("f")
{
factor = 1;
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::H5PartRandomSampleAttributes
//
// Purpose:
// Copy constructor for the H5PartRandomSampleAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
H5PartRandomSampleAttributes::H5PartRandomSampleAttributes(const H5PartRandomSampleAttributes &obj) : AttributeSubject("f")
{
factor = obj.factor;
SelectAll();
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::~H5PartRandomSampleAttributes
//
// Purpose:
// Destructor for the H5PartRandomSampleAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
H5PartRandomSampleAttributes::~H5PartRandomSampleAttributes()
{
// nothing here
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::operator =
//
// Purpose:
// Assignment operator for the H5PartRandomSampleAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
H5PartRandomSampleAttributes&
H5PartRandomSampleAttributes::operator = (const H5PartRandomSampleAttributes &obj)
{
if (this == &obj) return *this;
factor = obj.factor;
SelectAll();
return *this;
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::operator ==
//
// Purpose:
// Comparison operator == for the H5PartRandomSampleAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
bool
H5PartRandomSampleAttributes::operator == (const H5PartRandomSampleAttributes &obj) const
{
// Create the return value
return ((factor == obj.factor));
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::operator !=
//
// Purpose:
// Comparison operator != for the H5PartRandomSampleAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
bool
H5PartRandomSampleAttributes::operator != (const H5PartRandomSampleAttributes &obj) const
{
return !(this->operator == (obj));
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::TypeName
//
// Purpose:
// Type name method for the H5PartRandomSampleAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
const std::string
H5PartRandomSampleAttributes::TypeName() const
{
return "H5PartRandomSampleAttributes";
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::CopyAttributes
//
// Purpose:
// CopyAttributes method for the H5PartRandomSampleAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
bool
H5PartRandomSampleAttributes::CopyAttributes(const AttributeGroup *atts)
{
if(TypeName() != atts->TypeName())
return false;
// Call assignment operator.
const H5PartRandomSampleAttributes *tmp = (const H5PartRandomSampleAttributes *)atts;
*this = *tmp;
return true;
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::CreateCompatible
//
// Purpose:
// CreateCompatible method for the H5PartRandomSampleAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
H5PartRandomSampleAttributes::CreateCompatible(const std::string &tname) const
{
AttributeSubject *retval = 0;
if(TypeName() == tname)
retval = new H5PartRandomSampleAttributes(*this);
// Other cases could go here too.
return retval;
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::NewInstance
//
// Purpose:
// NewInstance method for the H5PartRandomSampleAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
H5PartRandomSampleAttributes::NewInstance(bool copy) const
{
AttributeSubject *retval = 0;
if(copy)
retval = new H5PartRandomSampleAttributes(*this);
else
retval = new H5PartRandomSampleAttributes;
return retval;
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::SelectAll
//
// Purpose:
// Selects all attributes.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
void
H5PartRandomSampleAttributes::SelectAll()
{
Select(0, (void *)&factor);
}
///////////////////////////////////////////////////////////////////////////////
// Persistence methods
///////////////////////////////////////////////////////////////////////////////
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::CreateNode
//
// Purpose:
// This method creates a DataNode representation of the object so it can be saved to a config file.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
bool
H5PartRandomSampleAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forceAdd)
{
if(parentNode == 0)
return false;
H5PartRandomSampleAttributes defaultObject;
bool addToParent = false;
// Create a node for H5PartRandomSampleAttributes.
DataNode *node = new DataNode("H5PartRandomSampleAttributes");
if(completeSave || !FieldsEqual(0, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("factor", factor));
}
// Add the node to the parent node.
if(addToParent || forceAdd)
parentNode->AddNode(node);
else
delete node;
return (addToParent || forceAdd);
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::SetFromNode
//
// Purpose:
// This method sets attributes in this object from values in a DataNode representation of the object.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
void
H5PartRandomSampleAttributes::SetFromNode(DataNode *parentNode)
{
int i;
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("H5PartRandomSampleAttributes");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("factor")) != 0)
SetFactor(node->AsFloat());
}
///////////////////////////////////////////////////////////////////////////////
// Set property methods
///////////////////////////////////////////////////////////////////////////////
void
H5PartRandomSampleAttributes::SetFactor(float factor_)
{
factor = factor_;
Select(0, (void *)&factor);
}
///////////////////////////////////////////////////////////////////////////////
// Get property methods
///////////////////////////////////////////////////////////////////////////////
float
H5PartRandomSampleAttributes::GetFactor() const
{
return factor;
}
///////////////////////////////////////////////////////////////////////////////
// Keyframing methods
///////////////////////////////////////////////////////////////////////////////
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::GetFieldName
//
// Purpose:
// This method returns the name of a field given its index.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
std::string
H5PartRandomSampleAttributes::GetFieldName(int index) const
{
switch (index)
{
case 0: return "factor";
default: return "invalid index";
}
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::GetFieldType
//
// Purpose:
// This method returns the type of a field given its index.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
AttributeGroup::FieldType
H5PartRandomSampleAttributes::GetFieldType(int index) const
{
switch (index)
{
case 0: return FieldType_float;
default: return FieldType_unknown;
}
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::GetFieldTypeName
//
// Purpose:
// This method returns the name of a field type given its index.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
std::string
H5PartRandomSampleAttributes::GetFieldTypeName(int index) const
{
switch (index)
{
case 0: return "float";
default: return "invalid index";
}
}
// ****************************************************************************
// Method: H5PartRandomSampleAttributes::FieldsEqual
//
// Purpose:
// This method compares two fields and return true if they are equal.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Mar 16 10:26:55 PDT 2006
//
// Modifications:
//
// ****************************************************************************
bool
H5PartRandomSampleAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
{
const H5PartRandomSampleAttributes &obj = *((const H5PartRandomSampleAttributes*)rhs);
bool retval = false;
switch (index_)
{
case 0:
{ // new scope
retval = (factor == obj.factor);
}
break;
default: retval = false;
}
return retval;
}
///////////////////////////////////////////////////////////////////////////////
// User-defined methods.
///////////////////////////////////////////////////////////////////////////////