// PhBSchlickPhaseFunctionP.C: PhBSchlickPhaseFunction nodes (private source).
// Automatically generated with nodegen 0.51 - do not edit.

#include "PhBSchlickPhaseFunction.H"
#include "xrmlP.H"

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

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

bool PhBSchlickPhaseFunction::assign_k(const SFFloat& value)
{
  // TODO: value range check!
  k = value;
  status |= k_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_PhBSchlickPhaseFunction_k(SFNode* node, const fieldValue& value)
{
  PhBSchlickPhaseFunction* PhBSchlickPhaseFunction_node = dynamic_cast<PhBSchlickPhaseFunction*>(node);
  if (!PhBSchlickPhaseFunction_node)
    Fatal(-1, "assign_PhBSchlickPhaseFunction_k", "called for a non-PhBSchlickPhaseFunction node");
  return PhBSchlickPhaseFunction_node->assign_k((const SFFloat&)value);
}

void PhBSchlickPhaseFunction::set_k(const SFFloat& val)
{
  SFFloat tmpval(val);
  fieldValue v(&tmpval);
  interface[0]->assign(this, v);
}

PhBSchlickPhaseFunction::PhBSchlickPhaseFunction()
{
  interfaceMember* the_interface[1] = {
    new exposedField("k", fieldValue(&k), assign_PhBSchlickPhaseFunction_k),
  };
  SFNode::construct(PhBSchlickPhaseFunctionTypeId, 1, the_interface);

  k = 0;
  
  PhBPhaseFunction::util_init();
  PhBIsotropicPhaseFunction::util_init();
  PhBSchlickPhaseFunction::util_init();
}

void PhBSchlickPhaseFunction::destruct(void)
{
  PhBSchlickPhaseFunction::util_destruct();
  PhBIsotropicPhaseFunction::util_destruct();
  PhBPhaseFunction::util_destruct();
  SFNode::destruct();
}

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

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

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

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

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

}  // namespace xrml
