// PhBProceduralTextureP.C: PhBProceduralTexture nodes (private source).
// Automatically generated with nodegen 0.5a - do not edit.

#include "PhBProceduralTexture.H"
#include "xrmlP.H"

namespace xrml {
int PhBProceduralTexture::major_version(void) { return 0; }
int PhBProceduralTexture::minor_version(void) { return 5; }
bool PhBProceduralTexture::is_leaf_class(void) { return true; }

bool IsPhBProceduralTexture(SFNode* node)
{
  return (dynamic_cast<PhBProceduralTexture*>(node) != 0);
}

bool PhBProceduralTexture::assign_url(const MFString& value)
{
  // TODO: value range check!
  url = value;
  status |= url_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_PhBProceduralTexture_url(SFNode* node, const fieldValue& value)
{
  PhBProceduralTexture* PhBProceduralTexture_node = dynamic_cast<PhBProceduralTexture*>(node);
  if (!PhBProceduralTexture_node)
    Fatal(-1, "assign_PhBProceduralTexture_url", "called for a non-PhBProceduralTexture node");
  return PhBProceduralTexture_node->assign_url((const MFString&)value);
}

PhBProceduralTexture::PhBProceduralTexture()
{
  interfaceMember* the_interface[1] = {
    new field("url", fieldValue(&url), assign_PhBProceduralTexture_url),
  };
  SFNode::construct(PhBProceduralTextureTypeId, 1, the_interface);

  url = MFString(0);
  
  PhBTexture::util_init();
  PhBProceduralTexture::util_init();
}

void PhBProceduralTexture::destruct(void)
{
  PhBProceduralTexture::util_destruct();
  PhBTexture::util_destruct();
  SFNode::destruct();
}

PhBProceduralTexture::~PhBProceduralTexture()
{
  destruct();
}

void PhBProceduralTexture::clone_here(const PhBProceduralTexture& src)
{
  SFNode::clone(src);
  
  interface[0]->value = fieldValue(&url);
  
  url = src.url;
  
  PhBTexture::util_clone(src);
  PhBProceduralTexture::util_clone(src);
}

PhBProceduralTexture::PhBProceduralTexture(const PhBProceduralTexture& src)
{
  clone_here(src);
}

PhBProceduralTexture& PhBProceduralTexture::operator=(const PhBProceduralTexture& src)
{
  if (this != &src) {
    destruct();
    clone_here(src);
  }
  return *this;
}

SFNode* PhBProceduralTexture::instantiate(Proto *enclosing_proto)
{
  if (nameIndex>=0)
    // named node: return pointer to pre-made instance
    return enclosing_proto ? enclosing_proto->namedNodes[nameIndex] : this;
  
  PhBProceduralTexture* instance = new PhBProceduralTexture(*this);
  instance->instantiate_interface(enclosing_proto);
  return instance;
}

}  // namespace xrml
