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

#include "PhBProceduralPhaseFunction.H"
#include "xrmlP.H"

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

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

bool PhBProceduralPhaseFunction::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_PhBProceduralPhaseFunction_url(SFNode* node, const fieldValue& value)
{
  PhBProceduralPhaseFunction* PhBProceduralPhaseFunction_node = dynamic_cast<PhBProceduralPhaseFunction*>(node);
  if (!PhBProceduralPhaseFunction_node)
    Fatal(-1, "assign_PhBProceduralPhaseFunction_url", "called for a non-PhBProceduralPhaseFunction node");
  return PhBProceduralPhaseFunction_node->assign_url((const MFString&)value);
}

PhBProceduralPhaseFunction::PhBProceduralPhaseFunction()
{
  interfaceMember* the_interface[1] = {
    new field("url", fieldValue(&url), assign_PhBProceduralPhaseFunction_url),
  };
  SFNode::construct(PhBProceduralPhaseFunctionTypeId, 1, the_interface);

  url = MFString(0);
  
  PhBPhaseFunction::util_init();
  PhBProceduralPhaseFunction::util_init();
}

void PhBProceduralPhaseFunction::destruct(void)
{
  PhBProceduralPhaseFunction::util_destruct();
  PhBPhaseFunction::util_destruct();
  SFNode::destruct();
}

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

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

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

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

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

}  // namespace xrml
