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

#include "PhBAshikminReflector.H"
#include "xrmlP.H"

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

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

bool PhBAshikminReflector::assign_nv(const SFFloat& value)
{
  // TODO: value range check!
  nv = value;
  status |= nv_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_PhBAshikminReflector_nv(SFNode* node, const fieldValue& value)
{
  PhBAshikminReflector* PhBAshikminReflector_node = dynamic_cast<PhBAshikminReflector*>(node);
  if (!PhBAshikminReflector_node)
    Fatal(-1, "assign_PhBAshikminReflector_nv", "called for a non-PhBAshikminReflector node");
  return PhBAshikminReflector_node->assign_nv((const SFFloat&)value);
}

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

bool PhBAshikminReflector::assign_nu(const SFFloat& value)
{
  // TODO: value range check!
  nu = value;
  status |= nu_updated;
  timestamp = interface[1]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_PhBAshikminReflector_nu(SFNode* node, const fieldValue& value)
{
  PhBAshikminReflector* PhBAshikminReflector_node = dynamic_cast<PhBAshikminReflector*>(node);
  if (!PhBAshikminReflector_node)
    Fatal(-1, "assign_PhBAshikminReflector_nu", "called for a non-PhBAshikminReflector node");
  return PhBAshikminReflector_node->assign_nu((const SFFloat&)value);
}

void PhBAshikminReflector::set_nu(const SFFloat& val)
{
  SFFloat tmpval(val);
  fieldValue v(&tmpval);
  interface[1]->assign(this, v);
}

PhBAshikminReflector::PhBAshikminReflector()
{
  interfaceMember* the_interface[2] = {
    new exposedField("nv", fieldValue(&nv), assign_PhBAshikminReflector_nv),
    new exposedField("nu", fieldValue(&nu), assign_PhBAshikminReflector_nu),
  };
  SFNode::construct(PhBAshikminReflectorTypeId, 2, the_interface);

  nv = 1;
  nu = 1;
  
  PhBScatterer::util_init();
  PhBAshikminReflector::util_init();
}

void PhBAshikminReflector::destruct(void)
{
  PhBAshikminReflector::util_destruct();
  PhBScatterer::util_destruct();
  SFNode::destruct();
}

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

void PhBAshikminReflector::clone_here(const PhBAshikminReflector& src)
{
  SFNode::clone(src);
  
  interface[0]->value = fieldValue(&nv);
  interface[1]->value = fieldValue(&nu);
  
  nv = src.nv;
  nu = src.nu;
  
  PhBScatterer::util_clone(src);
  PhBAshikminReflector::util_clone(src);
}

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

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

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

}  // namespace xrml
